-
Notifications
You must be signed in to change notification settings - Fork 411
MSC2778: Providing authentication method for appservice users #2778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
61a8866
initial proposal
Half-Shot 3a64983
2778
Half-Shot 4751785
Some spelling fixes
Half-Shot 7d9304f
Clarify _bridge_alice
Half-Shot 5c00004
Add notice about identifer
Half-Shot 7a3b7b3
Add implementations section
Half-Shot c9b7e9f
Reword need for token
Half-Shot 2c817cb
Add another advantage
Half-Shot cb7bbf3
I don't think this is a concern
Half-Shot 03491c5
Add security considerations
Half-Shot bf9cc0a
M_EXCLUSIVE
Half-Shot e781b75
Mention that /register provides a token but it's not helpful
Half-Shot 4ca319d
Update proposals/2778-appservice-login.md
0c26298
Update proposals/2778-appservice-login.md
Half-Shot 538ac09
Update Alternatives section
Half-Shot b8ab3d0
Remove point about Element showing unexpected devices
Half-Shot c8e0ed6
Hopefully improve words around M_EXCLUSIVE
Half-Shot 93dd264
words
Half-Shot 16290a0
it's
Half-Shot f9a5b34
Clarify /register / /login
Half-Shot fb091fe
Apply suggestions from code review
turt2live ea19271
Merge branch 'master' into hs/proposal-appservice-login
turt2live ec2c1f6
Remove what appears to be leftover notes
turt2live File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# MSC2778: Providing authentication method for appservice users | ||
|
||
Appservices within Matrix are increasingly attempting to support End-to-End Encryption. As such, they | ||
need a way to generate devices for their users so that they can participate in E2E rooms. In order to | ||
do so, this proposal suggests implementing an appservice extension to the | ||
[`POST /login` endpoint](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-login). | ||
|
||
Appservice users do not usually need to login as they do not need their own access token, and do not | ||
traditionally need a "device". However E2E encryption demands that all users in a room have a device | ||
bwindels marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
which means bridge users need to be able to generate a device on demand. | ||
Half-Shot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Proposal | ||
|
||
A new `type` is to be added to `POST /login`. | ||
|
||
`m.login.application_service` | ||
|
||
The `/login` endpoint may now take an `access_token` in the same way that other | ||
authenticated endpoints do. No additional parameters should be specified in the request body. | ||
|
||
Example request | ||
|
||
```json | ||
{ | ||
"type": "m.login.application_service", | ||
"identifier": { | ||
"type": "m.id.user", | ||
"user": "alice" | ||
Half-Shot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} | ||
} | ||
``` | ||
|
||
The response body should be unchanged from the existing `/login` specification. | ||
|
||
If: | ||
|
||
- The access token is not provided | ||
- The access token does not correspond to a appservice | ||
turt2live marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- The access token does not correspond to a appservice that manages this user | ||
Half-Shot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
- Or the user has not previously been registered | ||
|
||
Then the servers should reject with HTTP 403, with an `errcode` of `"M_FORBIDDEN"`. | ||
|
||
Homeservers should ignore the `access_token` parameter if a type other than | ||
`m.login.application_service` has been provided. | ||
|
||
The expected flow for appservices would be to `/register` their users, and | ||
then `/login` to generate the appropriate device. | ||
|
||
## Potential issues | ||
|
||
This proposal means that there will be more calls to make when setting up a appservice user, when | ||
using encryption. While this could be done during the registration step, this would prohibit creating | ||
new devices should the appservice intentionally or inadvertently lost the client-side device data. | ||
Half-Shot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Alternatives | ||
|
||
One minor tweak to the current proposal could be to include the token as part of the auth data, rather than | ||
being part of the header/params to the request. An argument could be made for either, but since the specification | ||
expects the appservice to pass the token this way in all requests, including `/register`, it seems wise to keep | ||
it that way. | ||
|
||
Some community members have used implementation details such as a "shared secret" authentication method to | ||
log into the accounts without having to use the /login process at all. Synapse provides such a function, | ||
but also means the appservice can now authenticate as any user on the homeserver. This seems undesirable from a | ||
security standpoint. | ||
|
||
A third option could be to create a new endpoint that simply creates a new device for an appservice user on demand. | ||
Given the rest of the matrix eco-system does this with /login, and /login is already extensible with `type`, it would | ||
create more work for all parties involved for little benefit. | ||
|
||
## Security considerations | ||
|
||
The /login endpoint will generate an access token which can be used to control the appservice user, which | ||
is superflous as the appservice `as_token` should be used to authenticate all requests on behalf of ghosts. | ||
This can safely be ignored or used, but is an extra token hanging around. | ||
Half-Shot marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## Unstable prefix | ||
|
||
Implementations should use `uk.half-shot.msc2778.login.application_service` for `type` given in the | ||
`POST /login` until this lands in a released version of the specification. | ||
uhoreg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.