fix: preserve OAuth subpaths in endpoint construction per RFC 8414 #258844
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.
Dev from https://smithery.ai here 👋! We noticed a bug when testing our server's OAuth flow where subpaths were being dropped when creating OAuth endpoints. This PR fixes
getDefaultMetadataForUrlto preserve them per rfc 8414 section 3: https://datatracker.ietf.org/doc/html/rfc8414#section-3Authorization servers supporting metadata MUST make a JSON document containing metadata as specified in Section 2 available at a path formed by inserting a well-known URI string into the authorization server's issuer identifier between the host component and the path component, if any. By default, the well-known URI string used is "/.well-known/oauth-authorization-server". This path MUST use the "https" scheme. The syntax and semantics of ".well-known" are defined in RFC 5785 [RFC5785]. The well-known URI suffix used MUST be registered in the IANA "Well-Known URIs" registry [IANA.well-known].
Issue
See #258845
OAuth servers hosted at subpaths (e.g.,
https://api.example.com/oauth/server) were having their paths dropped:Changes
getDefaultMetadataForUrlFixes the same issue as modelcontextprotocol/typescript-sdk#687.
See tests in
src/vs/base/test/common/oauth.test.ts