Repository navigation
fix(runtime)!: an action's selection is read in the caller's scope before the action runs - #36132
Conversation
… scope Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
…ore it runs Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
…complete to per-record, document the rule Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
…er reads Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 30 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 f40567668c35f6a3c72a3af03757686099a46beb && git checkout f40567668c35f6a3c72a3af03757686099a46beb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 28ba01fe6939ac40a5e72efe32ea6b7680eed33e 59428ccd16bec2ea7cb9d45d4f63bd6ec9edf1ec && git checkout -B drift-repro 28ba01fe6939ac40a5e72efe32ea6b7680eed33e && git merge --no-ff 59428ccd16bec2ea7cb9d45d4f63bd6ec9edf1ec
node scripts/docs-audit/affected-docs.mjs --json 28ba01fe6939ac40a5e72efe32ea6b7680eed33e
|
…d's system bypass; pay the metadata load at collection Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · sunhaolin · session_017xRBcUJzFmCqbSKS3TpveD {
"issue": null,
"status": "done",
"branch": "claude/action-selection-read-scope",
"pr": "https://github.com/objectstack-ai/objectstack/pull/36132",
"session": "session_017xRBcUJzFmCqbSKS3TpveD",
"premise_still_valid": true,
"summary": "Order of record (advisory fix plan steps 1-5, 7 and the docs half of 6) implemented on claude/action-selection-read-scope after merging origin/main (fast-forward to db9e34ad). The shared action sequence (REST, MCP run_action, host dispatchAction) now shape-checks params._selectedIds beside the record key (list of ids, cap 5000, object-less key refused 400 VALIDATION_FAILED), reads the distinct ids once in the caller's own execution context beside the subject load (chunk = min(500, OS_DATA_MAX_PAGE_SIZE, OS_DATA_QUERY_ROW_BUDGET), fields id, explicit limit; any throw or row-less answer counts as not delivered), and consumes the verdict as 404 RECORD_NOT_FOUND for the whole call at the subject-verdict point and before the AI door's hand-off; exempt: declarative update (seat ruling A, stated in the PR), type api, ec.isSystem. A param-less action refuses the near-miss built-in spellings selectedIds/_recordId/_objectName through the param contract (lax env keeps its warn), other custom keys still pass. app-todo todo_mass_complete is execution: 'perRecord' and writes ctx.record; actions.mdx documents the rule. Step 0 was measured first on the base (see security_findings); the planned fix shape closes it and it has its own red-then-green pins. Draft PR #36132 opened through the relay with the first real commits; no card, no Fixes line.",
"tests": "Real-stack pin packages/runtime/src/action-selection-caller-scope.pin.test.ts (booted kernel, isolated posture, REST + MCP bridge): base db9e34ad 'Tests 24 failed | 10 passed (34)', fix 'Tests 34 passed (34)'. Shared harness action-door-record-load-denied.test.ts: 'Tests 31 passed (31)'. action-invocation-audit.test.ts: red after the change (its rig never served the selection; 9 failures 'Record l1 not found in aud_lead'), fixture fixed, '45 passed (45)'. pnpm --filter @objectstack/runtime test at ba1920e0: '1 failed | 636 passed (637)' files, the one failure being that audit file before its fixture fix, then green alone. Ablation via scripts/ablation-replace.mjs over both pin files (65 tests), each leg anchor 1 -> 0 on disk, restored blob == HEAD and git diff HEAD empty: dispatch verdict 14 failed; hand-off verdict 1 failed; list-of-ids shape 4 failed; 5000 cap 2 failed; object-less refusal 1 failed; near-miss refusal 6 failed. No dist ablation needed: the subjects are runtime src imported by the package's own tests. app-todo: typecheck + test exit 0 (TODO-EXIT 0).",
"gates": "Local derived set (dispatch-gates --commands, 103 families at 9abda326): 99 exit 0; exit 3 PREREQUISITE NOT MET (NOT MEASURED locally, CI runs them): check-plugin-teardown-shape --self-test (shallow clone cannot reach its pinned fixture commit), spec check:skill-examples (unbuilt declarations), check:dual-build-cjs-loads (unbuilt packages/qa/scenarios dist). First pass reds fixed in the diff: check:system-context-census (new isSystem read needed a register row: row 49 extended, --write regenerated) and check:test-source-alias (module-top import of @objectstack/metadata in the edited harness file); both exit 0 after. check:type-check-debt re-run alone exit 0 (two of my gate loops overlapped once; the clean re-run is the reading). dispatch-gates --ran: '103 derived famil(ies) accounted for - 103 run'. pnpm --filter @objectstack/runtime typecheck (tsc + check:test-typecheck) exit 0. CI on PR head 9abda326: all 55 check-runs completed, none failed: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (10/10 shards success), Build Core success, Governed Surface Queue Guard success, Test UI success, Live E2E UI success, Dogfood Regression Gate success, Check Changeset success, Lint · ESLint success, Check Documentation Links success; UI jobs Lint UI / Type Check UI / Build & E2E UI skipped by path filter.",
"dogfood_battery": "ba1920e0 (code-identical to the final head 9abda326 for every package the battery builds: the later commit changes a docs page and a test import only) · os-verify-lock: VERDICT command-exit 0 · held the lock 2532s · Test Files 483 passed | 3 skipped (486) · Tests 4101 passed | 68 skipped (4169) · no failures",
"mcp_calls": "2 - mcp__github__pull_request_read (get_check_runs, get_status); no GitHub MCP write tool. Also claude-code-remote subscribe_pr_activity (not GitHub MCP).",
"api_writes": "2 relay writes through scripts/pm: fleet-write pr_create (POST /repos/objectstack-ai/objectstack/pulls, draft, #36132, read-back identical) and this report comment via post-stamped.mjs (POST /repos/objectstack-ai/objectstack/issues/36132/comments). Plus 1 relay read (advisory_read). git push x3 (not REST).",
"line_budget": "10 files, +799 / -20 (runtime src +184/-6, tests +543/-4, docs +31/-1, example +17/-9, changeset +24)",
"files_changed": [
".changeset/action-selection-read-scope.md",
"content/docs/permissions/system-context.mdx",
"content/docs/ui/actions.mdx",
"examples/app-todo/src/actions/task.actions.ts",
"examples/app-todo/src/actions/task.handlers.ts",
"packages/runtime/src/action-dispatch.ts",
"packages/runtime/src/action-door-record-load-denied.test.ts",
"packages/runtime/src/action-execution.ts",
"packages/runtime/src/action-invocation-audit.test.ts",
"packages/runtime/src/action-selection-caller-scope.pin.test.ts"
],
"deviations": [
"content/docs/permissions/system-context.mdx is outside the expected landing: check:system-context-census requires a register row to own the new isSystem read (actionSelectionIsRead); row 49 extended and the register regenerated with --write.",
"packages/runtime/src/action-invocation-audit.test.ts fixture changed: its rig never served the selected rows, so the rule refused its bulk-count calls; the rig now serves the selection, assertions unchanged.",
"No packages/spec edit: the near-miss predicate reads the exported ACTION_PARAM_BUILTIN_KEYS in runtime, and the refusal text is spec validateActionParams' own; builtinNearMissHint stays private.",
"Step-0 harness enforces the isolated posture with an org-scoping service slot instead of @objectstack/organizations (runtime has no dependency on it); Layer 0 is the real plugin-security wall, rows are seeded with explicit organization_id.",
"Worktree created from the shared checkout by detaching its HEAD (the order's branch was checked out there)."
],
"open_questions": [
{
"question": "The near-miss check lives runtime-side over the spec's exported built-in key list, a second spelling of the spec's one-byte rule. Export a predicate from spec instead?",
"options": [
"A keep runtime-side (no spec export change)",
"B export a spec predicate (published export added, api-surface regen, contract review)"
],
"recommendation": "A, because the order forbids widening into spec and the refusal text is already the spec's; B is a clean follow-up if the rule ever grows."
},
{
"question": "The 404 names the first undelivered id of the selection; acceptable as non-disclosing (a hidden row and a missing id answer alike, and the caller sent that id)?",
"options": [
"A keep naming the first undelivered id",
"B name no id"
],
"recommendation": "A, matching the per-record door's envelope, which names its id."
},
{
"question": "Flow actions are read too (the exemption list names only api, declarative update and system). A flow whose runAs is user already re-derives scope; reading its selection is a narrowing for it as well.",
"options": [
"A keep (as ordered)",
"B exempt runAs user flows"
],
"recommendation": "A, as ordered; one rule for every elevated-capable arm."
}
],
"security_findings": "withheld",
"out_of_scope_findings": [
"carrier: security seat · owed skills follow-up (governed surface, cut by the seat): skills/objectstack-ui rules/actions text and the views-apps-actions-pages eval case move to the per-record form for row writes; rule-level wording only; noted in PR Acceptance notes, not filed",
"carrier: security seat · L2 contract-tier review of PR #36132 is owed by the security seat; not knocked"
]
} |
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract-tier review (L2) and adversarial read — REWORK · head Holds.
Owed in this PR, before the seat's delta read:
Not in this PR (with the security seat): two adjacent items found at the doors, on code this PR does not change; and whether ids are handed on as sent or normalised. |
…; rule-only pin titles; near-miss list and wording Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · sunhaolin · session_017xRBcUJzFmCqbSKS3TpveD Delta for review record 7066277867, head {
"issue": null,
"status": "done",
"branch": "claude/action-selection-read-scope",
"pr": "https://github.com/objectstack-ai/objectstack/pull/36132",
"session": "session_017xRBcUJzFmCqbSKS3TpveD",
"premise_still_valid": true,
"summary": "REWORK round on review record 7066277867 (items 1-4), head 08f8b748. (1) actions.mdx and the changeset scope the rule to rows of the object the call names (ctx.params.objectName). (2) Read parity: the selection read now asks the per-record door's own operation, callData('get') per distinct id through loadActionSubjectRecord, in windows of 16 (it was a batched list read). Pinned: on an object whose API exposes get but not list, a selection the caller reads row by row answers 200 and is written, REST and MCP; red on 9abda326 (2 failed | 34 passed (36)), green after. The batched data layer cannot ask a get-permission read, so the read moved rather than the changeset stating a difference. (3) Pin titles and header state the rule only: no session condition is named; assertions kept. (4) The near-miss list is four everywhere (selectedIds, __selectedIds, _recordId, _objectName; pinned too); laxActionParams' docblock is back above its own function; app-todo's AI description says a list selection runs it once per task. The first-round fix is unchanged otherwise (shape, verdict at dispatch and before the AI hand-off, exemptions per seat ruling A, api, system).",
"tests": "Head 8dc46599 (runtime code identical to 08f8b748, which changes docs and the changeset only): pin file + shared harness + audit rig 'Tests 114 passed (114)'; app-todo typecheck + test '267 passed (267)'; pnpm --filter @objectstack/runtime test on 08f8b748: 'Test Files 637 passed (637) · Tests 11769 passed | 25 skipped (11794)', lock VERDICT command-exit 0. New get-only pin red on 9abda326 (find-based read): 'Tests 2 failed | 34 passed (36)', 404 RECORD_NOT_FOUND where 200 expected; green after. Ablation on 8dc46599 via scripts/ablation-replace.mjs over the pin file + shared harness (69 tests), each anchor 1 -> 0, restored blob == HEAD, git diff HEAD empty: dispatch verdict 14 failed; hand-off verdict 1 failed; the read's denial (new read) 19 failed; near-miss refusal 8 failed. Shape/cap/object-less guards unchanged since the first round (their ablations stand: 4, 2, 1 failed).",
"gates": "Delta subset on the rework, each exit 0: check:system-context-census, check:test-source-alias, check:doc-authoring, check:doc-anchors, check:nul-bytes, check:docs-spec-enumerations, check-doc-route-spelling --advisory, check-adr-0087-registration --base origin/main, check-empty-changeset, check-changeset-no-major, check:dispatcher-error-vocabulary, check:error-status-conformance, check:route-envelope, check:issue-citations, check:examples-live-imports; runtime typecheck exit 0. The full derived set (103) ran green on 9abda326 in round one (4 exit 3 PREREQUISITE NOT MET, NOT MEASURED locally). CI: head 8dc46599 check suite completed with no failure (notification). Head 08f8b748 at report time: Lint & Repo Gates success, TypeScript Type Check success, Build Core success, Governed Surface Queue Guard success, Check Changeset success, Dogfood Regression Gate success, Test UI success, Live E2E UI success, Lint · ESLint success, Test Core shards 4/5/8/9/10 success, Test Core shards 1/2/3/6/7 in_progress (honest value; not waited on).",
"dogfood_battery": "Round-one reading stands: ba1920e0 · VERDICT command-exit 0 · Test Files 483 passed | 3 skipped (486) · Tests 4101 passed | 68 skipped (4169). Not re-run for the rework, per the seat's order: runtime src changed only in the read operation (find -> per-id get) plus a moved docblock. A rerun I started on 8dc46599 did not complete (the turn ended on the usage limit; no VERDICT line) and is NOT MEASURED.",
"mcp_calls": "3 total - mcp__github__pull_request_read x3 (get_check_runs x2, get_status x1); no GitHub MCP write tool.",
"api_writes": "3 relay writes through scripts/pm: pr_create (#36132), the round-one os-dev-report comment 7065778044, and this delta os-dev-report comment. Plus 1 relay read (advisory_read). git push x5 (not REST).",
"line_budget": "10 files, see PR file list; the rework adds the get-only pin and per-id read, and removes the chunked-list machinery",
"files_changed": [
".changeset/action-selection-read-scope.md",
"content/docs/permissions/system-context.mdx",
"content/docs/ui/actions.mdx",
"examples/app-todo/src/actions/task.actions.ts",
"examples/app-todo/src/actions/task.handlers.ts",
"packages/runtime/src/action-dispatch.ts",
"packages/runtime/src/action-door-record-load-denied.test.ts",
"packages/runtime/src/action-execution.ts",
"packages/runtime/src/action-invocation-audit.test.ts",
"packages/runtime/src/action-selection-caller-scope.pin.test.ts"
],
"deviations": [
"content/docs/permissions/system-context.mdx is outside the expected landing: check:system-context-census requires a register row to own the new isSystem read (actionSelectionIsRead); row 49 extended and the register regenerated with --write.",
"packages/runtime/src/action-invocation-audit.test.ts fixture changed: its rig never served the selected rows, so the rule refused its bulk-count calls; the rig now serves the selection, assertions unchanged.",
"No packages/spec edit: the near-miss predicate reads the exported ACTION_PARAM_BUILTIN_KEYS in runtime, and the refusal text is spec validateActionParams' own; builtinNearMissHint stays private.",
"Step-0 harness enforces the isolated posture with an org-scoping service slot instead of @objectstack/organizations (runtime has no dependency on it); Layer 0 is the real plugin-security wall, rows are seeded with explicit organization_id.",
"Worktree created from the shared checkout by detaching its HEAD (the order's branch was checked out there).",
"The selection read was the order's batched list read (step 2); it now uses the per-record door's own per-id get, per review item 2, because a list read refused selections the per-record door admits. Cost: up to 5000 reads per call, 16 at a time.",
"Dogfood not re-run for the rework (seat order: only if runtime src changes beyond the read operation)."
],
"open_questions": [
{
"question": "The near-miss check lives runtime-side over the spec's exported built-in key list, a second spelling of the spec's one-byte rule. Export a predicate from spec instead?",
"options": [
"A keep runtime-side (no spec export change)",
"B export a spec predicate (published export added, api-surface regen, contract review)"
],
"recommendation": "A, because the order forbids widening into spec and the refusal text is already the spec's; B is a clean follow-up if the rule ever grows."
},
{
"question": "The 404 names the first undelivered id of the selection; acceptable as non-disclosing (a hidden row and a missing id answer alike, and the caller sent that id)?",
"options": [
"A keep naming the first undelivered id",
"B name no id"
],
"recommendation": "A, matching the per-record door's envelope, which names its id."
},
{
"question": "Flow actions are read too (the exemption list names only api, declarative update and system). A flow whose runAs is user already re-derives scope; reading its selection is a narrowing for it as well.",
"options": [
"A keep (as ordered)",
"B exempt runAs user flows"
],
"recommendation": "A, as ordered; one rule for every elevated-capable arm."
},
{
"question": "The per-id read costs up to 5000 sequential-in-windows reads on a select-all-matching call. Keep it, or add a batched get-permission read to the data layer later?",
"options": [
"A keep per-id get (exact parity now)",
"B data-layer batched get read as a follow-up"
],
"recommendation": "A now, since parity is the rule; B only if a measured selection cost asks for it."
}
],
"security_findings": "withheld",
"out_of_scope_findings": [
"carrier: security seat · owed skills follow-up (governed surface, cut by the seat): skills/objectstack-ui rules/actions text and the views-apps-actions-pages eval case move to the per-record form for row writes; rule-level wording only; noted in PR Acceptance notes, not filed",
"carrier: security seat · L2 contract-tier review of PR #36132 is owed by the security seat; not knocked"
]
} |
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Delta read at Items 1–4 of 7066277867 are closed.
Owed before the next delta read
|
Claude-Session: https://claude.ai/code/session_017xRBcUJzFmCqbSKS3TpveD Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · sunhaolin · session_017xRBcUJzFmCqbSKS3TpveD Delta for the delta read of {
"issue": null,
"status": "done",
"branch": "claude/action-selection-read-scope",
"pr": "https://github.com/objectstack-ai/objectstack/pull/36132",
"session": "session_017xRBcUJzFmCqbSKS3TpveD",
"premise_still_valid": true,
"summary": "Third round on the seat's delta read of 08f8b748 (FAIL, one regression), head 59428ccd. (1) BLOCKING, closed: every element of a selection is a non-empty record id. An empty or whitespace-only element is refused at the shape check with 400 VALIDATION_FAILED (field _selectedIds, code invalid_value), before any read. Pinned on REST and MCP: [''], [''] by a caller who reads no row, [' '], and [readable, '']. Nothing runs and nothing is written. Red on 08f8b748 (8 failed | 38 passed (46)), green after, ablated. Docs and changeset say 'non-empty record ids'. (2) PR body rewritten through the relay's issue_patch: the read is described as the per-record door's own read, the near-miss list has four spellings, test counts are current (46), the ablation table is current; the seat's Skills-docs line and signed last line are kept. Nit: the pin header no longer says 'read once, batched'. The no-protocol fallback's strict id match is left as is, per the seat.",
"tests": "Head 59428ccd: pin file + shared harness + audit rig 'Tests 122 passed (122)' with runtime typecheck exit 0; pin file alone 'Tests 46 passed (46)'. pnpm --filter @objectstack/runtime test: 'Test Files 637 passed (637) · Tests 11777 passed | 25 skipped (11802)', lock VERDICT command-exit 0. New empty-id pins red on 08f8b748: 'Tests 8 failed | 38 passed (46)'. On that head [''] and [readable, ''] passed the read and entered the body: REST answered 400 VALIDATION_ERROR 'Update requires an ID…' from inside the handler, MCP threw the same without a status. [' '] was refused 404 by the read. Ablation of the new check via scripts/ablation-replace.mjs over pin + harness (77 tests): anchor 1 -> 0, '8 failed | 69 passed (77)', restored blob == HEAD, git diff HEAD empty. Earlier guards unchanged; their ablations stand (dispatch verdict 14, hand-off 1, read denial 19, list shape 4, cap 2, object-less 1, near-miss 8).",
"gates": "Delta subset at 59428ccd, each exit 0: check:system-context-census, check:test-source-alias, check:doc-authoring, check:nul-bytes, check-adr-0087-registration --base origin/main, check-empty-changeset --base origin/main, check:error-status-conformance, check:dispatcher-error-vocabulary, check:route-envelope. The full derived set (103) ran in round one (4 exit 3 PREREQUISITE NOT MET, NOT MEASURED locally). CI at 59428ccd at report time, none failed: Lint & Repo Gates success, TypeScript Type Check success, Build Core success, Governed Surface Queue Guard success, Dogfood Regression Gate success, Test UI success, Live E2E UI success, Lint · ESLint success, PR-body guards success (re-run after the body patch), Test Core shards 2/4/5/8/9/10 success, shards 1/3/6/7 in_progress, Check Changeset success on push and in_progress on its re-run after the body patch (honest values; not waited on). CI at 08f8b748: check suite completed with no failure.",
"dogfood_battery": "Not re-run, per the seat's order: runtime src changed only at the shape check (one non-empty-id refusal in actionSelectionIdsOrRefuse). The round-one reading stands: ba1920e0 · VERDICT command-exit 0 · Test Files 483 passed | 3 skipped (486) · Tests 4101 passed | 68 skipped (4169).",
"mcp_calls": "5 total - mcp__github__pull_request_read x5 (get_check_runs x3, get_status x1, get x1); no GitHub MCP write tool.",
"api_writes": "5 relay writes through scripts/pm: pr_create (#36132), report comments 7065778044 and 7073507317, issue_patch of the PR body (seat-ordered; 8411 bytes sent and stored, identical), and this delta os-dev-report comment. Plus 1 relay read (advisory_read). git push x6 (not REST).",
"line_budget": "10 files, see PR file list; the rework adds the get-only pin and per-id read, and removes the chunked-list machinery",
"files_changed": [
".changeset/action-selection-read-scope.md",
"content/docs/permissions/system-context.mdx",
"content/docs/ui/actions.mdx",
"examples/app-todo/src/actions/task.actions.ts",
"examples/app-todo/src/actions/task.handlers.ts",
"packages/runtime/src/action-dispatch.ts",
"packages/runtime/src/action-door-record-load-denied.test.ts",
"packages/runtime/src/action-execution.ts",
"packages/runtime/src/action-invocation-audit.test.ts",
"packages/runtime/src/action-selection-caller-scope.pin.test.ts"
],
"deviations": [
"content/docs/permissions/system-context.mdx is outside the expected landing: check:system-context-census requires a register row to own the new isSystem read (actionSelectionIsRead); row 49 extended and the register regenerated with --write.",
"packages/runtime/src/action-invocation-audit.test.ts fixture changed: its rig never served the selected rows, so the rule refused its bulk-count calls; the rig now serves the selection, assertions unchanged.",
"No packages/spec edit: the near-miss predicate reads the exported ACTION_PARAM_BUILTIN_KEYS in runtime, and the refusal text is spec validateActionParams' own; builtinNearMissHint stays private.",
"Step-0 harness enforces the isolated posture with an org-scoping service slot instead of @objectstack/organizations (runtime has no dependency on it); Layer 0 is the real plugin-security wall, rows are seeded with explicit organization_id.",
"Worktree created from the shared checkout by detaching its HEAD (the order's branch was checked out there).",
"The selection read was the order's batched list read (step 2); it now uses the per-record door's own per-id get, per review item 2, because a list read refused selections the per-record door admits. Cost: up to 5000 reads per call, 16 at a time.",
"Dogfood not re-run for the rework (seat order: only if runtime src changes beyond the read operation).",
"PR body PATCHed after creation (issue_patch), on the seat's explicit order; the seat's Skills-docs line and signed last line are kept verbatim."
],
"open_questions": [
{
"question": "The near-miss check lives runtime-side over the spec's exported built-in key list, a second spelling of the spec's one-byte rule. Export a predicate from spec instead?",
"options": [
"A keep runtime-side (no spec export change)",
"B export a spec predicate (published export added, api-surface regen, contract review)"
],
"recommendation": "A, because the order forbids widening into spec and the refusal text is already the spec's; B is a clean follow-up if the rule ever grows."
},
{
"question": "The 404 names the first undelivered id of the selection; acceptable as non-disclosing (a hidden row and a missing id answer alike, and the caller sent that id)?",
"options": [
"A keep naming the first undelivered id",
"B name no id"
],
"recommendation": "A, matching the per-record door's envelope, which names its id."
},
{
"question": "Flow actions are read too (the exemption list names only api, declarative update and system). A flow whose runAs is user already re-derives scope; reading its selection is a narrowing for it as well.",
"options": [
"A keep (as ordered)",
"B exempt runAs user flows"
],
"recommendation": "A, as ordered; one rule for every elevated-capable arm."
},
{
"question": "The per-id read costs up to 5000 sequential-in-windows reads on a select-all-matching call. Keep it, or add a batched get-permission read to the data layer later?",
"options": [
"A keep per-id get (exact parity now)",
"B data-layer batched get read as a follow-up"
],
"recommendation": "A now, since parity is the rule; B only if a measured selection cost asks for it."
}
],
"security_findings": "withheld",
"out_of_scope_findings": [
"carrier: security seat · owed skills follow-up (governed surface, cut by the seat): skills/objectstack-ui rules/actions text and the views-apps-actions-pages eval case move to the per-record form for row writes; rule-level wording only; noted in PR Acceptance notes, not filed",
"carrier: security seat · L2 contract-tier review of PR #36132 is owed by the security seat; not knocked"
]
} |
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract reviewHead-sha: PASS at
Nits, not blocking: header item 5 of the pin file omits "non-empty", and the shape cases assert "no read" only through the status code. |
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov 席位记录 · ACCEPT · head 维护者速读
席位意见:ACCEPT。三轮审核(完整审核加对抗复读,再加两轮改动复核)的应修项已经全部关闭。 席位核对
|
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract reviewServed-tier: ① Derived judgmentsA record-less call's selection is read in the caller's scope with the per-record door's own operation before an elevated body runs; every element is a non-empty record id; any undelivered id refuses the whole call 404; exemptions are exactly the declarative update, type api and the system principal. Full review 7066277867 (REWORK), deltas 7074038507 (REWORK) and the delta at this head (PASS). Prior record: comment 7074432354. ② Semver level
③ Boundary flagsDev open questions 1-3 answered A (accepted). SQL push-down: the selection is read per id through the per-record door's own get, bounded at 5000 ids; no in-app join. ④ Design judgmentThe narrowing holds against the published spec on Implemented-by: VERDICT: PASS |
1 similar comment
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract reviewServed-tier: ① Derived judgmentsA record-less call's selection is read in the caller's scope with the per-record door's own operation before an elevated body runs; every element is a non-empty record id; any undelivered id refuses the whole call 404; exemptions are exactly the declarative update, type api and the system principal. Full review 7066277867 (REWORK), deltas 7074038507 (REWORK) and the delta at this head (PASS). Prior record: comment 7074432354. ② Semver level
③ Boundary flagsDev open questions 1-3 answered A (accepted). SQL push-down: the selection is read per id through the per-record door's own get, bounded at 5000 ids; no in-app join. ④ Design judgmentThe narrowing holds against the published spec on Implemented-by: VERDICT: PASS |
…on a disabled package's object (objectstack-ai#36337) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_ Part of objectstack-ai#35526 Clause-②: yes (narrowing: for a non-system caller, `callData`'s `aggregate` arm and its `query` fallback on a host with no protocol service refuse a nested-relation condition whose target belongs to a disabled package with 404 `OBJECT_PACKAGE_DISABLED`, where they answered the count or the matching rows) Metadata-protocol: none Skills-docs: none — the docs already teach this answer: `content/docs/deployment/marketplace-handbook.mdx` says a disabled module is refused on the data plane with `404 OBJECT_PACKAGE_DISABLED` and that in-process `ctx.api` is not refused; this PR makes the `/mcp` aggregate door match that text and leaves the system context as it is ## 维护者速读 - 用户能看到什么变化:环境里停用了某个应用包时,普通成员通过 AI 助手的统计工具(或动作)用该包对象的字段做关联条件,以前会得到 1 或 0 的计数,现在和直接读取一样被拒绝(404);系统身份的调用不变。 - 为什么做:属于"停用包在所有读取入口都不可见"这一组修复,替成员挡住统计入口这扇门,避免从计数推出停用包里的字段内容。 - 出错会怎样:只影响停用了包、且查询条件指向该包对象的成员请求;没有停用包的环境不受影响;可以直接撤回本 PR 恢复原行为。 - 要你做什么:决定系统身份调用是否也要拒绝(这一半留给你裁决,本 PR 不改它)。 ## What changes - `packages/runtime/src/action-execution.ts` `refuseUnservedRelationTargets` (used by `callData`'s `aggregate` arm and by the `query` fallback on a host with no protocol service) asks, per nested-relation condition site and before the exposure check, the engine registry's `isObjectPackageDisabled` through `registryObjectPackageDisabled` (`@objectstack/core`, the accessor already documented as "the predicate the data plane asks"). A disabled target throws the protocol's own `objectPackageDisabledError(target)` with `param: where.FIELD`: the same code, status, sentence and `object` the protocol's relation-condition check (`refuseUnservedRelationTarget`, objectstack-ai#35427) throws. No second copy of the predicate or the refusal. - `@objectstack/metadata-protocol` exports `objectPackageDisabledError` from its root, beside `recordNotFoundError` (exported for the same `callData` fallback reason). Additive, enabling-only: no behaviour of that package changes. This is a new published export; see Acceptance notes. - The system-context bypass (`exposureGated = !isSystem`) is **not** changed. The package check rides it, so a system context is still answered the count. That half of the card is the maintainer's open point (ruling 6545646924 keeps in-process access served; a hook's `ctx.api` is a system context); the docblock names it and a pin holds today's answer. - Stdio twin (`packages/mcp/src/stdio-data-bridge.ts` `enforceRelationTargetExposure`): measured, not changed. With a protocol it already refuses a non-system caller 404 `OBJECT_PACKAGE_DISABLED` (it reads the target through the protocol's by-name read). No pin added there. The system-identity half of objectstack-ai#35526 awaits a maintainer decision, so this PR does not close the card. ## Tests New file `packages/runtime/src/action-execution-calldata-relation-disabled-package-35526.test.ts`: a real `ObjectQL` over `SqlDriver` (in-memory SQLite), the real `ObjectStackProtocolImplementation` where the host has one, packages A/B/C, `dp_alpha.b_ref` into B's `dp_beta`, `dp_alpha.c_ref` into C's `dp_gamma`. - THE PIN, aggregate arm, with and without a protocol: member caller, B disabled, `where { b_ref: { secret_note: VALUE } }` refused `404 OBJECT_PACKAGE_DISABLED`, `object: dp_beta`, `param: where.b_ref`, for the stored value AND for a value nothing holds (one answer both ways: no oracle). Code and status asserted. - THE PIN, query fallback (no protocol): same refusal, both values. - CONTROL: B re-enabled answers count 1 / 0 (aggregate) and the matching record (fallback). - CONTROL: a condition into enabled C's `dp_gamma` is served (1 / 0) while B is disabled. - SYSTEM (pinned as today's answer, open point named in the test): aggregate with B disabled answers 1 / 0 on both hosts. - The query arm through the protocol still answers 404 for the member (the data route's own answer, unchanged). Full dogfood battery (owed once at the final head for the narrowing arm), run at `f26f20f54e` by seat 7 under the shared verify lock (`pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test`, no `OS_TEST_SHARD`, no path): lock `VERDICT command-exit 1`; **Test Files 6 failed | 478 passed | 3 skipped (487); Tests 6 failed | 4101 passed | 68 skipped (4175)**. Each of the six failures is `Test timed out in 5000ms` on a shared box (the hold ran 1h42m beside other sessions' unlocked work), and none of the six files reaches `callData`'s aggregate arm or a disabled package's relation condition (grep of the six files for aggregate / OBJECT_PACKAGE_DISABLED / disabled package: no hit; the one `disabled` hit is a disabled-flow refusal): `flow-name-per-namespace.dogfood.test.ts`, `object-hook-lifecycle-showcase.dogfood.test.ts`, `packaged-flow-write-door-parity.dogfood.test.ts`, `permission-unknown-grant-object-refusal.dogfood.test.ts`, `rest-route-generation-tombstones.test.ts`, `wall-package-doors-refusal.dogfood.test.ts`. A locked re-run of those six files alone was queued and is **NOT MEASURED** (the lock went to another session's full battery; queue-timeout, exit 99). CI's `Dogfood Regression Gate` runs the battery in the merge queue. ## Acceptance notes - **New published export.** `objectPackageDisabledError` is now on `@objectstack/metadata-protocol`'s root. Without it the no-protocol fallback has no way to raise the data plane's refusal except a copy of the constructor, which the file's own rule forbids. Precedent: `recordNotFoundError`, exported for the same `callData` fallback. Flagged for the reviewer because a published export is contract surface. - **Read only, not measured on a public door (not filed):** on a host that registers no protocol service, `callData` serves a disabled package's object when it is ADDRESSED directly (the package refusal lives in the protocol's by-name read, which that host lacks), so after this PR such a host refuses a relation condition into the object but still serves the object itself. The stdio bridge on a no-protocol host serves both (measured with a temporary probe, not committed). And the MCP multi-env query fallback can hand `callData` a raw driver with no registry, where the predicate answers "not disabled" (a registry that cannot answer disables nothing, as on the data route). - **Stdio twin readings** (temporary probe over a real engine and the real protocol, B disabled, `where { b_ref: { secret_note: VALUE } }`): non-system + protocol: aggregate and query refused 404 `OBJECT_PACKAGE_DISABLED` for both values; non-system, no protocol: served 1 / 0; system, either host: served 1 / 0. - Overlap with objectstack-ai#36132 (same file, other hunks): `overlap-check` before each push, clean every time. objectstack-ai#36132 has since merged into `main` (c448c61, hunks near L204, L3442-3794, L4676, disjoint from this PR's L340 and the two call sites). `overlap-check` against `origin/main` ed33f8a: merges cleanly. The head was not re-merged with `main`: no GitHub conflict and no main-caused red (AGENTS.md multi-agent discipline 10), and a new head would void the battery above. The merge queue builds and tests the joint tree. - `test:repo` (vitest `repo` project) is CI's (`Test Core`); this diff touches none of its files. ## Verification Read first, by risk: 1. `packages/runtime/src/action-execution.ts`, the hunk in `refuseUnservedRelationTargets`: the predicate is read from the engine passed in (`ql` on the fallback, `engine` on the aggregate arm). 2. `packages/metadata-protocol/src/index.ts`: the one added export line. 3. The new test file's SYSTEM pin, which holds the open point. Two minutes: `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/action-execution-calldata-relation-disabled-package-35526.test.ts` → 12 passed. All readings at head `f26f20f54e` unless named. <details><summary>Premise on origin/main a5a5312 (before the fix)</summary> Same pin file run before the runtime edit (in-memory driver harness at that point): the 3 member pins red (aggregate with protocol, aggregate without protocol, query fallback: the call resolved, nothing refused), 9 green: B re-enabled answers 1 / 0, the enabled-package condition answers 1 / 0, the system caller answers 1 / 0 with B disabled on both hosts, and the query arm through the protocol answers 404 `OBJECT_PACKAGE_DISABLED`. This matches the card's measured 1 / 0 oracle. </details> <details><summary>Pins, ablation and restore</summary> - `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/action-execution-calldata-relation-disabled-package-35526.test.ts` (lock VERDICT command-exit 0): Test Files 1 passed, Tests 12 passed. - Ablation via `scripts/ablation-replace.mjs`, anchor `if (isObjectPackageDisabled(site.target)) {` replaced by `if (false && isObjectPackageDisabled(site.target)) {`: anchor 1 to 0, blob 0ea829f to 2866cbecc099; Tests 3 failed, 9 passed (exactly the three member pins). Restored: blob 0ea829f equals the HEAD blob, `git diff HEAD` empty. The runtime test imports `./action-execution.js` from source, so no build sits between the mutation and the run. </details> <details><summary>Package suites and typecheck</summary> - `pnpm --filter @objectstack/metadata-protocol --filter @objectstack/runtime typecheck`: exit 0. - `pnpm --filter @objectstack/metadata-protocol test`: exit 0. - `pnpm --filter @objectstack/runtime test` (local project): Test Files 636 passed of 637, the one failure being this PR's pin file caught mid-edit while its harness moved from the frozen in-memory driver to `SqlDriver`; the pin file alone then passed 12 / 12 at the final head. </details> <details><summary>Derived gate families</summary> Seat 4, at `f26f20f54e`: 69 derived, 69 run (`check:type-check-debt` green in its own locked run). Earlier runs caught `check:driver-memory-census` and `check:test-source-alias`; both fixed before this head. Seat 7, again at `f26f20f54e` (no new commit): `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands` derived 69 commands (its stderr warns the tree is 39 commits behind origin/main and six scripts/pm gate files moved there; the head was kept, see Acceptance notes). 67 exit 0. `check:plugin-teardown-shape --self-test` first exited 3 (shallow clone could not reach its pinned fixture commit; fetched it) and then 0; `check:dts-closure` first exited 1 (no dist yet, run beside the build) and then 0 after the build. Two are NOT MEASURED, each exit 3 (prerequisite not met): `check:dual-build-cjs-loads` (six packages outside the dogfood closure have no dist: studio, client-react, embedder-openai, knowledge-memory, knowledge-ragflow, scenarios; their locked build never got the lock) and `check:type-check-debt` (its nested locked closure build queue-timed out). `--ran` reconciliation: 69 derived, 67 run, 2 NOT-MEASURED (derived from the recorded exit 3), 0 unrun, exit 0. CI at `f26f20f54e` (check-runs read, not re-run): `Lint & Repo Gates` success, `TypeScript Type Check` success, `Type Check · debt ledger` success, `Test Core` success (10/10 shards), `Build Core` success, `Governed Surface Queue Guard` success, `Test UI` success, `Live E2E UI` success, `Dogfood Regression Gate` success (PR run; its shards run in the queue), `Check Changeset` success; `Lint UI`, `Type Check UI`, `Build & E2E UI` skipped (no ui path). </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jTeURPvEm465RcoYEC <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: follow-up #36156
维护者速读
What changes
The rule: a call names records by id only when the caller can read them. The per-record door already reads its
recordIdin the caller's own scope; a record-less call that carries a selection now has it read the same way.packages/runtime(the shared sequence every action door runs: RESTPOST /api/v1/actions/..., MCPrun_action, a host'sdispatchAction):params._selectedIdsmust be a list of non-empty record ids (strings or numbers), at most 5000 (the console's select-all-matching cap), on an action called on an object; otherwise400 VALIDATION_FAILEDwith a locateddetails.fields[]entry.404 RECORD_NOT_FOUND. No id is dropped; the body or flow never starts.operation: 'update'action — exempt by seat ruling A: it writes as the caller and builds nothing elevated — atype: 'api'action (its target authorizes the caller) and the system principal.selectedIds,__selectedIds,_recordId,_objectName) is refused with the contract's own400, naming the built-in; every other custom key still passes (ADR-0104 D2).examples/app-todo:todo_mass_completeis declaredexecution: 'perRecord'and its handler writesctx.record.content/docs/ui/actions.mdx: the bulk dispatch contract section and "Authorization inside an action" state the rule, its refusals and the three calls that are not read..changeset/action-selection-read-scope.md:@objectstack/runtimepatch, BREAKING (narrowing), with the FROM/TO and the caller's fix.Read first, by risk:
packages/runtime/src/action-dispatch.ts— the shape check in the admission, the read beside the subject load, the verdict beside the subject verdict.packages/runtime/src/action-execution.ts—actionSelectionIsRead,actionSelectionIdsOrRefuse,loadActionSelectionRecords,refuseUndeliveredActionSelection, the hand-off verdict, and the near-miss arm ofenforceActionParams.packages/runtime/src/action-selection-caller-scope.pin.test.ts— the real-stack pins.Why
Security hardening ordered by the security seat as a no-card dispatch. The mechanism is with that seat, not here.
Tests
packages/runtime/src/action-selection-caller-scope.pin.test.ts(new): one booted kernel (ObjectQL, sqlite, auth, security, sharing, REST, dispatcher) under the walledisolatedposture, REST and MCP bridge doors. Refusal cases (rows outside the caller's read scope, alone and beside readable ones, and an id that names nothing) assertstatus+code, that the handler was never entered, and that each named row reads back unchanged from the store. Readable controls: the caller's own rows are written; a repeated id is handed on as sent. Read parity: on an object whose API exposes the record read but not the list, a selection the caller reads row by row runs. Shape: one id not in a list, a list carrying a non-id, an empty or whitespace-only id, a readable id beside an empty one, 5001 ids; exactly 5000 is read, not refused for size. Near-miss: four spellings refused, any other custom key still passes.packages/runtime/src/action-door-record-load-denied.test.ts(shared harness, new top-level describes): the flow arm and the script arm refuse an unreadable selection on both doors with no run and no body; the readable control runs both; an object-less action key with a selection answers400 VALIDATION_FAILED; the AI door judges the selection before a confirmation hand-off; an empty selection reads nothing; which arms are read; the read: each distinct id once, the first undelivered id named in the order sent, a throwing read delivers nothing.packages/runtime/src/action-invocation-audit.test.ts: the bulk-count rig now serves the selection its caller reads (a fixture consequence of the rule; assertions unchanged).Acceptance notes
validateActionParamstext. No spec edit.Verification
Two-minute check:
pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/action-selection-caller-scope.pin.test.ts— expectTests 46 passed (46).Red on the base, green on the fix
db9e34ad, the round-one pin file alone):Tests 24 failed | 10 passed (34).Tests 2 failed | 34 passed (36).Tests 8 failed | 38 passed (46).Tests 46 passed (46).Ablation — each guard removed in turn, through scripts/ablation-replace.mjs (anchor 1 → 0 on disk, restored blob == HEAD, `git diff HEAD` empty after each)
Run over the pin file and the shared harness together, on the head each guard was last changed at:
Package checks
pnpm --filter @objectstack/runtime typecheck(tsc + check:test-typecheck): exit 0.pnpm --filter @objectstack/runtime teston the current head:Test Files 637 passed (637). (The bulk-count rig inaction-invocation-audit.test.tswas a fixture consequence of the rule, fixed in round one.)pnpm --filter @objectstack/example-todo typecheck && pnpm --filter @objectstack/example-todo test: exit 0.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses. (No formatter ran;pnpm lintis CI's run, read from the check-runs.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code