Skip to content

Commit afdac0d

Browse files
ricky26djmitche
andauthored
RFC: Add scopes for anonymous calls (#165)
* Add Anonymous scopes RFC text * Clarify the use of `authenticateAnonymous` Co-authored-by: Dustin J. Mitchell <[email protected]> * Integrate PR conversation into RFC text * Update TOC * Fix a typo and some punctuation Co-authored-by: Dustin J. Mitchell <[email protected]>
1 parent 47567d3 commit afdac0d

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ See [mechanics](mechanics.md) for more detail.
5858
| RFC#154 | [Migrate Taskcluster to postgres](rfcs/0154-Migrate-taskcluster-to-postgres.md) |
5959
| RFC#155 | [Create an object service](rfcs/Create-object-service.md) |
6060
| RFC#163 | [ProjectId](rfcs/0163-project-id.md) |
61+
| RFC#165 | [Anonymous scopes](rfcs/0165-Anonymous-scopes.md) |
6162
| RFC#166 | [Sign Public S3 URLs](rfcs/0166-Sign-public-S3-urls.md) |

rfcs/0165-Anonymous-scopes.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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

rfcs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@
4646
| RFC#154 | [Migrate Taskcluster to postgres](0154-Migrate-taskcluster-to-postgres.md) |
4747
| RFC#155 | [Create an object service](Create-object-service.md) |
4848
| RFC#163 | [ProjectId](0163-project-id.md) |
49+
| RFC#165 | [Anonymous scopes](0165-Anonymous-scopes.md) |
4950
| RFC#166 | [Sign Public S3 URLs](0166-Sign-public-S3-urls.md) |

0 commit comments

Comments
 (0)