fix: bind aud claim on signed user tokens#94
Merged
Conversation
Signers set aud equal to ISSUER so the Seamless adapter, which now verifies signed auth responses with aud === audience, accepts them. The deployment contract requires the adopter's audience to equal its authServerUrl, which is byte-identical to this server's ISSUER. Without the claim, jose rejects every token the adapter checks, breaking login, registration, OAuth, OTP, magic-link, and organization-switch once the adapter audience binding ships.
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
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.
Problem
The Seamless adapter now verifies signed auth responses with
aud === audience(the unreleasedverify-audience-bindingchange inseamless-auth-server), but no signer here ever set anaudclaim. jose rejects a token that lacks a claim it was told to check, so once that adapter change ships, every handler callingverifySignedAuthResponsefails: login, finishLogin, finishRegister, OAuth, OTP, magic-link, and organization-switch. This is a release blocker on both sides.Core's tests mock jose, which is why CI did not catch it.
Fix
signAccessToken,signRefreshToken, andsignEphemeralTokennow call.setAudience(ISSUER)in addition to.setIssuer(ISSUER). The deployment contract requires the adopter'saudienceto equal itsauthServerUrl, which is byte-identical to this server'sISSUER, soaud === ISSUERis exactly what the adapter checks. The claim is additive and ignored by verifiers that do not check it (the API's ownsessionServiceverifies issuer only).The token unit test now captures and asserts the bound audience, closing the jose-mock blind spot.
Verification
audbound is accepted (subreturned); a token without it is rejected. This reproduces the blocker and confirms the fix.Coordination
Must release together with the
verify-audience-bindingchange inseamless-auth-server. See the fixed M2M service-token contract (iss=seamless-portal-api,aud=seamless-auth), which is separate from these user-token claims and unchanged here.