Repository navigation
auth/extauth: validate the RFC 9207 iss in PerformOIDCLogin - #1442
Merged
guglielmo-san merged 2 commits intoOct 26, 2026
Merged
guglielmo-san merged 2 commits into
guglielmo-san merged 2 commits into
Conversation
AuthorizationCodeHandler validates the iss parameter of the authorization response (RFC 9207), the mitigation for mix-up attacks, but PerformOIDCLogin only compared the state. The iss reported by the AuthorizationCodeFetcher was ignored, so a response naming another issuer, or lacking iss from an IdP that advertises authorization_response_iss_parameter_supported, was accepted and its code exchanged at the IdP's token endpoint. Check it after the state: iss is required when the IdP's metadata advertises support, and a present iss must equal the issuer from that metadata. A matching iss is accepted even when support is not advertised, as RFC 9207, section 2.4, asks clients to compare it. The fake IdP gets an IssParameterSupported option that advertises support and adds iss to its redirects. TestPerformOIDCLogin_Issuer covers both cases with a missing, matching and foreign iss; the three rejected cases fail without the change.
guglielmo-san
approved these changes
Oct 26, 2026
guglielmo-san
merged commit Oct 26, 2026
fa799c5
into
modelcontextprotocol:main
15 of 17 checks passed
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.
AuthorizationCodeHandlervalidates theissparameter of the authorization response (RFC 9207), the mitigation for mix-up attacks added in #859.extauth.PerformOIDCLogin, which obtains the ID token for Enterprise Managed Authorization, only compared thestate: theIssreported by theAuthorizationCodeFetcherwas ignored. So a response naming another issuer, or one withoutissfrom an IdP that advertisesauthorization_response_iss_parameter_supported, was accepted and its code exchanged at the IdP's token endpoint.This checks
issright after thestate, against the issuer and the flag from the IdP metadata thatinitiateOIDCLoginalready fetches:issis required.issmust equal the metadata issuer, whether or not support is advertised (RFC 9207 §2.4 asks clients to compare it).issfrom an IdP that does not advertise support is accepted, as before.Unlike
AuthorizationCodeHandler, a matching but unadvertisedissis accepted (whatAcceptUnadvertisedIssopts into there):PerformOIDCLoginnever rejected it, so refusing it now would break IdPs that sendisswithout advertising it, and RFC 9207 §2.4 asks for validation rather than rejection (see #1152).Tests:
internal/oauthtest: the fake IdP gets anIssParameterSupportedoption that advertises support and addsissto its redirects.TestPerformOIDCLogin_Issuer: advertised and not advertised, each with a missing, matching and foreigniss. The three rejected cases fail without the change; the existingTestPerformOIDCLogincases are unchanged.AI assistance: prepared with Claude Code.