Skip to content

fix(service-automation): no flow variable key reaches a prototype - #36521

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/sec2-xrjw
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/sec2-xrjw

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户无感:流程的条件、取值、文本占位,以及流程试运行,读写变量时都遵守同一条规则,普通流程的行为不变。
  • 这是安全席位派发的一项加固。
  • 只影响一种特殊变量名,这种名字此前本来也读不到;出现意外可以直接撤回本 PR。
  • 要你做什么:无。本 PR 没有申报收窄,契约审核 PASS 已在案,由席位直接落地。

What changes

Rule: no flow variable key reaches a prototype, and the containers a scope builder creates have none.

  • Every container the CEL scope builder and the text-hole scope builder create has no prototype, the root included.
  • A variable key with a __proto__ segment, in any position, binds nothing. It is skipped, not refused.
  • The dry run's outbound payload writer follows the same rule. A path with a __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.

constructor and prototype stay 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 the vars["prototype"] remedy pinned in value-slot-template-grammar.test.ts still 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.result still nests and a condition reads it; vars['$error'], has(), vars["prototype"], a bare constructor, step.prototype and record.prototype still 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

  • Pre-existing, not changed here: a variable or output key named constructor makes reads through the container that holds it fault with Unsupported type: object. Carried as its own follow-up.
  • Pre-existing, not changed here: a dry run mis-addresses an authored map key that contains a dot, ends in an index, or is empty. This is a payload-accuracy defect, carried as its own follow-up.

Verification

  • CI on the head: every required check is green.
  • pnpm --filter @objectstack/service-automation test and typecheck pass. pnpm --filter @objectstack/dogfood typecheck passes.
  • The full dogfood battery is green on the final head.
  • Contract review: PASS on the head (security seat).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (No formatter ran. pnpm lint is CI's repo-wide run.)
  • 4. One issue, one branch off an up-to-date main, one pull request. (A no-card order: one order, one branch, one pull request.)
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_017xRBcW9L8Noz9BxEwjwiov

…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>
@github-actions github-actions Bot added size/m 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 22, 2026
@objectstack-fleet

objectstack-fleet Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcUZLTUc5QZDEPjtRQv
os-dev-report

{
  "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)."
  ]
}

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/service-automation, touching 7 documentable anchor(s).

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

  • content/docs/kernel/cluster.mdx (via AutomationEngine (symbol, a top-level class))

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

  • content/docs/releases/v16.mdx (via AutomationEngine (symbol, a top-level class))
  • content/docs/releases/v17/17-0.mdx (via AutomationEngine (symbol, a top-level class))
  • content/docs/releases/v17/17-6.mdx (via AutomationEngine (symbol, a top-level class))

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
  • the SDK route bridge reached 68 of 251 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 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 — 11 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 316f7571617e0f22b260c457ec87692f5fc1ff5e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from aa662ad7c5d72c8a34fdad9fd3bf0a55d4096f1b — the merge of head 510ece0d677837ae3f99294c96edec9dfa0c9546 into base 316f7571617e0f22b260c457ec87692f5fc1ff5e, 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 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

⚠️ 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 316f7571617e0f22b260c457ec87692f5fc1ff5e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 04bb6d7ff20280cffb43ebdec6992aab9dfa0f94
Local-runs: none
Scope: packages/services/service-automation/src/scope-key-segments.ts, packages/services/service-automation/src/dag-traversal.ts, packages/services/service-automation/src/builtin/template.ts, packages/services/service-automation/src/engine.ts, packages/services/service-automation/src/cel-scope-key-segments.test.ts, packages/qa/dogfood/test/flow-condition-scope-keys.dogfood.test.ts + packages/services/service-automation/src/run-resume.ts, packages/services/service-automation/src/dry-run.ts, packages/services/service-automation/src/builtin/value-slot-map.ts, packages/services/service-automation/src/builtin/logic-nodes.ts, packages/services/service-automation/src/builtin/crud-nodes.ts, packages/services/service-automation/src/connector-pull.ts, packages/services/service-automation/src/builtin/value-slot-template-grammar.test.ts, packages/formula/src/stdlib.ts, packages/formula/src/cel-engine.ts, packages/formula/src/template-engine.ts, packages/spec/src/automation/builtin-node-config.zod.ts, packages/spec/src/automation/flow-template-token.ts, packages/spec/src/automation/flow-node-expression-paths.ts

Read on the head. Check-runs at the head: 38 success, 16 expected skip, 0 failed, 0 pending.

