Skip to content

fix(mcp, runtime)!: MCP describe_object answers the same field-masked object schema the /meta door answers (ADR-0106) - #31042

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/sec-hardening-r13
Nov 6, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/sec-hardening-r13

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

Clause-②: no (narrowing) — the MCP object-schema reads now serve a caller only the fields the /meta object 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 a readable: false field. 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 for describe_object; content/docs/ai/connect-mcp.mdx states that schema discovery is covered by field-level security.

维护者速读

  • 改了什么:MCP 的 describe_object、list_objects 的 fieldCount、validate_expression 的可用字段,以及 stdio 的 objectstack://objects 资源,现在与 /meta 对象门走同一套 ADR-0106 字段级遮蔽,同一调用者看到同一组字段。
  • 为什么改:ADR-0106 D1 与 MCP 文档都承诺字段级安全在每个平面一致生效;本 PR 让 MCP 的对象结构读取兑现这一承诺。
  • 风险与回滚:对带 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

  • HTTP bridge (packages/runtime/src/domains/mcp.ts). Every object definition the bridge serves to a caller (describeObject, listObjects' fieldCount, optionFieldsOf) now passes the /meta door's own masker: resolveObjectMasker / maskObjectSchema, newly exported from packages/runtime/src/domains/meta.ts for 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.
  • stdio bridge (packages/mcp/src/stdio-data-bridge.ts). A new callerObjectView wraps the object view with resolveObjectSchemaMaskPosture → relateObjectSchemaMaskPosture → applyObjectSchemaMask (@objectstack/metadata-core), asking the host's security service about the API-key principal, resolved on each read. listObjects, describeObject and optionFieldsOf read through it. The query verb's sort check keeps the unmasked view.
  • stdio resources (packages/mcp/src/plugin.ts, packages/mcp/src/mcp-server-runtime.ts). When the plugin binds a stdio principal, the objectstack://objects resources read the same masked view. A coded refusal from the view is answered as { error, code, status }, and any other throw still propagates.
  • Dependency. @objectstack/mcp now depends on @objectstack/metadata-core at runtime; it was a dev dependency. pnpm-lock.yaml moves the one entry.
  • Docs. content/docs/ai/connect-mcp.mdx adds one sentence to the security model saying that schema discovery is covered by it.
  • Changeset. .changeset/mcp-describe-object-field-mask.md (patch, @objectstack/mcp and @objectstack/runtime).

Tests

  • packages/runtime/src/domains/mcp-object-schema-mask.test.ts (17). The first half runs the shared OBJECT_SCHEMA_MASK_CASES table 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 compares describe_object with the /meta/object/:name item 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 stdio describe_object / list_objects / validate_expression behind the real tool registration, and an MCPServerPlugin composition 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 stdio describe_object and from the stdio resource, all with one field set. A member denied every field is refused 503 FIELD_VISIBILITY_UNRESOLVED on both transports. The unrestricted control is answered byte for byte.
  • Ablations. Each was committed first, then mutated through scripts/ablation-replace.mjs, rebuilt, checked with ablation-dist-preflight and 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

  • Field-level masking only: lacking object read is not turned into a whole-object refusal.
  • The runtime dispatcher's own /meta object door refuses the same unresolvable projection with code SERVICE_UNAVAILABLE (503), while the REST /meta door and these MCP tools use FIELD_VISIBILITY_UNRESOLVED. That door is not changed here.
  • The stdio object reads now resolve the API-key principal on each call, as the data verbs already do.

Verification

Package suites, typecheck, dogfood
  • pnpm --filter @objectstack/mcp test: Test Files 58 passed, Tests 706 passed
  • pnpm --filter @objectstack/runtime test: Test Files 551 passed, Tests 8833 passed, 19 skipped
  • pnpm --filter @objectstack/metadata-core test: Test Files 24 passed, Tests 928 passed
  • turbo run typecheck over 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 commit
  • Full dogfood battery under the verify lock (pnpm --filter @objectstack/dogfood test): Test Files 429 passed, 3 skipped; Tests 3563 passed, 41 skipped; lock VERDICT command-exit 0
Repo gates
  • node scripts/pm/dispatch-gates.mjs --ran: 106 derived, 106 run, 0 NOT-MEASURED, 0 UNRUN
  • node scripts/check-nul-bytes.mjs: exit 0
  • node scripts/pm/check-governed-merges.mjs --branch origin/claude/sec-hardening-r13: NOT governed, 1240 changed lines

Generated by Claude Code

…/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
…the MCP object-schema mask dogfood's service reads

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
@github-actions github-actions Bot added size/xl dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/mcp, @objectstack/runtime, @objectstack/spec, touching 19 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/mcp/package.json, packages/mcp/vitest.config.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/api/error-catalog.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/api/error-handling-server.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/deployment/production-readiness.mdx (via FIELD_VISIBILITY_UNRESOLVED (symbol, a top-level const object), FIELD_VISIBILITY_UNRESOLVED (literal, a string literal in ERROR_CODE_LEDGER; a string literal in FIELD_VISIBILITY_UNRESOLVED))
  • content/docs/kernel/contracts/data-engine.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/permissions/authorization.mdx (via buildMcpBridge (symbol, a top-level function))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/releases/v17/17-1.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/releases/v17/17-4.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/mcp/package.json, packages/mcp/vitest.config.ts) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: resolveObjectMasker (4 routes)
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 63 of 222 client-bound route-ledger rows — the other 159 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 159: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 104 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 181 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json e396095b6a3e3b54145fab1716ef1e9b3f395230 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3ca671c26e8c62efbafa7bc9cd008d1458c54156 — the merge of head 676f8fae1c21bfeb030b8dc9cd73cbad0cbcbc05 into base e396095b6a3e3b54145fab1716ef1e9b3f395230, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs e396095b6a3e3b54145fab1716ef1e9b3f395230 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…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
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 676f8fae1c21bfeb030b8dc9cd73cbad0cbcbc05
Local-runs: none
Scope: packages/spec/src/api/error-code-ledger.zod.ts, packages/runtime/src/domains/mcp.ts, packages/runtime/src/domains/meta.ts, packages/mcp/src/stdio-data-bridge.ts, packages/mcp/src/plugin.ts, packages/mcp/src/mcp-server-runtime.ts, packages/mcp/package.json, packages/mcp/vitest.config.ts, packages/runtime/src/domains/mcp-object-schema-mask.test.ts, packages/mcp/src/stdio-data-bridge.object-schema-mask.test.ts, packages/qa/dogfood/test/showcase-mcp-describe-object-field-mask.dogfood.test.ts, pnpm-lock.yaml + docs/adr/0106-metadata-plane-fls-object-schema-masking.md, packages/metadata-core/src/object-schema-fls.ts, packages/metadata-core/src/object-schema-fls-contract.ts, packages/rest/src/rest-server.ts, packages/rest/src/meta-item-read-gate.ts, packages/rest/src/error-response.ts, packages/mcp/src/mcp-http-tools.ts, packages/runtime/src/action-execution.ts, packages/runtime/src/http-dispatcher.ts, packages/runtime/src/security/resolve-execution-context.ts, packages/core/src/security/assemble-execution-context.ts, packages/spec/src/api/error-code-ledger.test.ts

