-
Notifications
You must be signed in to change notification settings - Fork 399
MSC2832: HS -> AS authorization header #2832
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 1 commit
Commits
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,37 @@ | ||
# HS -> AS authorization header | ||
Most of the auth tokens in the spec are passed in the `Authorization` header, | ||
with the `access_token` query parameter supported for backwards-compatibility. | ||
For some reason, the application service spec was not updated in the same way | ||
and it still requires using the archaic query parameter when the homeserver | ||
pushes transactions to the appservice. | ||
|
||
## Proposal | ||
The `access_token` query parameter is deprecated and homeservers are encouraged | ||
to use the `Authorization` header with `Bearer <token>` as the value when | ||
sending transactions or other requests to application services. | ||
|
||
Application services MUST support checking the access token from the header. | ||
Appservices SHOULD still support the old query param auth, but it is not | ||
required, as there are no cases where a homeserver is unable to set HTTP | ||
request headers. | ||
|
||
### Transition to auth header | ||
Similarly to how [legacy routes](https://matrix.org/docs/spec/application_service/r0.1.2#legacy-routes) | ||
work in the appservice spec, homeservers should prefer using the authorization | ||
header, but fall back to the query parameter if the appservice returns a status | ||
code indicating invalid auth (401 or 403). | ||
turt2live marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Security considerations | ||
Not fixing this causes access tokens to be logged in many bridges. | ||
|
||
## Alternatives | ||
The transition could be done differently, e.g. with an appservice registration | ||
field or homeserver config. Some sort of version identifier in appservice | ||
turt2live marked this conversation as resolved.
Show resolved
Hide resolved
|
||
registrations would be the optimal solution (define that after vX, auth always | ||
uses the header), but such an identifier does not currently exist. | ||
|
||
## Unstable prefix | ||
The authorization header is already used in the client-server spec, and an | ||
unstable prefix would just unnecessarily complicate things. If the transition | ||
is decided to be done with an appservice registration field, then that field | ||
could have an unstable prefix. | ||
turt2live marked this conversation as resolved.
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.