① Derived judgments

  • Accept set: unchanged. Right. No key is refused anywhere, and the run's variable map still holds every key it was handed.
  • Public surface: unchanged. Right. The new module is not re-exported from the package entry, and both builders stay internal.
  • Half 1 (every container a builder creates has no prototype, the root included): holds at both builders, at every creation site.
  • Half 2 (a key with a __proto__ segment binds nothing): holds at both builders, in any position. Each half is needed beside the other, for the reasons the docblock gives.
  • No key reaches a shared prototype through either builder. Tried:
    • the exact name, and a leading, middle and trailing segment;
    • a walk into a value the run holds (plain object, list, class instance);
    • the constructor then prototype chain, through built containers and through held values;
    • a value that itself carries an own key of that name;
    • the spread and the assign that mount the scope;
    • the map-to-object snapshots and their JSON round trips.
  • The descent guard (object-typed slots only) is what keeps the constructor chain closed. The pin 'stays inside the run scope, a walk into a held value included' goes red if that guard widens.
  • Prototype-free containers and the readers:
    • The CEL evaluator types an object with no constructor as a map at every dispatch site read.
    • Member access, has(), in, indexing, size, equality and comprehensions read own keys and answer as before.
    • Results are copied to plain objects before they leave the evaluator, so no container reaches the variable map, run history or the step log.
    • Text holes render objects through JSON.
    • The pre-existing typing fault on a key named constructor is unchanged by this diff.
  • A security item is with the owner seat.

② Semver level

patch on @objectstack/service-automation, Clause-②: no, Metadata-protocol: none: right, on the PR body and the changeset both.

  • Nothing an author can write is added, refused or given a new meaning.
  • The spec already refuses the exact name as an assignment target, CEL reserves it as an identifier, and the grammar pin already records that no CEL spelling reads a variable of that name.
  • constructor and prototype are untouched.
  • The dogfood package publishes nothing.
  • If S1 is closed by changing the walk instead of the wording, ② is asked again on that head.

③ Boundary flags

  • Fork, segment list (the order named three, one is skipped): A stands.
    • Under prototype-free containers and a walk that enters only object-typed slots, constructor and prototype are ordinary own keys in a built container and are never entered on a held value.
    • B adds no protection to the rule.
    • B narrows two names the spec's key schema leaves legal by ruling, and breaks a printed remedy the grammar pin holds.
  • Skipped or refused: skipped, at the builder. A builder that throws turns one supplied key into a fault of every evaluation in the run. Refusal belongs at the doors that accept keys, where it is loud and local.
  • Escalated to the seat: an author-written key with a skipped segment still parses and registers, and now binds nothing. Refusing it at the authoring door is a narrowing and a contract call, not this PR's.
  • Dev flag, reads faulting on a key named constructor (pre-existing): not this diff's. It is a reproducible defect and needs its own card. A does not rest on it, and B would cover it only for built containers.
  • Dev flag, the held-value write "noted, not filed": not adopted as written. See S1.
  • The dev's census of the package's other dotted-path writers: not adopted as written.
  • Deviations (worktree, extra real-boot pins on doors that already refuse, the earlier commit title): no objection. The PR title carries no !.
  • SQL push-down: the diff holds no query, id materialisation or join.
  • The PR author is the fleet relay account.

④ Design judgment

Nothing 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, vars["$error"], has() and vars["prototype"] reading.

S1 (should-fix) — scope-key-segments.ts states the rule wider than celScope enforces it. Half 1 says a key is only ever an own property of an object the builder made. The CEL walk still writes a dotted key's tail into a value the run already holds when the key's head names it; half 2's own text and the PR's acceptance note both say so. textTemplateScope does hold the sentence: it writes into fresh containers only. The rule file, the celScope comment, the engine docblock and the changeset all carry the wide form. Either the CEL walk stops writing into values it did not create, or the rule is restated as narrow as the code: no variable key reaches a prototype. Which one is a contract call.

N1 (nit) — builtin/value-slot-template-grammar.test.ts (outside the diff) explains leaving __proto__ out of its list by "the flow CEL scope is a plain object". After this change the reason is the skip rule.

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 (trim, joinNonEmpty, date coercion) faults on a builder-made container where it returned placeholder text.

N3 (nit) — the it.each over SCOPE_KEY_SKIPPED_SEGMENTS reads its cases off the constant it pins, so an emptied set runs zero cases there. The literal descent pin and the text-hole pin still cover the skip.

Implemented-by: session_017xRBcUZLTUc5QZDEPjtRQv
Reviewed-by: session_017xRBcW9L8Noz9BxEwjwiov

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>
@github-actions github-actions Bot added size/l and removed size/m labels Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcUZLTUc5QZDEPjtRQv
os-dev-report

{
  "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"
  ]
}

@objectstack-fleet objectstack-fleet Bot changed the title fix(service-automation): a flow condition's scope keys cannot write outside the run's scope fix(service-automation): no flow variable key reaches a prototype Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 510ece0d677837ae3f99294c96edec9dfa0c9546
Local-runs: none

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 judgments

Prior findings, by id:

  • S1: closed. The wide sentence is gone from the rule file, the celScope comment, the engine docblock and the changeset. The rule now reads "no key reaches a prototype, and the containers the builder creates have none", and the rule file says outright that a dotted tail is still written into a held value. That is what both scope builders enforce. The scope walk is unchanged between the two heads (comment only).
  • P1: closed. The dry run's outbound payload writer follows the rule: a path with a __proto__ segment is written nowhere, and the walk descends through own properties only. One pin holds it, with a control beside it.
  • N1: closed. The grammar pin's reason now names the skip rule.
  • N2: closed. The changeset names both edges.
  • N3: closed. A literal case sits beside the it.each, so the set cannot run empty unseen.