Reviewed at 2026-11-06T20:25Z, read-only: the PR body, its file list, the three-dot diff of claude/sec-hardening-r13 against main (merge base 69e133ea0d97, 14 files), the check-runs on the head, and the published spec on main. Not the dispatch order and not the dispatching seat's conclusions. Two faces on this head: the Clause-②: no (narrowing) line makes the narrowing face (floor: every non-prose path of the diff), and the ledger file makes reviewFace read the schema face too (hits: packages/spec/src/api/error-code-ledger.zod.ts, first on the Scope line). Both map to this tier; the ledger is judged against ADR-0106 D6 and its two new emitters in ①.6 and ④. This record supersedes the one rendered on 68d70b62 (FAIL); the delta 68d70b62..676f8fae is one commit touching .changeset/mcp-describe-object-field-mask.md alone — a third front-matter line, '@objectstack/spec': patch, and one body bullet stating the ledger rows. No code, test, lockfile or docs path moved, so ① and ④ are re-read against an unchanged tree.

Check-runs on 676f8fae, as they stand. Completed success: Governed Surface Queue Guard. Skipped by their own if:: Packed-tarball smoke, 18.x upgrade harness. In progress: Check Changeset, Validate Package Dependencies, Spec property liveness, PR-body guards, Flag docs affected by code changes, Check PR Size, Check Documentation Links; the Lint, Type Check, Build and Test lanes have not reported yet. No red on this head. On the predecessor 68d70b62, 26 check-runs completed green (Check Changeset, Validate Package Dependencies, Type Check · source gates, Spec property liveness, Dogfood Regression Gate, the PR guards among them), 30 lanes were cancelled by this head move, and the two reds (TypeScript Type Check, Test UI) are parent verdicts whose failing step is only "verify every lane succeeded" over those cancelled lanes — not failures of the tree. The one genuine red in this PR's history, the Error-code provenance guard on 4dd35d52, was answered by the ledger commit and did not recur on 68d70b62.

