You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
1.32.2 does not reject authorization-server metadata whose issuer does not echo the discovery URL (RFC 8414 section 3.3) #3152
The client sets issuer = String(authorizationServerUrl), and a source comment states metadata.issuer is deliberately not used and that this version does not verify the metadata document echoes the URL it was fetched from. So I'm not reporting this as an undisclosed issue. I'm raising it because the user-visible consequence and a reproduction are worth having on record, and because two other MCP clients behave differently.
RFC 8414 section 3.3 says the issuer returned must be identical to the issuer identifier the well-known URI was constructed from, otherwise the metadata MUST NOT be used.
Against a decoy authorization server advertising a foreign issuer, 1.32.2 proceeds and POSTs to /token with an Authorization header.
The Python MCP SDK 1.30.0 refuses at validate_metadata_issuer, citing RFC 8414 section 3.3 and SEP-2468, with zero token-endpoint hits. In consistent mode, where the advertised issuer matches, it completes the flow to /token as a control, so the empty capture in mismatched mode is a refusal rather than a harness that never arrives.
Scope, stated narrowly: when the client was handed one URL and that origin controls both the metadata and the token endpoint, the issuer field is another field that origin controls anyway. The gap matters where discovery is not fully under the control of the party named in the document, such as an open redirect on the well-known path, a stale or cached document, or a resource server influencing discovery that is not the authorization server.
This is separate from the credential-binding class in GHSA-6qxp-vccf-f47h and the fastmcp advisory. Different layer, different fix.
Question: is this still acceptable for the remaining v1 lifetime, or would you take the check with an opt-out? Either answer closes it for me, I'd just like the decision recorded.
Reproduction: two runs against a local decoy, matching and mismatched issuer, on 1.32.2 under Node, harness available on request.
Correction to my own framing, after reading the discovery path more carefully.
The check cannot be written as metadata.issuer === authorization Server Url. In this client discovery is not a single URL: discover Metadata With Fallback tries the path-aware /.well-known/oauth-authorization-server/ first, then falls back to the root well-known on any non-2xx below 500, and metadata Url and metadata Server Url can override the fetch target or the host outright. RFC 8414 section 3.3 compares the issuer to the identifier the well-known URI was constructed from, so for https://host/tenant1 the expected issuer is https://host/tenant1 even when the document arrived from the root well-known. Comparing to authorization Server Url would be wrong in exactly that path-aware case.
So the expected value has to be threaded out of discover Metadata With Fallback, where the URL derived inside the helper is not captured back into state. That places the fix in the discovery helper rather than in the comparison, which is why I would take it as a v2 line item rather than a v1 backport.
One more consumer worth naming. create Private Key JwtAuth defaults the assertion audience to metadata.issuer (options.audience ?? metadata?.issuer ?? url), so under private_key_jwt the unvalidated issuer also becomes the aud of the client assertion. A fix that only guards the binding key leaves that one.
The comparison primitive already exists: issuers Match tolerates a single trailing slash and is already applied to stored credentials by discard If Issuer Mismatch. The new check is that same comparison against a freshly fetched document, and the only deployments it rejects are ones section 3.3 already forbids.
Confirmed, and this is a missing backport rather than an open design question: main already carries the check with the opt-out you suggested.
discoverAuthorizationServerMetadata() on main throws IssuerMismatchError when metadata.issuer differs from the discovery input, and documents skipIssuerValidation: true as security-weakening. v1.x at 3b73021 has neither, which is why the decoy in your report proceeds to the token endpoint.
Port is ready on my fork, branch fix/v1x-metadata-issuer-echo (9b6caf51), one commit on 3b73021:
Same comparison as main, including its one-directional trailing-slash tolerance for the SDK-synthesized fallback URL. A different host or path is always a mismatch, and a slash on the received side is still a mismatch.
IssuerMismatchError is thrown at discovery, so auth() never registers, redirects, or posts credentials to endpoints named by a document that failed the echo.
5 new tests: decoy issuer rejected, sibling tenant on the same host rejected, exact match accepted, slash tolerance in both directions, opt-out honoured.
The existing createMigratingFetch({ claimedIssuer: { [AS_TWO]: AS_ONE } }) test asserted the old behaviour (proceed, then bind to the discovery URL); it now asserts the mismatch is refused with zero token-endpoint calls and no registration.
Fixtures in the auth, redirects and sse tests served hardcoded https://auth.example.com metadata from 127.0.0.1 test servers; they now name the server they came from, which is what a conforming authorization server does.
npm test: 1863 passed / 1863 (56 files). npm run typecheck and npm run lint clean. Changeset included.
I could not open the PR myself: CreatePullRequest is denied for my account on this repo (REST returns 404, GraphQL returns FORBIDDEN), the same interaction limit reported in #3125. The branch is ready for a maintainer to pull, and I will open the PR if the limit is lifted.
Activity
media-ctrl commentedon Nov 5, 2026
LHMisme420 commentedon Nov 5, 2026
Correction to my own framing, after reading the discovery path more carefully.
The check cannot be written as metadata.issuer === authorization Server Url. In this client discovery is not a single URL: discover Metadata With Fallback tries the path-aware /.well-known/oauth-authorization-server/ first, then falls back to the root well-known on any non-2xx below 500, and metadata Url and metadata Server Url can override the fetch target or the host outright. RFC 8414 section 3.3 compares the issuer to the identifier the well-known URI was constructed from, so for https://host/tenant1 the expected issuer is https://host/tenant1 even when the document arrived from the root well-known. Comparing to authorization Server Url would be wrong in exactly that path-aware case.
So the expected value has to be threaded out of discover Metadata With Fallback, where the URL derived inside the helper is not captured back into state. That places the fix in the discovery helper rather than in the comparison, which is why I would take it as a v2 line item rather than a v1 backport.
One more consumer worth naming. create Private Key JwtAuth defaults the assertion audience to metadata.issuer (options.audience ?? metadata?.issuer ?? url), so under private_key_jwt the unvalidated issuer also becomes the aud of the client assertion. A fix that only guards the binding key leaves that one.
The comparison primitive already exists: issuers Match tolerates a single trailing slash and is already applied to stored credentials by discard If Issuer Mismatch. The new check is that same comparison against a freshly fetched document, and the only deployments it rejects are ones section 3.3 already forbids.
Sanath91009 commentedon Nov 13, 2026
Confirmed, and this is a missing backport rather than an open design question:
mainalready carries the check with the opt-out you suggested.discoverAuthorizationServerMetadata()onmainthrowsIssuerMismatchErrorwhenmetadata.issuerdiffers from the discovery input, and documentsskipIssuerValidation: trueas security-weakening.v1.xat3b73021has neither, which is why the decoy in your report proceeds to the token endpoint.Port is ready on my fork, branch
fix/v1x-metadata-issuer-echo(9b6caf51), one commit on3b73021:https://github.com/Sanath91009/typescript-sdk/tree/fix/v1x-metadata-issuer-echo
main, including its one-directional trailing-slash tolerance for the SDK-synthesized fallback URL. A different host or path is always a mismatch, and a slash on the received side is still a mismatch.IssuerMismatchErroris thrown at discovery, soauth()never registers, redirects, or posts credentials to endpoints named by a document that failed the echo.createMigratingFetch({ claimedIssuer: { [AS_TWO]: AS_ONE } })test asserted the old behaviour (proceed, then bind to the discovery URL); it now asserts the mismatch is refused with zero token-endpoint calls and no registration.https://auth.example.commetadata from 127.0.0.1 test servers; they now name the server they came from, which is what a conforming authorization server does.npm test: 1863 passed / 1863 (56 files).npm run typecheckandnpm run lintclean. Changeset included.I could not open the PR myself:
CreatePullRequestis denied for my account on this repo (REST returns 404, GraphQL returns FORBIDDEN), the same interaction limit reported in #3125. The branch is ready for a maintainer to pull, and I will open the PR if the limit is lifted.