-
Notifications
You must be signed in to change notification settings - Fork 413
MSC4190: Device management for application services #4190
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
+124
−0
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c7b4b0c
Device management for application services
sandhose 4761dfc
Update the MSC number
sandhose 791fbfa
Rename the unstable registration flag
sandhose 96ec9ba
Wrap lines
tulir cffcff9
Add words to cover checklist and /register breaking change
tulir ff0c786
Return an error in /register
tulir ed1ec80
Clarify why /register is changing
tulir e66f4d2
Declare MSC3202 dependency
tulir 2be9161
Point to new MSC for device ID masquerading
tulir 6692db9
Reword as OAuth is in the spec, require registration flag after this …
tulir f9bac03
Remove UIA requirement for cross-signing reset
tulir e917c45
Link to existing specs
tulir 0f58c03
Fix typo
tulir ab10604
Remove opt-in
tulir 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,99 @@ | ||
| # MSC4190: Device management for application services | ||
|
|
||
| [MSC3202] allows application services to handle and send encrypted events. | ||
| One part of [MSC3202] is the ability to masquerade devices using the `device_id` | ||
tulir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| query parameter on C-S API requests, which eliminates the need to maintain | ||
| individual access tokens for each application service user. | ||
|
|
||
| However, application services don't have an endpoint to create devices for their | ||
| users, which means that, in practice, encrypted application services still use | ||
| `/login` with the `m.login.application_service` login type to create devices for | ||
| their users. | ||
|
|
||
| Consequently, such application services leave many unused but active access | ||
| tokens for those users. | ||
|
|
||
| Furthermore, if [MSC3861] were adopted, the `/login` endpoint would no longer be | ||
| available for application services to use. | ||
tulir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This MSC proposes a dedicated API endpoint for application services to create | ||
| and delete devices for users, addressing the existing gap to enable encrypted | ||
| application services without `/login`. | ||
|
|
||
| ## Proposal | ||
|
|
||
| This MSC proposes to extend existing endpoints to allow application services to | ||
| create and delete devices for their users without relying on the `/login` and | ||
| `/logout` mechanisms. | ||
|
|
||
| As all changes here only apply to application services, guest access is not | ||
| relevant. | ||
|
|
||
| ### **`PUT /_matrix/client/v3/devices/{deviceId}`** | ||
tulir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This endpoint is updated to allow the creation of a new device for a user, if | ||
| the device ID does not exist. This behavior is only available to application | ||
| services. | ||
|
|
||
| This endpoint will use the 201 status code to indicate that a new device was | ||
| created, in addition to the existing 200 status code for existing devices. | ||
|
|
||
| The endpoint is rate limited. Servers may want to use login rate limits for | ||
| device creation, although in most cases application services will disable all | ||
| rate limits anyway. | ||
|
|
||
| ### **`DELETE /_matrix/client/v3/devices/{deviceId}`** | ||
|
|
||
| This endpoint no longer requires User-Interactive Authentication for application services. | ||
|
|
||
| ### **`POST /_matrix/client/v3/delete_devices`** | ||
|
|
||
| This endpoint no longer requires User-Interactive Authentication for application services. | ||
|
|
||
| ### **`POST /_matrix/client/v3/register`** | ||
tulir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dbkr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Currently, the default behavior for `/register` is to create a new device and | ||
| access token (i.e. login) in addition to creating the user. Similar to `/login`, | ||
| creating an access token would no longer be possible with [MSC3861]. However, | ||
tulir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| creating users via the endpoint is still required, so unlike `/login`, `/register` | ||
| will not be removed entirely. | ||
|
|
||
| Therefore, application services MUST call the endpoint with `inhibit_login=true`. | ||
| Calls without the parameter, or with a different value than `true`, will return | ||
| HTTP 400 with a new `M_APPSERVICE_LOGIN_UNSUPPORTED` error code. | ||
tulir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Potential issues | ||
|
|
||
| The change to `/v3/register` is technically backwards-incompatible, but it will | ||
| break when switching to next-gen auth in any case, so a new endpoint version | ||
| would not be useful. | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The endpoint could just stop returning access tokens to avoid breaking existing | ||
| appservices that don't read that field, but an explicit error was chosen to | ||
| avoid silent breakage of appservices that do depend on the field. | ||
|
|
||
| ## Security considerations | ||
|
|
||
| This MSC lets application services delete devices without the usual | ||
| re-authentication requirement. It is considered an acceptable risk, as | ||
| application services have to be registered by the server admin. | ||
|
|
||
| ## Alternatives | ||
|
|
||
| A new set of endpoints dedicated to application services could be added to the | ||
| specification, like `GET|PUT|DELETE /_matrix/client/v3/appservices/{appId}/devices/{deviceId}`. | ||
|
|
||
| This would have the advantage of not changing the behavior of existing endpoints. | ||
|
|
||
| ## Dependencies | ||
|
|
||
| In order to use the devices created using this MSC, appservices need to be able | ||
| to use device IDs as a part of identity assertion, as defined by [MSC4326]. | ||
|
|
||
| ## Unstable prefix | ||
|
|
||
| Until this MSC is stable, application services must opt-in to the new behavior | ||
| by setting the `io.element.msc4190` flag to `true` in their registration file. | ||
tulir marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [MSC4326]: https://github.com/matrix-org/matrix-spec-proposals/pull/4326 | ||
| [MSC3861]: https://github.com/matrix-org/matrix-spec-proposals/pull/3861 | ||
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.