Repository navigation
fix(service-automation): no flow variable key reaches a prototype - #36521
Conversation
…outside the run's scope The scope a flow's conditions, value envelopes and text holes read is built on prototype-free containers, and a variable key with a `__proto__`, `constructor` or `prototype` segment binds nothing in it (skipped, not refused). Pinned at the builder, through an engine run, and on a real boot through a member's public doors. Claude-Session: https://claude.ai/code/session_017xRBcUZLTUc5QZDEPjtRQv Co-authored-by: Claude <noreply@anthropic.com>
…e keys Prototype-free containers plus the `__proto__` skip already keep every key inside the run's scope; `constructor` and `prototype` are legal flow-variable names and `vars["prototype"]` is a printed remedy, so both keep binding. Pins updated to hold that. Claude-Session: https://claude.ai/code/session_017xRBcUZLTUc5QZDEPjtRQv Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · sunhaolin · session_017xRBcUZLTUc5QZDEPjtRQv {
"issue": null,
"status": "done",
"branch": "claude/sec2-xrjw",
"pr": "https://github.com/objectstack-ai/objectstack/pull/36521",
"session": "session_017xRBcUZLTUc5QZDEPjtRQv",
"premise_still_valid": true,
"summary": "The flow scope builders (celScope in dag-traversal.ts, textTemplateScope in builtin/template.ts) follow one rule stated in the new scope-key-segments.ts: every container they create is prototype-free (root included), and a variable key with a __proto__ segment in any position binds nothing (skipped, not refused). constructor and prototype stay ordinary keys: under the two halves neither can leave the scope, both are ruled-legal flow-variable names, and vars['prototype'] is a pinned printed remedy (value-slot-template-grammar.test.ts), which skipping them would have broken. This deviates from the order's literal three-segment list; recorded as a fork in open_questions. Pins: unit (engine runs + both builders + controls) and a real-boot dogfood file through a plain member's public doors.",
"tests": "RED on base 9abc7321 (final pins; src restored to base then back to HEAD, blob == HEAD, git diff HEAD empty): cel-scope-key-segments.test.ts 5 failed / 12 (advisory pin and descent pin among them; the 7 green are controls). flow-condition-scope-keys.dogfood.test.ts 2 failed / 6. GREEN: unit 87/87 (with value-slot-template-grammar.test.ts); dogfood file 6/6 after rebuilding service-automation; pnpm --filter @objectstack/service-automation test 292/292 files, 4242/4242 at 04bb6d7ff; typecheck service-automation exit 0, dogfood exit 0. ABLATION (scripts/ablation-replace.mjs, each restored blob == HEAD, git diff HEAD empty): celScope skip deleted 2/12 red; root container literal 2/12 red; nested container literal 2/12 red; template skip disabled 1/12 red. dist ablation (both celScope halves neutralized via one anchored swap, rebuilt, ablation-dist-preflight marker present in 2 dist files, then --absent after restore): dogfood file 2/6 red, then 6/6. First dist attempt was void: esbuild constant-folded the marker, preflight exit 1 caught it, nothing was read; re-run with a non-foldable marker.",
"gates": "Local: node scripts/pm/dispatch-gates.mjs --commands at 04bb6d7ff, 76 families run, each exit captured before any pipe: 74 exit 0; 2 exit 3 PREREQUISITE (NOT MEASURED, CI runs them): pnpm check:dual-build-cjs-loads (needs every package's dist), pnpm check:type-check-debt (re-measure prerequisite). --ran reconciliation (':: exit N' record): 76 derived, 74 run, 2 NOT-MEASURED derived from exit 3, 0 UNRUN. pnpm --filter @objectstack/spec check:generated after the main merge: exit 0. CI check-runs on 36521: in_progress at report time (not waited on).",
"dogfood_battery": "04bb6d7ff · os-verify-lock VERDICT command-exit 0 (held 40m17s) · Test Files 486 passed, 3 skipped (489) · Tests 4114 passed, 68 skipped (4182) · no failures",
"line_budget": "no budget in the order; 491 added / 4 removed: src 70 (scope-key-segments.ts 47, template.ts 8/2, dag-traversal.ts 7/2, engine.ts 8 docblock), tests 409 (unit 169, dogfood 240), changeset 12",
"files_changed": [
".changeset/sec2-xrjw.md",
"packages/qa/dogfood/test/flow-condition-scope-keys.dogfood.test.ts",
"packages/services/service-automation/src/builtin/template.ts",
"packages/services/service-automation/src/cel-scope-key-segments.test.ts",
"packages/services/service-automation/src/dag-traversal.ts",
"packages/services/service-automation/src/engine.ts",
"packages/services/service-automation/src/scope-key-segments.ts"
],
"deviations": [
"Segment list: the order names __proto__, constructor and prototype; the landed rule skips __proto__ only. Measured reason: a pinned contract (value-slot-template-grammar.test.ts, a head variable named prototype read as vars['prototype'], the remedy the spec's retired-template refusal prints) went red under the three-segment version, and the spec's assignments key schema leaves constructor/prototype legal by ruling. Fork in open_questions.",
"Changeset declares Clause-②: no, Metadata-protocol: none, patch: skipping __proto__ rejects nothing that evaluated before (no CEL spelling read such a key). An earlier commit on the branch (2f11878b) carries a '!' title from the three-segment version; the PR title has none.",
"Worktree: the order said to work on the order-named branch; the primary checkout was detached and the branch checked out in ../objectstack-sec2-xrjw (hook-enforced), fast-forwarded to origin/main 9abc7321 first, later merged with origin/main (04bb6d7ff).",
"withheld"
],
"mcp_calls": "1 — mcp__github__pull_request_read (get, read-only). No GitHub MCP write tool.",
"api_writes": "2 relay/REST writes: fleet-write pr_create (PR 36521), post-stamped --comment on 36521 (this report). Plus 1 relay dispatch that is a read: advisory_read GHSA-xrjw-wj52-2699. git push is not a REST write.",
"relay_writes": 2,
"open_questions": [
{
"question": "FORK (needs_decision): should the scope also skip key segments constructor and prototype, as the order's list names?",
"options": [
"A — keep as landed: prototype-free containers + __proto__ skip. Closes every measured door; narrows nothing; keeps the ruled-legal names and the pinned vars['prototype'] remedy.",
"B — also skip constructor and prototype: narrowing (title '!', BREAKING changeset, ADR-0087 marker); the spec's retired-template refusal (packages/spec flow-template-token.ts) would print a remedy that no longer reads, so the spec text and the pin change too, against the ruling that left both names legal. No additional door closed."
],
"recommendation": "A, because under the two landed halves neither segment can leave the scope (the walk descends only into object slots; containers have no prototype), and B breaks a recorded contract for no measured protection."
},
{
"question": "Refused or skipped (the order's choice)",
"options": [
"skipped (landed)",
"refused"
],
"recommendation": "skipped: a refusal fails every evaluation of the run, including predicates that never read the key, so one caller-supplied key would stop the run; no CEL spelling ever read a __proto__ key, so skipping changes no answer."
}
],
"l2_owed": "contract-tier review of PR 36521 by the security seat (not knocked by this dev).",
"security_findings": "withheld",
"out_of_scope_findings": [
"withheld",
"carrier: none · noted in Acceptance notes, not filed: when a dotted key's head names a variable that already holds an object (e.g. a key record.x with record bound), celScope writes the rest of the key into that held object (inside the run; textTemplateScope does not)."
]
} |
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 11 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 aa662ad7c5d72c8a34fdad9fd3bf0a55d4096f1b && git checkout aa662ad7c5d72c8a34fdad9fd3bf0a55d4096f1b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 316f7571617e0f22b260c457ec87692f5fc1ff5e 510ece0d677837ae3f99294c96edec9dfa0c9546 && git checkout -B drift-repro 316f7571617e0f22b260c457ec87692f5fc1ff5e && git merge --no-ff 510ece0d677837ae3f99294c96edec9dfa0c9546
node scripts/docs-audit/affected-docs.mjs --json 316f7571617e0f22b260c457ec87692f5fc1ff5e
|
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract reviewServed-tier: Read on the head. Check-runs at the head: 38 success, 16 expected skip, 0 failed, 0 pending. ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNothing declared is taken away at the consumer. For the exact name the skip makes the spec's own refusal real. For a dotted key with such a segment the spec declares nothing readable. The design holds against the code it cites: one rule file, two builders, each half pinned at each builder, and the controls keep ordinary dotted keys, S1 (should-fix) — N1 (nit) — N2 (nit) — the changeset's "no expression that evaluated reads differently" has two edges nobody relies on. A key with a skipped segment no longer creates its leading containers, so a head bound only by such a key is unbound where it was an empty map. A stdlib function that stringifies its argument ( N3 (nit) — the Implemented-by: VERDICT: PASS |
…ches a prototype The dry-run payload walk skips a path with a `__proto__` segment and descends through own properties only. The scope rule is restated as enforced: no key reaches a prototype, and the containers the builder creates have none. Test titles, a stale reason in the grammar pin and the changeset's edges follow. Claude-Session: https://claude.ai/code/session_017xRBcUZLTUc5QZDEPjtRQv Co-authored-by: Claude <noreply@anthropic.com>
|
security#2 · sunhaolin · session_017xRBcUZLTUc5QZDEPjtRQv {
"issue": null,
"status": "done",
"round": "2 (delta on the contract review 7082984774)",
"branch": "claude/sec2-xrjw",
"pr": "https://github.com/objectstack-ai/objectstack/pull/36521",
"head": "510ece0d6",
"session": "session_017xRBcUZLTUc5QZDEPjtRQv",
"premise_still_valid": true,
"summary": "P1: the dry run's outbound payload walk follows the same rule: no authored key reaches a prototype. A path with a skipped segment is written nowhere, and the walk descends through own properties only. A skipped slot keeps its authored value in the payload. S1 (seat decision: wording): the rule is restated as enforced, 'no key reaches a prototype; the containers the builder creates have none', in scope-key-segments.ts, the celScope comment, the engine docblock and the changeset; the walk is unchanged. N1: the grammar pin's reason now names the skip rule. N2: the changeset names its two edges. N3: one literal case sits beside the it.each. P4: test titles and the dogfood header state rules only; report comment 7082318428 edited through the relay.",
"tests": "dry-run.test.ts gains 2 cases in a top-level describe of the shared harness. RED on base 9abc7321 (dry-run.ts restored to base, then back to HEAD, blob == HEAD, git diff HEAD empty): 1 failed of 32. GREEN: 32/32. ABLATION (scripts/ablation-replace.mjs, each restored blob == HEAD, git diff HEAD empty): skip guard alone disabled 32/32 green; own-property guard alone disabled 32/32 green (each guard covers the other on this pin); both disabled 1 failed of 32. N2 edges measured on the fixed code: a stringifying stdlib call on a builder container faults; a head bound only by a skipped key is unbound. pnpm --filter @objectstack/service-automation test at 510ece0d6: 292/292 files, 4245/4245 tests. typecheck service-automation and dogfood: exit 0.",
"gates": "node scripts/pm/dispatch-gates.mjs --commands at 510ece0d6: 76 families run, exit captured before any pipe. 74 exit 0. 2 exit 3 PREREQUISITE, NOT MEASURED (CI runs them): pnpm check:dual-build-cjs-loads, pnpm check:type-check-debt. --ran reconciliation: 76 derived, 74 run, 2 NOT-MEASURED derived from exit 3, 0 UNRUN. CI on 510ece0d6: not waited on.",
"dogfood_battery": "510ece0d6 · os-verify-lock VERDICT command-exit 0 (held 42m44s, the chain build + typechecks + service-automation test + dogfood test) · Test Files 486 passed, 3 skipped (489) · Tests 4114 passed, 68 skipped (4182) · no failures",
"files_changed_this_round": [
".changeset/sec2-xrjw.md",
"packages/qa/dogfood/test/flow-condition-scope-keys.dogfood.test.ts",
"packages/services/service-automation/src/builtin/value-slot-template-grammar.test.ts",
"packages/services/service-automation/src/cel-scope-key-segments.test.ts",
"packages/services/service-automation/src/dag-traversal.ts",
"packages/services/service-automation/src/dry-run.test.ts",
"packages/services/service-automation/src/dry-run.ts",
"packages/services/service-automation/src/engine.ts",
"packages/services/service-automation/src/scope-key-segments.ts"
],
"semver": "unchanged: patch, Clause-②: no, Metadata-protocol: none. The walk was not changed (S1 closed by wording).",
"deviations": [
"P1 landed by the seat's second route (the skip rule plus own-property descent), not by writing along a segment array. The spec's slot resolver hands back joined string paths only; a segment array would mean changing a published spec type outside this order's file surface. Consequence: an authored value-map key that itself contains a dot is still not written into the dry-run payload (it was not before either); recorded in open_questions.",
"PR body not edited (body writes are the seat's): its Acceptance-notes census line about dry-run.ts and its Verification counts are from round 1 and now stale. Round 2 counts are in this report."
],
"mcp_calls": "1 this round — mcp__github__pull_request_read (get_comments, read-only). Running total 3, all read-only. No GitHub MCP write tool.",
"api_writes": "this round 2: relay comment_edit on 7082318428 (read-back identical), and this post-stamped comment. Running total 4: pr_create, report comment, comment_edit, delta report.",
"open_questions": [
{
"question": "An authored value-map key containing a dot is not written into a dry run's payload, because the joined slot path cannot be told apart from nesting. Fix it by having the spec slot resolver return a segment array?",
"options": [
"A — a follow-up card: add the segment array to the spec resolver's result, and have the dry run write along it",
"B — leave it: the dry run reports the authored value for such a slot"
],
"recommendation": "A, as its own card: it is a spec type change with its own review."
}
],
"l2_owed": "the seat's re-review of S1/P1 at 510ece0d6.",
"security_findings": "withheld",
"out_of_scope_findings": [
"withheld"
]
} |
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract reviewServed-tier: Delta on record 7082984774 (04bb6d7 to this head), read on the head. Check-runs at the head: 38 success, 16 expected skip, 0 failed, 0 pending. ① Derived judgmentsPrior findings, by id:
Delta judgments:
② Semver level
③ Boundary flags
No must-fix, no should-fix. N4 (nit) — the PR title and body are from the earlier head. They still carry the wide form of the rule, a census line this head contradicts (it says the dry-run writer is unchanged), "nothing that evaluated reads differently", and the earlier counts. Rewrite both before queueing; the head does not move. N5 (nit) — the changeset says a value-map key with a skipped segment "is not written into the payload". The key stays in the payload with its authored value, as the docblock says. What is not written is its evaluated value. N6 (nit) — the dry-run pin goes red only when both guards are gone (the dev's ablation). Neither is pinned alone. Each alone keeps the rule. N7 (nit) — the rule file opens with "every builder" and two halves. The dry-run writer creates no container, so half 1 says nothing of it; it holds the rule by half 2 and own-property descent, which only its own docblock names. Implemented-by: VERDICT: PASS |
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov 席位记录 · ACCEPT · head 维护者速读
席位意见:ACCEPT。完整审核和改动复核提出的应修项已全部关闭。 席位核对
|
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Rule: no flow variable key reaches a prototype, and the containers a scope builder creates have none.
__proto__segment, in any position, binds nothing. It is skipped, not refused.__proto__segment is written nowhere, and its walk descends through own properties only.The rule is stated once, in
packages/services/service-automation/src/scope-key-segments.ts.celScope(dag-traversal.ts),textTemplateScope(builtin/template.ts) and the dry-run payload writer (dry-run.ts) follow it.Skipped, not refused. A refusal would fail every evaluation of the run, including predicates that never read the key. No CEL spelling read such a key before.
constructorandprototypestay ordinary keys. With prototype-free containers, and a walk that descends only into slots that hold an object, neither can leave the scope. Both are legal flow-variable names, and thevars["prototype"]remedy pinned invalue-slot-template-grammar.test.tsstill reads.Why
A no-card hardening order from the security seat. The details stay with the seat.
Tests
packages/services/service-automation/src/cel-scope-key-segments.test.ts: each half of the rule at each builder, with literal cases. Controls:step.resultstill nests and a condition reads it;vars['$error'],has(),vars["prototype"], a bareconstructor,step.prototypeandrecord.prototypestill read.packages/services/service-automation/src/dry-run.test.ts: the dry-run payload writer follows the rule, with a control beside it.packages/qa/dogfood/test/flow-condition-scope-keys.dogfood.test.ts: a real boot through a plain member's public doors, with a control.Every new pin is red on the base and green after. Each guard was ablated, its pins went red, and it was restored to HEAD.
Acceptance notes
constructormakes reads through the container that holds it fault withUnsupported type: object. Carried as its own follow-up.Verification
pnpm --filter @objectstack/service-automation testandtypecheckpass.pnpm --filter @objectstack/dogfood typecheckpasses.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses. (No formatter ran.pnpm lintis CI's repo-wide run.)main, one pull request. (A no-card order: one order, one branch, one pull request.)packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_017xRBcW9L8Noz9BxEwjwiov