Skip to content

Commit e78bc09

Browse files
committed
MSC4312: Resetting cross-signing keys in the OAuth world
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
1 parent 6e3e162 commit e78bc09

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# MSC4312: Resetting cross-signing keys in the OAuth world
2+
3+
Matrix v1.15 added new [OAuth APIs] for authentication. As of writing, these APIs are not compatible
4+
with the existing [User-Interactive Authentication (UIA)] mechanism that is used on a number of
5+
endpoints. This is not problematic in most cases because these endpoints cover actions that can now
6+
be preformed in the authorization server's web UI. One notable exception, however, is
7+
[`/_matrix/client/v3/keys/device_signing/upload`] which clients use to publish their cross-signing
8+
keys. This endpoint requires UIA when previously uploaded keys are being replaced, for instance
9+
because the user lost their recovery key. OAuth knows nothing about cross-signing keys and,
10+
consequently, the spec labels this endpoint as unusable:
11+
12+
> **WARNING:** When this endpoint requires User-Interactive Authentication, it cannot be used when
13+
> the access token was obtained via the OAuth 2.0 API.
14+
15+
This is obviously not practical and unofficial workarounds have been invented to enable resetting
16+
one's cross-signing keys in the client / homeserver / authorization server triangle. This proposal
17+
documents these workarounds.
18+
19+
## Proposal
20+
21+
Clients that have authenticated via the new [OAuth APIs] continue to use
22+
[`/_matrix/client/v3/keys/device_signing/upload`] to replace cross-signing keys. Homeservers
23+
continue to enforce UIA on the endpoint but MUST only use a single stage `m.cross_signing_reset`
24+
together with a URL that points to the authorization server's account management UI.
25+
26+
``` json5
27+
{
28+
"session": "$ARBITRARY",
29+
"flows": [{
30+
"stages": ["m.cross_signing_reset"]
31+
}],
32+
"params": {
33+
"m.cross_signing_reset": {
34+
"url": "$AUTHORIZATION_SERVER_ACCOUNT_MANAGEMENT_URL"
35+
}
36+
}
37+
}
38+
```
39+
40+
The client then instructs the user to approve the reset of their cross-signing keys using the
41+
provided URL. How exactly that approval is achieved is an implementation detail between the
42+
authorization server and the homeserver[^1]. The required end result is that after approving, the
43+
client can complete the stage without further parameters.
44+
45+
``` json5
46+
{
47+
"auth": {
48+
"session": "$FROM_ABOVE"
49+
},
50+
"master_key": ...
51+
...
52+
}
53+
```
54+
55+
## Potential issues
56+
57+
Semantically, resetting cross-signing keys doesn't fall into the authorization server's domain. The
58+
scheme outlined above increases coupling between the authorization server and the homeserver and
59+
makes it more difficult to use off-the-shelve OAuth authorization servers.
60+
61+
## Alternatives
62+
63+
Rather than approving cross-signing reset specifically, the authorization server could provide
64+
mechanisms for temporary scope elevation.
65+
66+
## Security considerations
67+
68+
Lifting UIA temporarily creates a time window in which an attacker with an access token could take
69+
over the account.
70+
71+
## Unstable prefix
72+
73+
While this MSC is not considered stable, `m.cross_signing_reset` should be referred to as
74+
`org.matrix.cross_signing_reset`.
75+
76+
## Dependencies
77+
78+
None.
79+
80+
[^1]: [matrix-authentication-service], for instance, uses a [Synapse admin API] to temporarily lift
81+
UIA on the endpoint.
82+
83+
[OAuth APIs]: https://spec.matrix.org/v1.15/client-server-api/#oauth-20-api
84+
[User-Interactive Authentication (UIA)]: https://spec.matrix.org/v1.15/client-server-api/#user-interactive-authentication-api
85+
[`/_matrix/client/v3/keys/device_signing/upload`]: https://spec.matrix.org/v1.15/client-server-api/#post_matrixclientv3keysdevice_signingupload
86+
[matrix-authentication-service]: https://github.com/element-hq/matrix-authentication-service
87+
[Synapse admin API]: https://element-hq.github.io/synapse/latest/admin_api/user_admin_api.html#allow-replacing-master-cross-signing-key-without-user-interactive-auth

0 commit comments

Comments
 (0)