① Derived judgments

Every accept-set and public-surface change the diff implies, each judged against the live tree:

  1. HTTP describe_object (/api/v1/mcp). readObjectForCaller runs the merged object through maskObjectSchema(resolveObjectMasker(deps, context, 'object')) — the dispatcher /meta door's own masker, exported from domains/meta.ts for this. A field outside the caller's readable set is gone from fields and, through maskDeniedFieldReferences, from every other position. Right. The masker is resolved once per bridge (one MCP request) and asked per object, as the /meta list read does.
  2. HTTP list_objects fieldCount. Each listed object is projected before it is counted; one object that cannot be projected refuses the whole listing, which is exactly maskMetaObjectList's rule on the REST and dispatcher /meta object lists. Right, and the cost is the spec's own: a caller walled off one object loses the listing, on /meta as on MCP.
  3. HTTP optionFieldsOf / validate_expression. Both read readObjectForCaller, so the fields in scope, fieldTypes and the label() option-field list name only served fields. Right.
  4. stdio describe_object, list_objects, validate_expression. createStdioDataBridge reads servedView = callerObjectView(objectView, { resolvePrincipal, security }), which runs resolveObjectSchemaMaskPosture → relateObjectSchemaMaskPosture → applyObjectSchemaMask from @objectstack/metadata-core — imported, not restated, so the D4 exemptions, the D6 tiers and the D8 switch are the shared posture's. The principal is re-resolved per read, as the data verbs already do, so a revoked key stops being described objects. Right.
  5. stdio objectstack://objects and objectstack://objects/{objectName} resources. plugin.ts hands setRuntimeObjectView the same callerObjectView once a stdio principal is bound, and buildObjectSchemaResource / buildObjectListResource answer a coded throw from the view as { error, code, status } while letting an uncoded throw travel. Right for the bound case; the unbound case is ③(b).
  6. The coded refusal FIELD_VISIBILITY_UNRESOLVED / 503. On HTTP it is thrown with code typed as the registered ErrorCode vocabulary and rendered by errorResultWithCode as { error: { code, message, status } }; on stdio it is an McpExposureError with the same code, status and sentence as REST's sendFieldVisibilityFault. The code is the one the ledger already registers for this fault (@objectstack/rest). Right. The ledger records the two new emitters under @objectstack/runtime and @objectstack/mcp as provenance rows; the ErrorCode union is unchanged, the ledger test's owner pin (toContain under @objectstack/rest) still holds, the generated ledger page lists each code once, and the spec api-surface lists ERROR_CODE_LEDGER by name only, so no generated artifact is owed. Right.
  7. Newly exported functions from domains/meta.ts (resolveObjectMasker, maskObjectSchema). packages/runtime/src/index.ts exports nothing from domains/, so these are package-internal: no public surface widens. callerObjectView / CallerObjectViewDeps and the optional StdioDataBridgeDeps.security likewise sit in stdio-data-bridge.ts, which packages/mcp/src/index.ts does not export. Right, and the changeset's "no export is added" holds for the published entries.
  8. The new runtime dependency. @objectstack/metadata-core moves from devDependencies to dependencies in packages/mcp/package.json; pnpm-lock.yaml moves the one importer entry and nothing else. metadata-core depends on spec and zod only, so no cycle. Right.
  9. Byte-identical answers for unrestricted callers, D4-exempt callers and hosts with no security service. applyObjectSchemaMask returns the document by reference when nothing is denied and for every passthrough posture; projectMetaObjectSchema and callerObjectView pass that reference on. The runtime suite (unrestricted-caller/byte-identical, is-system/exempt, platform-admin/exempt, write-capable-caller/exempt, no-security-service/tier-1, masking-disabled/D8), the stdio suite and the dogfood control each pin JSON.stringify / text equality against the unsecured baseline. Right. Two caller shapes worth naming: the stdio API-key principal carries systemPermissions through assembleExecutionContext, so D4 holds on that transport; an OAuth agent without the actions:execute scope holds systemPermissions: [] by ADR-0090 D10 and is therefore served the projection even when its human is an admin — the agent is a different caller from the human, and the direction is closed, so this is design, not a gap.
  10. Test claims. 1 baseline + 12 table cases + 4 real-stack cases = 17 (runtime); 1 + 12 + 3 = 16 (stdio); 3 dogfood cases comparing REST /meta, HTTP MCP and stdio MCP field sets on the showcase stack. The counts match the PR body and the cases exercise every D6 tier, D4, D7 and D8.