Delta judgments:

  • Accept set: unchanged. No key is refused anywhere.
  • Public surface: unchanged. The rule module is still not re-exported; the delta adds one internal import.
  • No key reaches a shared prototype through the dry-run payload writer. Tried, by reading:
    • the exact name, and a leading, middle and trailing segment;
    • an index suffix on such a segment;
    • the constructor then prototype chain;
    • a sibling key whose evaluated value the path then descends into;
    • a segment the split drops;
    • the last-segment write.
  • The skip is judged on the same segment list the walk descends, so no spelling passes one and not the other.
  • Evaluated values are copies before they reach the payload, so a write that descends into one stays in the payload.
  • Writers in the package that walk more than one segment of a key, read at the head:
    • the two scope builders and the dry-run payload writer: follow the rule;
    • the filter operand writer: walks a segment list over its own copy of the filter;
    • the dry-run text-slot writer: one step under a fixed slot name, and it writes text.
    • Two more walkers only read.
    • No other consumer of the spec's slot paths writes by them.
  • An authored map key that the path re-split reads as structure (a dot, an index suffix, an empty key) is addressed as on main: its evaluated value is not written to its own slot. Not changed by this diff.

② Semver level

patch on @objectstack/service-automation, Clause-②: no, Metadata-protocol: none: right, on the changeset and the PR body both.

  • The delta refuses nothing and adds nothing an author can write.
  • A dry run reports the same payload as before for every key. A slot with a skipped segment kept its authored value before and keeps it now.
  • The two edges the changeset now names read a name nothing bound, or fault where placeholder text came back. Neither narrows an accept set.
  • The scope walk did not change, so the earlier reading of ② stands for it.
  • The dogfood package publishes nothing.

③ Boundary flags

  • Face. The changed paths decide no face. The changeset's Clause-②: no line decides the declaration face, so this record stands at TIER_DEFAULT. The earlier record on this PR named the other tier.
  • Dev deviation, the fix route (skip plus own-property descent, not a segment list): accepted. The spec's resolver result carries a joined path string, so a segment list is a change to a published spec type.
  • Dev deviation, the PR body left unedited: upheld. It is the seat's write. See N4.
  • Open question, a dotted authored key in the dry-run payload: A, its own card.
    • It predates this PR and is a payload-accuracy defect, not a prototype question.
    • The card should cover every key the re-split reads as structure: a dot, an index suffix, an empty key.
  • Whether the scope walk copies a held value before writing into it, and whether a key with a skipped segment is refused at the doors that accept keys, are contract calls with the maintainer. Not this PR's.
  • A security item is with the owner seat.
  • SQL push-down: the delta holds no query, id materialisation or join.
  • The PR author is the fleet relay account. The PR title carries no !.

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: session_017xRBcUZLTUc5QZDEPjtRQv
Reviewed-by: session_017xRBcW9L8Noz9BxEwjwiov

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

席位记录 · ACCEPT · head 510ece0d677837ae3f99294c96edec9dfa0c9546

维护者速读

  • 改了什么:流程的条件、取值、文本占位以及流程试运行,在读写变量时,任何变量名都写不到作用域之外;作用域里新建的容器一律不带原型。
  • 为什么:落实安全席位的高危派单。按维护者 2026-11-22 的原话「都派」派出。
  • 若出错:只有一种特殊变量名受影响,它现在不再绑定任何值;正常流程行为不变,可以直接撤回。
  • 要你做什么:无。本 PR 没有申报收窄,也不碰受管面;契约审核 PASS 已在案(签名记录:评论 7085413302),由席位直接入队落地。

席位意见:ACCEPT。完整审核和改动复核提出的应修项已全部关闭。

席位核对

  1. 形态: draft PR,以 main 为基,无卡。只改 service-automation(patch)。另外有测试、一个 dogfood 测试文件和一个 changeset。
  2. 前提实测: 开发第一步先在真实环境里测了 main 上各个入口能否打通,结论记在私密公告里。新增的钉子测试在基座上都是红的,修复后转绿;逐个撤掉守卫,测试都会变红。
  3. 门禁: 当前 head 上 38 项成功、16 项预期跳过、0 项失败。landing-k OK,K = 11。最终 head 上 dogfood 全套为绿。
  4. 接受的偏差:
    • 只跳过 __proto__,constructor 和 prototype 仍是普通键。审核认定这样已经足够安全,而且不破坏已有的规范约定。
    • 遇到特殊键时跳过,不拒绝。
  5. 范围外去向,Skills-docs:: 范围外的安全事项已由安全席位另行记录。另有两个预先存在的缺陷(constructor 键会让读取报错、试运行会错放带点号的键)作为后续事项处理。未触及 skills/**。
  6. 落地条款:
    • Tier S,没有申报收窄,执行 pr_ready 加 automerge_enable。
    • 合并后,公告保持草稿,直到剩余的入口一侧事项由维护者裁定。合并本身记入台账。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 20:38
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 7751753 Nov 22, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/sec2-xrjw branch November 22, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l 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.

1 participant