Repository navigation
fix(runtime): a grant that holds no federation capability is no longer listed list_remote_tables / import_object - #29232
Conversation
…nvelope that can call it (red) Claude-Session: https://claude.ai/code/session_01ADHkmR3xfgrGdYxj32A5PZ Co-authored-by: Claude <noreply@anthropic.com>
…r listed list_remote_tables / import_object The /mcp door hands an OAuth agent the delegating user's system capabilities only under actions:execute, so a metadata:write-only grant holds none and every call of the federation pair answered 403 — for an administrator too. The bridge now carries the pair only for an envelope holding one of the two capabilities, read by the same helper the per-call gate reads. Claude-Session: https://claude.ai/code/session_01ADHkmR3xfgrGdYxj32A5PZ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmR3xfgrGdYxj32A5PZ Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 28 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin b89017cc32fd8ec531fa78b0e4af67739fa94857 && git checkout b89017cc32fd8ec531fa78b0e4af67739fa94857
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 45e9b2f14c91f76683296cd33bb1b477cbaef1bb 2a88bf5b9049abcf09ca4646c68b810ba8abd7f3 && git checkout -B drift-repro 45e9b2f14c91f76683296cd33bb1b477cbaef1bb && git merge --no-ff 2a88bf5b9049abcf09ca4646c68b810ba8abd7f3
node scripts/docs-audit/affected-docs.mjs --json 45e9b2f14c91f76683296cd33bb1b477cbaef1bb
|
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt 席位核对ACCEPT · The maintainer's words for this seat, verbatim: 「接手所有开发,包括跟进之前未完成的开发落地。」
Generated by Claude Code |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 41431624287 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt Landing record · PR #29232
Release: ships Generated by Claude Code |
Requested by Steve · project thread
Fixes #28938
Clause-②: no
Metadata-protocol: none
维护者速读
list_remote_tables/import_object现在只列给真能调用它们的连接:请求持有manage_platform_settings或manage_metadata才列出,否则tools/list不再出现这两件。metadata:write的 OAuth 连接拿不到用户的系统能力(只有actions:execute才委托),所以以前列出这两件工具却每次调用都 403,管理员也一样。packages/runtime/src/domains/mcp.ts的 federation 段(heldFederationCapabilities与按它决定是否挂上两件工具);mcp-federation-bridge.test.ts新增的四个用例。pnpm --filter @objectstack/runtime exec vitest run src/domains/mcp-federation-bridge.test.ts,预期 8 个用例全绿。metadata:write的连接也能用这两件工具(见报告 open_questions)。What changes
buildMcpBridge(packages/runtime/src/domains/mcp.ts) carrieslistRemoteTables/importObjectonly when the request's envelope holdsmanage_platform_settings(FEDERATION_READ_CAPABILITY) ormanage_metadata(FEDERATION_WRITE_CAPABILITY).wireBridgeToolsin@objectstack/mcpregisters the pair only on a bridge carrying both members, so without themtools/listomits the pair. This is the shapelist_actionsalready has: it hides an action its caller may not run.heldFederationCapabilities(ec), is the one read behind both the listing decision and the per-call gate infederationService. The listing and the call therefore cannot disagree.packages/mcp,packages/coreorpackages/spec. The scope-to-set map (scopesToAgentPermissionSets) and the door's delegation rule (the user's system capabilities reach an agent only underactions:execute) are untouched.Why
The
/mcpdoor gives an OAuth agent the delegating user's system capabilities only when the grant namesactions:execute(packages/core/src/security/assemble-execution-context.ts,systemPermissions). It does not do this through a permission set:metadata:writeandactions:executeboth map tomcp_agent_restricted. So ametadata:write-only grant holdssystemPermissions: [], and both federation calls always answered403 PERMISSION_DENIED. That held even for an administrator who holds both capabilities, yet the grant was listed both tools.The card's other route was to judge the human's own capability under
metadata:write. That route was measured and not taken, because it would let a grant do more than the published consent text says. The consent text formetadata:write(MCP_OAUTH_SCOPE_CONSENT_COPY,packages/spec/src/ai/mcp.zod.ts) is: "Build and change this app's metadata as drafts, within your own permissions — a person publishes them".import_objectsaves a live object at once, not a draft, andlist_remote_tablesreads a live remote schema. Neither is what that sentence promises. Whethermetadata:writealone should carry them is the maintainer's call, and it is raised in the report.Tests
packages/runtime/src/domains/mcp-federation-bridge.test.tsgains four cases. Each envelope is resolved by the real/mcpdoor (resolveExecutionContextwith an OAuth token), not written by hand. The delegating user's set carries both federation capabilities unless stated otherwise:metadata:writeonly, administrator: the envelope measuressystemPermissions: [], the bridge carries neither member, and the service is never looked up.metadata:write+actions:execute, same administrator: both members are present, and both calls reach the service.metadata:write+actions:execute, user holding onlymanage_metadata: the pair is kept, andlist_remote_tablesstill refusescode: PERMISSION_DENIED,status: 403.metadata:write+actions:execute, user holding neither capability: neither member.No existing test was edited.
Acceptance notes
tools/callon either tool now gets the SDK's unknown-tool answer instead of the 403 envelope. This is the same answercreate_recordgets withoutdata:write. No call that succeeded before fails now.grantsAuthoringToolsin@objectstack/mcp, which is unchanged, and its pin was ablation-verified below.Verification
Head:
2a88bf5b9(merge oforigin/mainatdedc35051).Red first on the main code (test commit bf746d0, fix not applied)
A one-off probe on the same main code, deleted afterwards, measured the card's symptom: a
metadata:write-only administrator getslist PERMISSION_DENIED 403 | import PERMISSION_DENIED 403.Green and package suites
vitest run src/domains/mcp-federation-bridge.test.ts: 8/8 passed.pnpm --filter @objectstack/runtime test(pre-merge head 7de225b + changeset): Test Files 514 passed (514), Tests 8322 passed | 19 skipped. VERDICT command-exit 0.pnpm --filter @objectstack/runtime typecheck: VERDICT command-exit 0.eslint --no-inline-configon the two touched source files: exit 0.origin/mainand rebuilding the runtime closure:vitest run src/domains/mcp-federation-bridge.test.ts src/security/resolve-execution-context.test.ts48/48 passed;pnpm --filter @objectstack/runtime typecheckVERDICT command-exit 0.Ablations (scripts/ablation-replace.mjs; mutation landed and was restored to the HEAD blob each time)
...(heldFederationCapabilities(ec).length > 0→...(true): cases 1 and 4 fail,expected 'function' to be 'undefined'. 2 failed | 6 passed.if (!heldFederationCapabilities(ec).includes(required)) {→if (false) {): case 3 and the existing "refuses 403 without the capability" pin fail. 2 failed | 6 passed.grantsAuthoringTools:Array.isArray(grantedScopes) &&→!Array.isArray(grantedScopes) ||, inpackages/mcp): "registers neither for a key or a session…" and the skill-parity pin fail. 2 failed | 7 passed.Derived gates (dispatch-gates --commands, 60 families, on head 2a88bf5)
On the merged head all 60 exited 0.
--ranreconciliation, with every exit code recorded: 60 derived, 60 run, 0 NOT-MEASURED, 0 UNRUN.On the pre-merge head, two families had first exited 3 (PREREQUISITE NOT MET).
check:dual-build-cjs-loadslackeddist/for packages outside the runtime closure.check-plugin-teardown-shape --self-testwas missing its pinned fixture commit in the shallow clone, andgit fetchof that commit fixed it. Both are green in the run above.Generated by Claude Code