`OpenIdProviderDiscoveryMetadataSchema` strips `revocation_endpoint`, so clients can't revoke against OIDC-only authorization servers
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- api, authentication
调研方向
从 src/shared/auth.ts 中的 OpenIdProviderDiscoveryMetadataSchema 开始,并将其与 OpenIdProviderMetadataSchema 和 OAuthMetadataSchema 进行比较。使用 revocation_endpoint 重现报告中的解析过程,以确认哪些字段被丢弃。完成标准是 OpenID discovery schema 保留所公布的撤销端点,并且该回归由测试覆盖。
由索引模型根据 Issue 内容生成。
描述
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).
- 主要语言
- TypeScript
- 星标
- 13.8k
- 派生
- 2.5k
- 平均合并
- 6 天 23 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/typescript-sdk 的其他 Issue
-
v2
难度 1/5 1 小时以内 新手友好度 72/100
modelcontextprotocol/typescript-sdk#3270 · 1 条评论 ·
维护者通常 1 天内回复
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`可能已有人在做 @mgoldsborough 于 6 天前认领。 未关闭v2
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/typescript-sdk#3249 ·
维护者通常 1 天内回复
-
v2
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/typescript-sdk#3243 · 3 条评论 ·
维护者通常 1 天内回复
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` reply可能已有人在做 @Tidehyc 于 7 天前认领。 未关闭v2
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/typescript-sdk#3235 · 3 条评论 ·
维护者通常 1 天内回复
-
UriTemplate.match() throws a TypeError on an empty expression it accepts可能已有人在做 @yunusemrejs 于 12 天前认领。 未关闭v1 v2
难度 2/5 1-3 小时 新手友好度 80/100
modelcontextprotocol/typescript-sdk#3221 · 3 条评论 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/typescript-sdk 的全部 Issue
相似的 Issue
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
难度 2/5 1-3 小时 新手友好度 82/100
openclaw/openclaw#212827 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Use one constant for the 10,000-character input limit可能已有人在做 @NginxL 今天认领。 未关闭good first issue refactor
难度 2/5 1-3 小时 新手友好度 78/100
aniru-dh21/snap-validate#51 ·
维护者通常 1 天内回复
-
dependencies effort: small good first issue priority: low
难度 1/5 1-3 小时 新手友好度 88/100
TMHSDigital/screencast-mcp#509 ·
维护者通常 1 天内回复
-
from-review tech-debt testing
难度 2/5 1-3 小时 新手友好度 82/100
blamechris/chroxy#9520 ·
维护者通常 1 天内回复