fix(oauth): G6.3 补丁——OAuth AS 真实认证+授权边界(D45) - #23
Merged
Merged
Conversation
- scripts/verify-mcp-oauth-hardening.mjs:断言匿名 client_credentials、匿名 /authorize、 未注册 redirect_uri、超界 scope、匿名 /register 均被拒;合法同意码路径、撤销/轮换跨重启持久、限流 429。 - 修复前实测:1–5 及撤销持久/限流为红(见 PR 描述)。
- fix(oauth): /authorize 强制「管理员口令(env MEBULAR_OAUTH_ADMIN_SECRET)或一次性本地同意码」, 缺一即 401、绝不 302;预注册 client_id 校验;redirect_uri 精确匹配;scope=请求∩allowed∩同意,超界 403 - fix(oauth): 移除 client_credentials(metadata.grant_types_supported 与 /token 分支一致) - fix(oauth): /register 默认禁用(404);仅 MEBULAR_OAUTH_REGISTER_SECRET 时开放,scope 上限 memory.read - fix(oauth): jti 撤销/refresh 轮换落盘 .mebular/auth/revoked.json(0600),跨重启仍生效 - feat(oauth): /authorize、/token 按 IP 限流(MEBULAR_OAUTH_RATE_LIMIT,默认 60/min)→ 429 + Retry-After - feat(cli): token client add|list|remove、token consent(一次性短时同意码) - test(http): verify:mcp:http 合法 PKCE 路径更新为预注册+同意码,不回归 - test(oauth): verify:mcp:oauth 修复后 1–8 全绿并接入 CI build-test-lint 对應 goal-v0.1.md G6.3 補丁與 project-status.md D45。
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.
缺陷
内置 OAuth AS 让匿名者自助领取
memory.admin(公网零授权)。证据(修复前):/authorize无用户认证/同意、无客户端校验,scope 取自请求client_credentials无凭据即签发/register开放 DCR,client_id全程未绑定verify-mcp-http只覆盖 PKCE happy path 与 401/403修复(D45,实现前已冻结于 project-status.md)
/authorize强制「管理员口令(envMEBULAR_OAUTH_ADMIN_SECRET)或一次性本地同意码(mebular token consent)」,缺一即 401、绝不 302;方案并存,常量时间比较。mebular token client add --redirect <uri> --scope <s>预注册;client_id于/authorize与/token强制校验;/register默认 404,仅MEBULAR_OAUTH_REGISTER_SECRET时开放(scope 上限memory.read)。client_credentials(metadata 与/token一致)。redirect_uri精确匹配预注册值。insufficient_scope;默认memory.read。jti撤销/refresh 轮换落盘.mebular/auth/revoked.json(0600),跨重启生效;/authorize、/token按 IP 限流 → 429。auth != none);stdio/bearer 语义不变。红灯 → 绿灯(E1)
scripts/verify-mcp-oauth-hardening.mjs(commitd355746先落红灯):/mcptools/list=11;撤销/轮换跨重启仍失效;限流 429。全部 ✓。验收
npm run verify:mcp:oauth退出码 0)grant_types_supported=['authorization_code','refresh_token']/authorize强制用户认证/同意 + client 校验 + redirect 精确匹配 + scope 交集/register默认禁用verify:mcp:http(合法路径更新为新模型)、verify:mcp:stdio、verify:mcp:skill、verify:mcp:publish;build && test:coverage && lint全绿;50 套件/377 用例不回退;npm run verify0–6 全绿依赖 D45;对应
docs.design/g6-plan.md§6/§11 与goal-v0.1.mdG6.3 补丁 KR。