| 1 | # Contributing to sudo-rs |
| 2 | |
| 3 | We welcome contributions to building a memory safe sudo / su implementation; this document lists |
| 4 | some ways in which you can help. |
| 5 | |
| 6 | This project is about building a "drop-in replacement" for sudo and su. That does not mean we want |
| 7 | to copy *all* of the behavior of original sudo or other su implementations. |
| 8 | |
| 9 | Whenever we add a feature, sudo becomes more complex, and unforeseen interactions due to complexity |
| 10 | can result in security issues. Also, sudo has some features for backwards compatibility only---it makes no |
| 11 | sense for us to re-implement a feature that by its nature won't be very well-used in practice. Other features |
| 12 | have a very specific use-case in mind (for example, matching command lines with [regular expressions](https://xkcd.com/1171/)), |
| 13 | which are very complex to use and would require the inclusion of a third-party library. |
| 14 | |
| 15 | I.e. every time we add a feature, we have to weigh its benefits to the cost of adding the feature. |
| 16 | For this, the sudo-rs Core Team has adopted a few criteria for inclusions of features in sudo / su: |
| 17 | |
| 18 | 1. Security is more important than functionality. |
| 19 | 2. Simplicity is preferred over complexity. |
| 20 | 3. A feature to be added should actually *solve* a problem. |
| 21 | 4. Features must support a common and reasonable use case. |
| 22 | 5. Dependencies must be kept to an absolute minimum. |
| 23 | |
| 24 | ## Feature requests |
| 25 | |
| 26 | The easiest way to contribute is to request a feature that we currently do not have; use |
| 27 | the issue tracker for this and explain the situation. Things that are currently possible |
| 28 | with original sudo and that pass the above-mentioned criteria are likely to be accepted. |
| 29 | |
| 30 | ## Testing sudo |
| 31 | |
| 32 | You can install and run sudo on your personal system, or any other non-mission critical |
| 33 | machine. We recommend installing it in `/usr/local/bin` so you have original sudo as a backup. |
| 34 | |
| 35 | Although sudo-rs is thoroughly tested for every change we make, a real-world test like this |
| 36 | can uncover subtle problems in technical parts, or uncover common sudo use cases that we |
| 37 | ignored so far. |
| 38 | |
| 39 | ## Small contributions |
| 40 | |
| 41 | You can also go through our code --- if you see any small mistakes or have suggestions |
| 42 | please create an issue for them. If it is really a minor issue, like a typo or formatting |
| 43 | issue, you can immediately create a pull request. |
| 44 | |
| 45 | ## Security auditing |
| 46 | |
| 47 | One way you can help is by looking at the security of our code and proposing fixes in it. |
| 48 | More eyeballs spot more problems. |
| 49 | |
| 50 | If you find a security problem that can be used to used to compromise a system, |
| 51 | do follow our [security policy] and report a vulnerability instead of using the |
| 52 | issue tracker. |
| 53 | |
| 54 | [security policy]: https://github.com/trifectatechfoundation/sudo-rs/security/policy |
| 55 | |
| 56 | ## Working on a bigger issue |
| 57 | |
| 58 | If you want to pick up a bigger issue in the issue tracker, please reach out to the |
| 59 | sudo-rs team first. The easiest way to do this is to comment on the issue. If you want |
| 60 | to work on something that is not on the issue tracker, do make an issue *before* you |
| 61 | begin to make sure your work will not be conflicting with ours. |
| 62 | |
| 63 | # Expectations for contributors |
| 64 | |
| 65 | ## Respect free software/open source licenses |
| 66 | |
| 67 | Since sudo-rs is licensed very permissively (Apache 2.0 or MIT), for every contribution |
| 68 | you make, you have to ensure that it is either your original work, or a derived work from |
| 69 | software that falls under a free software/open source license that allows its inclusion in |
| 70 | our repository. In the latter case your contribution must have clear attributions so we can |
| 71 | review whether we can include it in our project. |
| 72 | |
| 73 | ## Make your code easy to review |
| 74 | |
| 75 | The sudo-rs team has a limited amount of time to review contributions. You can help us by |
| 76 | structuring your pull request in atomic commits, using the commentary field to explain what |
| 77 | you are doing, and making an effort yourself to pass our CI checks. In short, you are the first |
| 78 | reviewer of your contribution. |
| 79 | |
| 80 | ## Use of generative artificial intelligence |
| 81 | |
| 82 | Contributions clearly showing heavy use of generative AI, so-called "vibe coding", will be |
| 83 | dismissed out of hand. |
| 84 | |
| 85 | There's nothing *inherently wrong* with using tool assistance while coding, including tools based |
| 86 | on generative AI. But when using AI to generate whole subroutines (or more) only based on prompts, |
| 87 | it becomes very hard to guarantee the previous two points: first, it is hard to tell whose original |
| 88 | work the contribution is; secondly, you are less able to perform a 'first review' of any code you |
| 89 | didn't write yourself. |