|
| 1 | +# Contributing to this project |
| 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 | +### Meteor specific |
| 42 | + |
| 43 | +All contributions should be Meteor-specific but general enough to allow custom `accounts-*` implementations. |
| 44 | + |
| 45 | +### Reference integration |
| 46 | + |
| 47 | +All contributions should use `accounts-lea` as reference integration. |
| 48 | + |
| 49 | +The repos are: |
| 50 | + |
| 51 | +- https://github.com/leaonline/meteor-accounts-lea |
| 52 | +- https://github.com/leaonline/meteor-accounts-oauth-lea |
| 53 | +- https://github.com/leaonline/leaonline-accounts |
| 54 | + |
| 55 | +## Development |
| 56 | + |
| 57 | +If you want to fix bugs or add new features, **please read this chapter and it's |
| 58 | +sections carefully!** |
| 59 | + |
| 60 | +### No PR without issue |
| 61 | + |
| 62 | +Please make sure your commitment will be appreciated by first opening an issue |
| 63 | +and discuss, whether this is a useful addition to the project. |
| 64 | + |
| 65 | +### Work on a bug or a new feature |
| 66 | + |
| 67 | +First, clone and install this project from source via |
| 68 | + |
| 69 | +```bash |
| 70 | +$ git clone git@github.com:leaonline/oauth2-server.git |
| 71 | +$ cd oauth2-server |
| 72 | +$ cd test-proxy |
| 73 | +$ meteor npm install |
| 74 | +$ meteor npm run setup # requred to link package to test-proxy project |
| 75 | +``` |
| 76 | + |
| 77 | +From here you can run several scripts for development purposes: |
| 78 | + |
| 79 | +```bash |
| 80 | +$ meteor cd test-proxy |
| 81 | +$ meteor npm run test # runs the tests once |
| 82 | +$ meteor npm run test:coverage # runs the tests including coverage |
| 83 | +$ meteor npm run lint # runs the linter |
| 84 | +$ meteor npm run build:docs # updates API.md |
| 85 | +``` |
| 86 | + |
| 87 | +To work on a new feature or a fix please create a new branch: |
| 88 | + |
| 89 | +```bash |
| 90 | +$ git checkout -b feature-xyz # or fix-xyz |
| 91 | +``` |
| 92 | + |
| 93 | +### Coding rules |
| 94 | + |
| 95 | +- Unit-testing: all features or bug fixes must be tested by specs |
| 96 | +- Documentation: all public API methods must be documented |
| 97 | +- StandardJs: linter mmuss pass |
| 98 | + |
| 99 | +### Commit message convention |
| 100 | + |
| 101 | +We use a commit convention, inspired by [angular commit message format](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format) |
| 102 | +with ticket number at the end of summary: |
| 103 | + |
| 104 | +``` |
| 105 | +<type>(<scope>): <short summary> #<issue number> |
| 106 | +``` |
| 107 | +Summary in present tense. Not capitalized. No period at the end. |
| 108 | +The <type> and <summary> fields are mandatory, the (<scope>) and #<number> field is optional. |
| 109 | + |
| 110 | +### Run the tests before committing |
| 111 | + |
| 112 | +Please always make sure your code is passing linter and tests **before |
| 113 | +committing**. By doing so you help to make reviews much easier and don't pollute |
| 114 | +the history with commits, that are solely targeting lint fixes. |
| 115 | + |
| 116 | +You can run the tests via |
| 117 | + |
| 118 | +```bash |
| 119 | +$ npm run test |
| 120 | +``` |
| 121 | + |
| 122 | +or |
| 123 | + |
| 124 | +```bash |
| 125 | +$ npm run test:coverage |
| 126 | +``` |
| 127 | + |
| 128 | +to see your coverage. |
| 129 | + |
| 130 | +### Open a pull request (PR) |
| 131 | + |
| 132 | +Once you have implemented your changes and tested them locally, please open |
| 133 | +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). |
| 134 | + |
| 135 | +Note: sometimes a pull request (PR) is also referred to as merge request (MR). |
| 136 | + |
| 137 | +#### Fundamental PR requirements |
| 138 | + |
| 139 | +There are a few basic requirements for your pull request to become accepted: |
| 140 | + |
| 141 | +- Make sure to open your pull request to target the `development` branch and not |
| 142 | +`master` |
| 143 | +- Make sure you are working on a branch, other than `development`; usually you |
| 144 | + can name the branch after the feature or fix you want to provide |
| 145 | +- Resolve any merge conflicts (usually by keeping your branch updated with |
| 146 | + `development`) |
| 147 | +- Have a clear description on what the PR does, including any steps necessary |
| 148 | + for testing, reviewing, reproduction etc. |
| 149 | +- Link to the existing issue |
| 150 | +- Added functions or changed functions need to get documented in compliance with |
| 151 | + JSDoc |
| 152 | +- Make sure all CI Tests are passing |
| 153 | + |
| 154 | +Also make sure, to comply with the following list: |
| 155 | + |
| 156 | +- Do not work on `development` directly |
| 157 | +- Do not implement multiple features in one pull request (this includes bumping |
| 158 | + versions of dependencies that are not related to the PR/issue) |
| 159 | +- Do not bump the release version (unless you are a maintainer) |
| 160 | +- Do not edit the Changelog as this will be done after your PR is merged |
| 161 | +- Do not introduce tight dependencies to a certain package that has not been |
| 162 | + approved during the discussion in the issue |
| 163 | + |
| 164 | +#### Review process |
| 165 | + |
| 166 | +Finally your PR needs to pass the review process: |
| 167 | + |
| 168 | +- A certain amount of maintainers needs to review and accept your PR |
| 169 | +- Please **expect change requests**! They will occur and are intended to improve |
| 170 | + the overall code quality. |
| 171 | +- If your changes have been updated please re-assign the reviewer who asked for |
| 172 | + the changes |
| 173 | +- Once all reviewers have approved your PR it will be merged by one of the |
| 174 | + maintainers :tada: |
| 175 | + |
| 176 | +#### After merge |
| 177 | + |
| 178 | +Please delete your branch after merge. |
0 commit comments