fix(auth): preserve issuer trailing slash during discovery - #1145
Merged
DaleSeo merged 1 commit intoAug 7, 2026
Merged
Conversation
DaleSeo
approved these changes
Aug 7, 2026
DaleSeo
approved these changes
Aug 7, 2026
DaleSeo
left a comment
Member
There was a problem hiding this comment.
Thanks for the fix, @satouriko!
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.
Motivation and Context
Authorization server metadata discovery currently reconstructs the expected issuer from the generated discovery URL. For a path-based issuer ending in a trailing slash, RFC 8414 path insertion removes that slash, so the reverse transformation is lossy and valid metadata is rejected with an issuer mismatch.
This change preserves the exact authorization server identifier advertised by Protected Resource Metadata and uses it for validation. Discovery URL generation and strict issuer comparison remain unchanged.
Fixes #1144
How Has This Been Tested?
origin/mainwithAuthorizationServerMismatchcargo test -p rmcp --lib --features auth protected_resource_metadata_preserves_non_root_issuer_trailing_slash -- --nocapturecargo test -p rmcp --lib --features auth authorization_metadata -- --nocapturecargo +nightly fmt --all -- --checkcargo clippy -p rmcp --all-targets --all-features -- -D warningscargo test -p rmcp --all-featuresBreaking Changes
None.
Types of changes
Checklist
Additional context
The fix intentionally does not normalize non-root trailing slashes.
https://auth.example.com/tenantandhttps://auth.example.com/tenant/remain distinct issuer identifiers; validation now compares metadata against the original identifier rather than a reconstructed one.