|
| 1 | +# RFC 165 - Anonymous scopes |
| 2 | +* Comments: [#165](https://github.com/taskcluster/taskcluster-rfcs/pull/165) |
| 3 | +* Proposed by: @ricky26 |
| 4 | + |
| 5 | +# Summary |
| 6 | + |
| 7 | +We currently assign no scopes to calls with no credentials. With this proposal |
| 8 | +we would assign a single role to all calls and any scopes expanded from that. |
| 9 | +Additionally, we will move all API calls behind at least one scope. |
| 10 | + |
| 11 | +## Motivation |
| 12 | + |
| 13 | +This is primarily aimed at private Taskcluster installations. With this, it will |
| 14 | +be possible to prevent any useful access to the Taskcluster installation without |
| 15 | +credentials. |
| 16 | + |
| 17 | +This RFC doesn't propose changes to the UI as it's considered part of a minimal |
| 18 | +path towards private Taskcluster installations and inoperative UI when not |
| 19 | +logged in is acceptable. |
| 20 | + |
| 21 | +# Details |
| 22 | +## Implementation |
| 23 | +A single scope will be assumed for all calls (with or without credentials): |
| 24 | +`assume:anonymous`. In order to implement this, changes will be made in a few |
| 25 | +areas: |
| 26 | +- A new API call will be added to the auth service (`authenticateAnonymous`) |
| 27 | + which will return the expanded scopes of `["assume:anonymous"]`. |
| 28 | +- All API calls which currently require no scopes will be given explicit |
| 29 | + required scopes, ideally matching their counterparts already with required |
| 30 | + scopes. These exact scopes will be decided at implementation time. |
| 31 | +- The authentication middleware in `taskcluster-lib-api`, used by all services, |
| 32 | + will no longer early out if there are no authorization headers. |
| 33 | +- The remote signature validator (used by all services except the auth service) |
| 34 | + will call `authenticateAnonymous` if no authorization headers are passed. |
| 35 | +- The auth service signature validator will be changed to return the scopes |
| 36 | + expanded from `["assume:anonymous"]` if no credentials are passed. |
| 37 | +- The auth service signature validator will include the expanded anonymous |
| 38 | + scopes when using credentials **after** applying scope restriction. |
| 39 | +- The API builder in `taskcluster-lib-api` will be changed to assert that |
| 40 | + at least one scope is required except for endpoints which explicity opt-out |
| 41 | + (which should be just `authenticateHawk` and `authenticateAnonymous`). |
| 42 | +- `expandScopes` will **not** be changed to include the anonymous role as this |
| 43 | + is then within the power of the caller. |
| 44 | +- Add `assume:anonymous` to the scopes returned by `User::scopes` in |
| 45 | + `web-server`. (This is adding an assumption about the anonymous role but |
| 46 | + a similar assumption is made about `assume:login-identity:` already). |
| 47 | + |
| 48 | +## Drawbacks |
| 49 | +- Scopes will be expanded every call, this will cause additional overhead for |
| 50 | + anonymous calls. |
| 51 | +- There will need to be some kind of migration to ensure that public |
| 52 | + clusters automatically inherit the new scopes for all calls. |
| 53 | + - This could be done as a database migration, inserting all added required |
| 54 | + scopes to the anonymous role as all Taskcluster installations older than |
| 55 | + this change will be assumed to be public. |
| 56 | + |
| 57 | +## Alternatives |
| 58 | +- Instead of the `authenticateAnonymous` endpoint, allow the `authenticateHawk` |
| 59 | + endpoint to accept requests with no hawk/bewit credentials and return just |
| 60 | + the anonymous scopes. |
| 61 | +- Instead of adding `authenticateAnonymous`, allow the `authenticateHawk` |
| 62 | + endpoint to return the anonymous scopes when the authorization parameters |
| 63 | + are missing. |
| 64 | +- Instead of including `assume:anonymous` in `authenticateHawk` and calling |
| 65 | + `authenticateAnonymous` at the signature validation stage, alter the |
| 66 | + `taskcluster-lib-api` auth middleware to include the anonymous scopes before |
| 67 | + testing the scope expression. |
| 68 | +- When adding anonymous scopes to calls with credentials, add them **before** |
| 69 | + restriction, so that anonymous scopes can be restricted. This will require |
| 70 | + additional migration effort but may reduce the surprise compared to the |
| 71 | + preferred implementation. |
| 72 | + |
| 73 | +## Future considerations |
| 74 | +This RFC will introduce more load on the auth service. With the preferred |
| 75 | +implementation it should be quite easy to add caching in a later RFC. |
| 76 | + |
| 77 | +# Implementation |
0 commit comments