`OpenIdProviderDiscoveryMetadataSchema` strips `revocation_endpoint`, so clients can't revoke against OIDC-only authorization servers
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- api, authentication
Rechercherichtung
Beginne in src/shared/auth.ts bei OpenIdProviderDiscoveryMetadataSchema und vergleiche es mit OpenIdProviderMetadataSchema und OAuthMetadataSchema. Reproduziere den gemeldeten Parse mit revocation_endpoint, um zu bestätigen, welche Felder verworfen werden. Als erledigt gilt die Aufgabe, wenn das OpenID-Discovery-Schema den angegebenen Revocation-Endpunkt beibehält und die Regression durch einen Test abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
When authorization server metadata comes from OpenID Connect discovery, parsing it with OpenIdProviderDiscoveryMetadataSchema silently drops revocation_endpoint, along with any other RFC 8414 field that isn't declared. A client that later looks for revocation_endpoint concludes the server doesn't support revocation, even though the discovery document lists it.
Where
src/shared/auth.ts in @modelcontextprotocol/sdk 1.32.2 (with zod 4.6.7):
export const OpenIdProviderDiscoveryMetadataSchema = z.object({
...OpenIdProviderMetadataSchema.shape,
...OAuthMetadataSchema.pick({
code_challenge_methods_supported: true
}).shape
});
OpenIdProviderMetadataSchemais az.looseObject, but spreading.shapeinto a plainz.objectdrops the loose behaviour. In zod v4, unknown keys are stripped.OpenIdProviderMetadataSchemadoesn't declarerevocation_endpoint.- The only OAuth metadata field picked in is
code_challenge_methods_supported. - So the parsed result never contains
revocation_endpoint.
Impact
Some authorization servers publish metadata only through OpenID discovery and return an error for the RFC 8414 paths. Amazon Cognito is one. Against those servers, clients built on the SDK never revoke on logout.
We see this in Claude Code 2.1.328: claude mcp logout <server> deletes the local credentials but logs Server does not support token revocation, and no revoke request reaches the server. The discovery document does list revocation_endpoint.
By contrast, anthropics/claude-code#105134 reports that logout does send revoke requests for servers that serve RFC 8414 metadata. That fits this being specific to the OpenID discovery path.
Repro
import { OpenIdProviderDiscoveryMetadataSchema, OAuthMetadataSchema } from "@modelcontextprotocol/sdk/shared/auth.js";
const doc = {
issuer: "https://issuer.example.com",
authorization_endpoint: "https://issuer.example.com/oauth2/authorize",
token_endpoint: "https://issuer.example.com/oauth2/token",
jwks_uri: "https://issuer.example.com/.well-known/jwks.json",
response_types_supported: ["code"],
subject_types_supported: ["public"],
id_token_signing_alg_values_supported: ["RS256"],
code_challenge_methods_supported: ["S256"],
revocation_endpoint: "https://issuer.example.com/oauth2/revoke",
};
console.log(OpenIdProviderDiscoveryMetadataSchema.parse(doc).revocation_endpoint); // undefined
console.log(OAuthMetadataSchema.parse(doc).revocation_endpoint); // "https://issuer.example.com/oauth2/revoke"
(Run against 1.32.2: the first line prints undefined, the second prints the URL.)
Suggested fix
Either:
- keep unknown keys, by building the schema with
z.looseObject({...})or.loose(); or - spread the optional RFC 8414 fields that OpenID discovery documents commonly carry, such as
revocation_endpoint,introspection_endpointandrevocation_endpoint_auth_methods_supported.
Related: #2733 and #2734 (the same schema, about over-strict validation rather than dropped fields), and the closed #739 (a client revocation helper).
- Vorherrschende Sprache
- TypeScript
- Sterne
- 13.8k
- Forks
- 2.5k
- Ø Merge
- 6 T. 23 Std.
- Gemergte PRs (30 T.)
- 2
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/typescript-sdk
-
v2
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
modelcontextprotocol/typescript-sdk#3270 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`Evtl. vergeben @mgoldsborough hat das vor 6 Tagen übernommen. Offenv2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
modelcontextprotocol/typescript-sdk#3249 ·
Maintainer antworten meist innerhalb von 1 Tag
-
v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
modelcontextprotocol/typescript-sdk#3243 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` replyEvtl. vergeben @Tidehyc hat das vor 7 Tagen übernommen. Offenv2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
modelcontextprotocol/typescript-sdk#3235 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
UriTemplate.match() throws a TypeError on an empty expression it acceptsEvtl. vergeben @yunusemrejs hat das vor 12 Tagen übernommen. Offenv1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
modelcontextprotocol/typescript-sdk#3221 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/typescript-sdk
Ähnliche Issues
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
openclaw/openclaw#212827 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Use one constant for the 10,000-character input limitEvtl. vergeben @NginxL hat das heute übernommen. Offengood first issue refactor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
aniru-dh21/snap-validate#51 ·
Maintainer antworten meist innerhalb von 1 Tag
-
dependencies effort: small good first issue priority: low
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
TMHSDigital/screencast-mcp#509 ·
Maintainer antworten meist innerhalb von 1 Tag
-
from-review tech-debt testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
blamechris/chroxy#9520 ·
Maintainer antworten meist innerhalb von 1 Tag