-
Notifications
You must be signed in to change notification settings - Fork 336
Don't check the at_hash
(access token hash) in OIDC ID Tokens if we don't use the access token
#18374
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
Conversation
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
… don't use the access token It's not necessary to check this value if we don't end up actually using the data it refers to.
To provide a further layer of abstraction should we start to use the access token in other places.
To check that Synapse validates this token in unit tests correctly.
…s when it's unnecessary to
@MadLittleMods I've added both a |
MadLittleMods
approved these changes
May 1, 2025
Co-authored-by: Eric Eastwood <[email protected]>
sandhose
added a commit
that referenced
this pull request
May 2, 2025
sandhose
added a commit
that referenced
this pull request
May 2, 2025
MatMaul
pushed a commit
to tchapgouv/synapse
that referenced
this pull request
May 12, 2025
… don't use the access token (element-hq#18374) Co-authored-by: Eric Eastwood <[email protected]>
MatMaul
pushed a commit
to tchapgouv/synapse
that referenced
this pull request
May 12, 2025
element-hq#18374 did not pass linting but was merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It doesn't appear necessary to check this value if we don't end up actually using the data it refers to.
This was motivated by our work against the TI-Messenger spec. In our setup, we're receiving the ID Token from the upstream IdP, yet it has an invalid
at_hash
field. We're currently communicating with the IdP's maintainers as to why this is.In the meantime, we've theorised that checking this field isn't actually necessary in our case. Synapse only uses the access token for fetching user metadata from a separate endpoint:
synapse/synapse/handlers/oidc.py
Lines 837 to 856 in b3099da
But we don't do this in our setup, as all the user's metadata is included in the ID Token itself. Thus, we never actually use the access token, and it seems silly to validate it.
Currently we're working around this issue in our setup by stripping the
at_hash
field from the ID Token in a network proxy before Synapse receives it, but this seems like the cleaner solution.FYI
authlib
is the one that actually validates this field, here. It only does so if theaccess_token
parameter is set in the claims dict, which is what this PR is disabling when unnecessary.Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)