Validate OAuth authorization response issuers per SEP-2468#430
Closed
nbifrye wants to merge 1 commit into
Closed
Conversation
Implement RFC 9207 iss validation for OAuth authorization callbacks. The provider callback remains backward-compatible with [code, state] and may return a URL-form-decoded iss value as a third element. Per SEP-2468's RFC 9207 local-policy decision, an advertised authorization_response_iss_parameter_supported flag makes iss mandatory, while any returned iss is compared to the validated authorization server metadata issuer before token exchange.
Member
|
As part of the work on the new MCP specification, I've been designing the implementation with both backward compatibility and consistency across SDKs in mind. For this change, I'm going to go with #431 instead, as it preserves compatibility with existing callback implementations in applications. Thanks for the contribution. |
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.
Closes #386
Implement RFC 9207 iss validation for OAuth authorization callbacks. The provider callback remains backward-compatible with [code, state] and may return a URL-form-decoded iss value as a third element.
Per SEP-2468's RFC 9207 local-policy decision, an advertised authorization_response_iss_parameter_supported flag makes iss mandatory, while any returned iss is compared to the validated authorization server metadata issuer before token exchange.
Motivation and Context
SEP-2468 adds MCP guidance for RFC 9207 issuer binding in OAuth authorization responses to mitigate mix-up attacks. This SDK already validates the authorization server metadata issuer per RFC 8414 before redirecting; this change also binds the authorization callback response to that validated issuer before exchanging an authorization code.
The provider callback remains backward-compatible with
[code, state]and may return[code, state, iss]. Because the SDK callback contract delegates redirect parsing to the caller, the returnedissis expected to be the URL-form-decoded RFC 9207 query value.Implementation decisions:
issis always compared to the validated authorization server metadataissuerusing simple string comparison, with no URI normalization.issis rejected only when authorization server metadata advertisesauthorization_response_iss_parameter_supported: true.isspreserves existing behavior; a presentissis still compared per SEP-2468's RFC 9207 local-policy decision.This also adds a self-contained WebMock example that exercises the advertised, unadvertised, missing, and mismatched
isscases without contacting real servers.Refs #386
How Has This Been Tested?
rake testrake rubocopBreaking Changes
None for authorization servers that do not advertise RFC 9207 authorization response issuer support and do not return
iss.For servers that advertise
authorization_response_iss_parameter_supported: true, host applications must pass the callback's decodedissquery value through the provider callback. Missing or mismatched issuers are rejected before token exchange.Types of changes
Checklist