|
| 1 | +# Contributing to @node-oauth/oauth2-server |
| 2 | + |
| 3 | +Thank you for your interest in this project and your aims to improving it. |
| 4 | +This guide will give you the most important info on how to contribute properly |
| 5 | +in order to get your pull requests accepted. |
| 6 | + |
| 7 | +## Disclose security vulnerabilities |
| 8 | + |
| 9 | +First things first: |
| 10 | +This project has strong security implications and we appreciate every help to |
| 11 | +improve security. |
| 12 | + |
| 13 | +**However, please read our [security policy](./SECURITY.md), before taking |
| 14 | +actions.** |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +## Guiding principles |
| 19 | + |
| 20 | +Before contributing to this project it is important to understand how this |
| 21 | +project and it's collaborators views itself regarding it's scope and purpose. |
| 22 | + |
| 23 | +### OAuth2 standard compliance |
| 24 | + |
| 25 | +This project aims full standard compliance. All improvements on functionality, |
| 26 | +as well as security implications, are done in a way that the standard remains |
| 27 | +as the highest reference of choice. |
| 28 | + |
| 29 | +If you are not familiar with the OAuth2 standards, please consult at least the |
| 30 | +following documents: |
| 31 | + |
| 32 | +- [RFC 6749 - The OAuth 2.0 Authorization Framework](https://datatracker.ietf.org/doc/html/rfc6749) |
| 33 | +- [RFC 8252 - OAuth 2.0 for Native Apps](https://datatracker.ietf.org/doc/html/rfc8252) |
| 34 | + |
| 35 | +Extended readings: |
| 36 | + |
| 37 | +- [RFC 6819 - OAuth 2.0 Threat Model and Security Considerations](https://datatracker.ietf.org/doc/html/rfc6819) |
| 38 | +- [RFC 7636 - Proof Key for Code Exchange by OAuth Public Clients](https://datatracker.ietf.org/doc/html/rfc7636) |
| 39 | +- [RFC 7591 - OAuth 2.0 Dynamic Client Registration Protocol](https://datatracker.ietf.org/doc/html/rfc7591) |
| 40 | + |
| 41 | +### Framework agnostic |
| 42 | + |
| 43 | +Design decisions and implementations are always done with keeping in mind, that |
| 44 | +there are multiple frameworks out there that use this project. |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +## Development |
| 49 | + |
| 50 | +If you want to fix bugs or add new features, **please read this chapter and it's |
| 51 | +sections carefully!** |
| 52 | + |
| 53 | +### No PR without issue |
| 54 | + |
| 55 | +Please make sure your commitment will be appreciated by first opening an issue |
| 56 | +and discuss, whether this is a useful addition to the project. |
| 57 | + |
| 58 | +### Work on a bug or a new feature |
| 59 | + |
| 60 | +First, clone and install this project from source via |
| 61 | + |
| 62 | +```bash |
| 63 | +$ git clone git@github.com:node-oauth/node-oauth2-server.git |
| 64 | +$ cd node-oauth2-server |
| 65 | +$ git checkout developmemt # important! do not work on master! |
| 66 | +$ npm install |
| 67 | +``` |
| 68 | + |
| 69 | +From here you can run several scripts for development purposes: |
| 70 | + |
| 71 | +```bash |
| 72 | +$ npm run test # runs the tests once |
| 73 | +$ npm run test:coverage # runs the tests including coverage |
| 74 | +$ npm run docs # generates the API docs |
| 75 | +``` |
| 76 | + |
| 77 | +To work on a new feature or a fix please create a new branch: |
| 78 | + |
| 79 | +```bash |
| 80 | +$ git checkout -b feature-xyz # or fix-xyz |
| 81 | +``` |
| 82 | + |
| 83 | +### Coding rules |
| 84 | + |
| 85 | +- Unit-testing: all features or bug fixes must be tested by specs |
| 86 | +- Documentation: all public API methods must be documented |
| 87 | + |
| 88 | +### Commit message convention |
| 89 | + |
| 90 | +We use a commit convention, inspired by [angular commit message format](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format) |
| 91 | +with ticket number at the end of summary: |
| 92 | + |
| 93 | +``` |
| 94 | +<type>(<scope>): <short summary> #<issue nuber> |
| 95 | +``` |
| 96 | +Summary in present tense. Not capitalized. No period at the end. |
| 97 | +The <type> and <summary> fields are mandatory, the (<scope>) and #<number> field is optional. |
| 98 | + |
| 99 | +### Run the tests before committing |
| 100 | + |
| 101 | +Please always make sure your code is passing linter and tests **before |
| 102 | +committing**. By doing so you help to make reviews much easier and don't pollute |
| 103 | +the history with commits, that are solely targeting lint fixes. |
| 104 | + |
| 105 | +You can run the tests via |
| 106 | + |
| 107 | +```bash |
| 108 | +$ npm run test |
| 109 | +``` |
| 110 | + |
| 111 | +or |
| 112 | + |
| 113 | +```bash |
| 114 | +$ npm run test:coverage |
| 115 | +``` |
| 116 | + |
| 117 | +to see your coverage. |
| 118 | + |
| 119 | +### Open a pull request (PR) |
| 120 | + |
| 121 | +Once you have implemented your changes and tested them locally, please open |
| 122 | +a [pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request). |
| 123 | + |
| 124 | +Note: sometimes a pull request (PR) is also referred to as merge request (MR). |
| 125 | + |
| 126 | +#### Fundamental PR requirements |
| 127 | + |
| 128 | +There are a few basic requirements for your pull request to become accepted: |
| 129 | + |
| 130 | +- Make sure to open your pull request to target the `development` branch and not |
| 131 | +`master` |
| 132 | +- Make sure you are working on a branch, other than `development`; usually you |
| 133 | + can name the branch after the feature or fix you want to provide |
| 134 | +- Resolve any merge conflicts (usually by keeping your branch updated with |
| 135 | + `development`) |
| 136 | +- Have a clear description on what the PR does, including any steps necessary |
| 137 | + for testing, reviewing, reproduction etc. |
| 138 | +- Link to the existing issue |
| 139 | +- Added functions or changed functions need to get documented in compliance with |
| 140 | + JSDoc |
| 141 | +- Make sure all CI Tests are passing |
| 142 | + |
| 143 | +Also make sure, to comply with the following list: |
| 144 | + |
| 145 | +- Do not work on `development` directly |
| 146 | +- Do not implement multiple features in one pull request (this includes bumping |
| 147 | + versions of dependencies that are not related to the PR/issue) |
| 148 | +- Do not bump the release version (unless you are a maintainer) |
| 149 | +- Do not edit the Changelog as this will be done after your PR is merged |
| 150 | +- Do not introduce tight dependencies to a certain package that has not been |
| 151 | + approved during the discussion in the issue |
| 152 | + |
| 153 | +#### Review process |
| 154 | + |
| 155 | +Finally your PR needs to pass the review process: |
| 156 | + |
| 157 | +- A certain amount of maintainers needs to review and accept your PR |
| 158 | +- Please **expect change requests**! They will occur and are intended to improve |
| 159 | + the overall code quality. |
| 160 | +- If your changes have been updated please re-assign the reviewer who asked for |
| 161 | + the changes |
| 162 | +- Once all reviewers have approved your PR it will be merged by one of the |
| 163 | + maintainers :tada: |
| 164 | + |
| 165 | +#### After merge |
| 166 | + |
| 167 | +Please delete your branch after merge. |
0 commit comments