② Semver level

  • Clause-②: no (narrowing) beside a ! title: consistent with the repo's rules. The (narrowing) arm is the BREAKING carrier (AGENTS.md Post-Task Checklist 3; clause2-line.mjs: "no (narrowing) — NOT a widening, but breaking"); the ! summary, the **BREAKING** banner and the adr-0087: not-required (no-migration-prescription) marker are the three signals check-adr-0087-registration.mjs reads together. The ruling-A table in check-changeset-no-major.mjs is explicit that no (narrowing) with Metadata-protocol: none ships patch and keeps its BREAKING carriers. Nothing is widened on a published entry (①.7), so yes (narrowing) would be wrong. The right line is the one written: Clause-②: no (narrowing), Metadata-protocol: none, patch.
  • Metadata-protocol: none: right — no key an author can write, no accepted value, no default moves.
  • Changeset coverage, re-read at this head: right. The front-matter now grades every published package the diff moves — '@objectstack/mcp': patch, '@objectstack/runtime': patch, '@objectstack/spec': patch — which is what AGENTS.md Post-Task Checklist 3 ("a bug fix in a released package takes a patch changeset — never none") and the repo's precedent for a second-emitter ledger row (c77dd17f26, ACTION_CONFIRMATION_REQUIRED under @objectstack/mcp, graded '@objectstack/spec': patch) require. patch is the right level for spec: ERROR_CODE_LEDGER on the ./api entry gains two provenance members under existing keys, the ErrorCode union does not move, and Metadata-protocol: none makes patch the only level ruling A admits. The new body bullet is accurate against the tree: the code was registered under @objectstack/rest already; the two rows name its new emitters and nothing else.
  • The Skills-docs: line is not a declaration any gate reads; it is harmless prose and its claim (no skills/** text names a describe_object field set) is true in the tree.

③ Boundary flags

Predecessor head 68d70b62 — FAIL on ②, and what changed. That record's one must-fix was that packages/spec/src/api/error-code-ledger.zod.ts moved (a published const on the spec ./api entry) while the changeset graded only @objectstack/mcp and @objectstack/runtime. The commit 676f8fae adds '@objectstack/spec': patch to the front-matter and a one-line bullet stating the ledger rows; nothing else moved. The must-fix is discharged; the three should-fixes below stand as they stood.

(a) list_actions builds parameter summaries from the bound object's field definitions and this PR does not mask that path. Should it? Answered: yes, as a follow-up — should-fix, not a must-fix on this head. The PR is honest about it: the body names it, the docs sentence is scoped to describe_object, list_objects and validate_expression, and the path is pre-existing, unchanged by this diff. Rule: list_actions parameter summaries should follow the same field mask the object-schema reads now follow — either built from the caller's served object, or the action withheld when a param reads a field the caller cannot read, as the /meta projection withholds it. The stdio bridge registers no list_actions, so the rule binds the HTTP bridge alone. Escalated as the next D5(4) audit item for the MCP surface.

(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 (bridgeResources registers it only with a principal-bound reader). The two object-schema resources are the one thing still registered on a principal-less server, and they serve the declared schema to whatever the host wires in — which was true before this PR and is the host's own composition. The PR does not widen it. Rule: the objectstack://objects resources should be registered only under a principal, as the record resource already is, or the host given a seam to hand one in; until the maintainer rules, a host that connects its own transport is serving an unprincipaled schema view and should know it. Not a disclosure this PR introduces or could close without a separate design decision.

(c) The runtime HttpDispatcher /meta object read refuses the same case with code SERVICE_UNAVAILABLE where REST /meta and these MCP tools answer FIELD_VISIBILITY_UNRESOLVED. Confirmed in the tree: fieldVisibilityFaultResponse calls deps.error(message, 503) with no code, and the envelope defaults a 503 to SERVICE_UNAVAILABLE. The MCP tools chose REST's code — the one the ledger registers for this fault and the one sendFieldVisibilityFault emits — which is the right choice. The dispatcher door's code is a pre-existing divergence between two published doors and a wire change on its own; should-fix in a dedicated change with its own changeset, not here.

Observation, no fix owed here: the D8 switch is read differently by the doors — REST honours config.metadata.maskObjectFields, the dispatcher /meta door and both MCP transports honour OS_ALLOW_UNMASKED_OBJECT_METADATA. The MCP reads inherit the dispatcher's reading, so they agree with the door they claim parity with; the REST/dispatcher split predates this PR.

④ Design judgment

The narrowing, read against ADR-0106 on main: it takes no declared capability away at the consumer and makes the spec's own promise real on a plane the spec named. D1 states the invariant "a field the caller cannot read does not exist for that caller, on any plane"; D5 says "every schema-serving outlet, or the mask is decoration" and D5(4) orders an audit of "client SDK describe calls"; connect-mcp.mdx already promised the agent "field-level security … exactly as [it applies] to a person". describe_object was such an outlet serving the stored schema whole. What changes for a readable: false caller is the answer, never the contract.

Tried to break it, in the live tree (unchanged since 68d70b62):

  • Any MCP read path over HTTP still serving an unmasked field set? The per-request HTTP server (handleHttpRequest) wires tools only, no resources, so there is no resource path to miss. describe_object, list_objects (both the plain and listObjectsDiagnosed branches), validate_expression and optionFieldsOf all go through servedToCaller. The action collection (readServedObjects) and the exposure gates keep the whole definition and serve none of it — except through list_actions param summaries, which is ③(a): should-fix. Skill prompts and SKILL.md name tools, not fields.
  • Any stdio read path still serving an unmasked field set? Tools and resources read callerObjectView under a bound principal. The query verb's unofferedSortRefusal reads the bare view, but it serves nothing of the schema: it refuses a sort on a field the caller themselves named. With no principal bound, see ③(b): should-fix (ruling), not a regression.
  • Any caller wrongly refused? A caller denied every field of one object is refused describe_object for it and list_objects entirely — the same two refusals /meta gives them (item and list). An unrestricted, exempt or no-service caller is never refused and never pays the service call (D4 and tier 1 short-circuit before ask). A security lookup that throws is read as "no service" by both transports (the dispatcher's caught resolveService and the plugin's securityReads), the pattern the protocol lookup already uses; registered-and-broken is then indistinguishable from absent at lookup time, but a service that is reachable and throws on evaluation is tier 3 and refuses. Parity with the dispatcher door.
  • Posture fault handling that fails open? Tier 3 (ObjectSchemaMaskEvaluationError) → refusal on both transports, never the document; emptied projection → refusal, never an empty-fields answer; tier 2 (undetermined) → unmasked with the structured warn, which is the ADR's chosen posture; MCP emits no cache headers, so the private, no-store half does not apply. The HTTP masker ??= memo cannot cache a rejection because resolveObjectMasker never rejects (its one service lookup is caught).
  • Transport parity gaps? Code, status and sentence are byte-equal across REST, HTTP MCP and stdio MCP (dogfood pins it on the showcase stack). D4 holds on stdio (API-key principal carries systemPermissions) and on HTTP sessions; an OAuth agent without actions:execute is projected by ADR-0090 D10 design (①.9). The one transport-shaped gap is ③(b).
  • The ledger rows add two provenance entries and change no wire answer; with the spec entry now in the changeset, they owe nothing further.

Findings:

  • Should-fix (follow-up): list_actions parameter summaries should follow the same field mask as the object-schema reads (③a).
  • Should-fix (ruling): the stdio object-schema resources should be served only under a principal, as the record resource is (③b).
  • Should-fix (separate change): the dispatcher /meta object read's refusal code should match REST's FIELD_VISIBILITY_UNRESOLVED (③c).
  • No must-fix. The narrowing holds against the spec, the changeset matches what the diff publishes, and the three should-fixes are pre-existing paths this PR neither widens nor claims to close.

Implemented-by: claude/sec-hardening-r13
Reviewed-by: session_01L9qibvynRbCtMndW8EHNGc

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

席位核对

ACCEPT · 2026-11-06T20:52Z · head 676f8fae1c21bfeb030b8dc9cd73cbad0cbcbc05

  • Contract review: PASS at this head, CONTRACT_REVIEW_TIER, record 6694688168 (isolated reviewer; narrowing face plus the schema face the ledger file brings). It supersedes the reviewer's FAIL on 68d70b62, whose one must-fix (the changeset did not grade @objectstack/spec) is answered by 676f8fae. No must-fix. The three should-fixes are follow-ups outside this change and are carried by this seat.
  • What lands: the MCP object-schema reads (describe_object, list_objects field counts, the fields validate_expression scopes and, on stdio, the object resources) serve each caller the same field set the /meta door serves that caller, and refuse with the /meta door's code and status where field visibility cannot be evaluated. Unrestricted callers, exempt callers and hosts with no security service get unchanged answers.
  • Seat commits on the dev's branch: 68d70b62 records the refusal code under its two new emitters in the error-code ledger (CI's error-code provenance guard was red on 4dd35d52); 676f8fae grades @objectstack/spec at patch for those rows. Both are small and in scope; the provenance gate and the ledger's own tests were run locally before the push.
  • Checks: every check-run on this head is success (59) or skipped (7). The reds on the two earlier heads were the provenance guard (fixed) and parent verdicts over lanes cancelled by the head moves. git merge-tree against current main is clean.
  • Gates (dev, at 4dd35d52; the seat's later commits touch the ledger and the changeset only): suites mcp 58 files / 706 tests, runtime 551 / 8833, metadata-core 24 / 928; dispatch-gates --commands 106 derived / 106 run / 0 NOT-MEASURED; dogfood battery 429 files passed, 3 skipped; ablations on both transports red as predicted and restored.
  • Shape: base main, no closing keyword. Clause-②: no (narrowing), Metadata-protocol: none, patch for @objectstack/mcp, @objectstack/runtime and @objectstack/spec, with the BREAKING banner. Title fix(mcp, runtime)!.
  • Governed: check-governed-merges.mjs --pr 31042: not governed (0 of 14 paths); 1258 changed lines ≤ 3000 ⇒ Tier S.
  • Landing authority: the maintainer's standing approval for this seat's security PRs at Tier S (2026-11-06 card answer in the seat's thread) and 「你应该是使用 pm-dispatch 技能自主审核和落地 pr」.
  • Next: relay pr_ready + automerge_enable.

Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants