Repository navigation
fix(mcp, runtime)!: MCP describe_object answers the same field-masked object schema the /meta door answers (ADR-0106) - #31042
Conversation
…/meta door answers (ADR-0106) WIP: route the HTTP and stdio MCP object-schema reads through the shared ADR-0106 posture and projection. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
…ase table and the /meta door Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
…mask real-stack half Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
…the MCP object-schema mask dogfood's service reads Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
…est tsconfig Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
📓 Docs Drift CheckThis PR changes 3 package(s): 6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 181 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 3ca671c26e8c62efbafa7bc9cd008d1458c54156 && git checkout 3ca671c26e8c62efbafa7bc9cd008d1458c54156
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e396095b6a3e3b54145fab1716ef1e9b3f395230 676f8fae1c21bfeb030b8dc9cd73cbad0cbcbc05 && git checkout -B drift-repro e396095b6a3e3b54145fab1716ef1e9b3f395230 && git merge --no-ff 676f8fae1c21bfeb030b8dc9cd73cbad0cbcbc05
node scripts/docs-audit/affected-docs.mjs --json e396095b6a3e3b54145fab1716ef1e9b3f395230
|
…emitters The HTTP and stdio MCP object-schema reads now answer the same field-visibility refusal code the REST /meta door answers, so the error-code ledger lists it under @objectstack/runtime and @objectstack/mcp as well (check:error-code-provenance). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
The error-code ledger in @objectstack/spec gains two owner rows on this branch, so the changeset grades that package at patch as well. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
|
security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc Contract reviewServed-tier: Reviewed at 2026-11-06T20:25Z, read-only: the PR body, its file list, the three-dot diff of Check-runs on ① Derived judgmentsEvery accept-set and public-surface change the diff implies, each judged against the live tree:
② Semver level
③ Boundary flagsPredecessor head (a) (b) The stdio object resources are masked only when the plugin itself binds a stdio principal; a runtime the host connects to its own transport keeps the unmasked view. Acceptable? Answered: acceptable for this PR; should-fix as a ruling question. When no stdio principal is bound there is no caller to mask for: no data bridge is built, no object tools are registered, and the record resource is already withheld ( (c) The runtime HttpDispatcher Observation, no fix owed here: the D8 switch is read differently by the doors — REST honours ④ Design judgmentThe narrowing, read against ADR-0106 on Tried to break it, in the live tree (unchanged since
Findings:
Implemented-by: VERDICT: PASS |
|
security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc 席位核对ACCEPT · 2026-11-06T20:52Z · head
Generated by Claude Code |
security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc
Clause-②: no (narrowing) — the MCP object-schema reads now serve a caller only the fields the
/metaobject door serves that caller, which ADR-0106 D1 ("a field the caller cannot read does not exist for that caller, on any plane") and the MCP security model ("field-level security applies to the agent exactly as it does to a person") already promise, so no stated contract is narrowed; what narrows is the answer to a caller with areadable: falsefield. Nothing is widened: no export, answer member, error code or status is added.Metadata-protocol: none
Skills-docs: no move —
skills/**teaches no field set fordescribe_object;content/docs/ai/connect-mcp.mdxstates that schema discovery is covered by field-level security.维护者速读
describe_object、list_objects的fieldCount、validate_expression的可用字段,以及 stdio 的objectstack://objects资源,现在与/meta对象门走同一套 ADR-0106 字段级遮蔽,同一调用者看到同一组字段。readable: false字段的调用者是收窄(标题带!);字段可见性无法评估、或遮蔽后对象无字段时,按/meta的方式拒绝(FIELD_VISIBILITY_UNRESOLVED/ 503)。无限制调用者、D4 豁免者与无 security 服务的部署逐字节不变。回滚即 revert 本 PR。packages/runtime/src/domains/mcp.ts(servedToCaller)、packages/mcp/src/stdio-data-bridge.ts(callerObjectView)、packages/mcp/src/plugin.ts(stdio 资源视图接线)。pnpm --filter @objectstack/runtime exec vitest run src/domains/mcp-object-schema-mask.test.ts,预期Tests 17 passed (17)。What changes
packages/runtime/src/domains/mcp.ts). Every object definition the bridge serves to a caller (describeObject,listObjects'fieldCount,optionFieldsOf) now passes the/metadoor's own masker:resolveObjectMasker/maskObjectSchema, newly exported frompackages/runtime/src/domains/meta.tsfor this purpose. A refused projection throws a coded error (FIELD_VISIBILITY_UNRESOLVED, 503) that the tools render as their usual{ error: { code, message, status } }. The action collection and exposure gates keep their unmasked reads.packages/mcp/src/stdio-data-bridge.ts). A newcallerObjectViewwraps the object view withresolveObjectSchemaMaskPosture→relateObjectSchemaMaskPosture→applyObjectSchemaMask(@objectstack/metadata-core), asking the host'ssecurityservice about the API-key principal, resolved on each read.listObjects,describeObjectandoptionFieldsOfread through it. The query verb's sort check keeps the unmasked view.packages/mcp/src/plugin.ts,packages/mcp/src/mcp-server-runtime.ts). When the plugin binds a stdio principal, theobjectstack://objectsresources read the same masked view. A coded refusal from the view is answered as{ error, code, status }, and any other throw still propagates.@objectstack/mcpnow depends on@objectstack/metadata-coreat runtime; it was a dev dependency.pnpm-lock.yamlmoves the one entry.content/docs/ai/connect-mcp.mdxadds one sentence to the security model saying that schema discovery is covered by it..changeset/mcp-describe-object-field-mask.md(patch,@objectstack/mcpand@objectstack/runtime).Tests
packages/runtime/src/domains/mcp-object-schema-mask.test.ts(17). The first half runs the sharedOBJECT_SCHEMA_MASK_CASEStable over the HTTP bridge. The second half runs the real stack (ObjectQL + SQL driver +SecurityPlugin+ the metadata protocol): it covers a member with one field denied, an unrestricted control, a D4 author, and a member denied every field, and comparesdescribe_objectwith the/meta/object/:nameitem field set by field set.packages/mcp/src/stdio-data-bridge.object-schema-mask.test.ts(16). It runs the same case table over the stdiodescribe_object/list_objects/validate_expressionbehind the real tool registration, and anMCPServerPlugincomposition that covers both tools and both resources.packages/qa/dogfood/test/showcase-mcp-describe-object-field-mask.dogfood.test.ts(3). On the showcase stack with real keys, the denied field is absent from REST/meta, from HTTP and stdiodescribe_objectand from the stdio resource, all with one field set. A member denied every field is refused 503FIELD_VISIBILITY_UNRESOLVEDon both transports. The unrestricted control is answered byte for byte.scripts/ablation-replace.mjs, rebuilt, checked withablation-dist-preflightand restored to the HEAD blob. Removing the HTTP mask call turns 7 runtime cases and 2 dogfood cases red. Removing the stdio projection turns 5 mcp cases and 2 dogfood cases red. Both restore legs are green.Acceptance notes
/metaobject door refuses the same unresolvable projection with codeSERVICE_UNAVAILABLE(503), while the REST/metadoor and these MCP tools useFIELD_VISIBILITY_UNRESOLVED. That door is not changed here.Verification
Package suites, typecheck, dogfood
pnpm --filter @objectstack/mcp test: Test Files 58 passed, Tests 706 passedpnpm --filter @objectstack/runtime test: Test Files 551 passed, Tests 8833 passed, 19 skippedpnpm --filter @objectstack/metadata-core test: Test Files 24 passed, Tests 928 passedturbo run typecheckover mcp, runtime, metadata-core and their direct consumers (example-todo, cli, dogfood, http-conformance, verify, example-crm, example-showcase, hono, client, cloud-connection, plugin-dev): 85 tasks; dogfood re-run green after its last test-typing commitpnpm --filter @objectstack/dogfood test): Test Files 429 passed, 3 skipped; Tests 3563 passed, 41 skipped; lock VERDICT command-exit 0Repo gates
node scripts/pm/dispatch-gates.mjs --ran: 106 derived, 106 run, 0 NOT-MEASURED, 0 UNRUNnode scripts/check-nul-bytes.mjs: exit 0node scripts/pm/check-governed-merges.mjs --branch origin/claude/sec-hardening-r13: NOT governed, 1240 changed linesGenerated by Claude Code