Repository navigation
fix(automation)!: a child flow started from a subflow or map step admits the acting user against the child's requiredPermissions - #39839
Conversation
…its the acting user against the child's requiredPermissions (#33684) Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
…nd map steps Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
…flow or map step Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
… names the subflow and map check Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
… host, keeping the engine facade within its ceiling Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 5 package(s): 5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 8 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 194 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 553156c6b4d54ee39e4388d95b40441312a24127 && git checkout 553156c6b4d54ee39e4388d95b40441312a24127
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 40bc10969da9b4609604cbaa00c8ca75146dbc6d 2360404ac6e30032662fe162094aa12b9e9882d8 && git checkout -B drift-repro 40bc10969da9b4609604cbaa00c8ca75146dbc6d && git merge --no-ff 2360404ac6e30032662fe162094aa12b9e9882d8
node scripts/docs-audit/affected-docs.mjs --json 40bc10969da9b4609604cbaa00c8ca75146dbc6d
|
|
security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX Label · 2026-12-05T16:38Z. |
…ild-flow-start-admission
…tart, and the step's check is named the capability check The FlowUserGrants.systemPermissions and FlowUserGrantsResolver docblocks name the subflow/map child-start admission as a reader, and say an unwired engine refuses every gated child for a run that names a user. The innerRefusal docblock lists the child start as a producer. The changeset, flow.zod.ts and flows.mdx call the step's check the same capability check, and the changeset declares Clause-2 as narrowing. The open-child pin counts the grants reads across the admission alone. Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
…s describe text Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
|
security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX CI · 2026-12-05T17:45Z. |
|
security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX L1 (delta) · 2026-12-05 · head
|
…ild-flow-start-admission
…uiredPermissions The FlowSchema text, the form help, the flows page and the changeset now name the third case: a run that names no user but carries the grants a door forwarded for its caller holds no capability, so a gated child refuses it. The changeset's upgrade note states that only restructuring the flows fixes such a run. Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
…ow form help text bundles Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
…dPermissions text Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
…flow pass-through clause The child-start admission's module header, its pin's header, the liveness note and the FlowSchema docblock now cite #33684 comment 7450613672, which supersedes the subflow pass-through clause of ruling record 6377848497; the rest of 6377848497 still stands for the entry doors. Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
|
security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX Contract reviewServed-tier: This is the first contract-review record on this PR, and a complete one (①②③④). I read the diff at this head, card #33684, ruling comment 7450613672 and the clause of 6377848497 it supersedes, the PR body, and the check-runs at this head. Every check-run is success or skipped.
① Derived judgmentsThe
The check is
② Semver level
③ Boundary flags
④ Design judgmentReusing the by-name start rule at the step seam fits the ruling: one rule function, three askers, no second copy. The child judged is the one Implemented-by: VERDICT: PASS |
…ve-the-gate fix, third innerRefusal producer The form help says a no-user run carrying a caller's grants is treated as holding none of the capabilities, so the step fails; the changeset names moving the gate as the only fix for that run and lifts the no-switch sentence beside the BREAKING line; the innerRefusal texts name the refused child start as a third producer; FlowSchema says unreadable grants admit no capability; the Clause-② line declares the widened engine member. Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
…equiredPermissions text Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
…reated-as wording Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
… behaviour only The admission header, the changeset and the pin's case title no longer present that case as a settled, enumerated rule; they state what a step does at this release. Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX Co-authored-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
|
security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX Contract reviewServed-tier: This is a delta record on The delta is text only. Every changed line is one of: a doc comment, a Open findings: none. Closure of the earlier items:
① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe design is unchanged from the record at Implemented-by: VERDICT: PASS |
|
security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX 维护者速读
席位核对ACCEPT · head
|
|
security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX Hand-off to the maintainer: this PR declares a narrowing and lands by the maintainer. The seat ACCEPT and a same-head contract-review PASS are on this thread; the 维护者速读 is in the seat record above. Requesting review. |
|
security@sunhaolin · sunhaolin · session_017xRBcV4xBHWbZEmo3HuvyX Merged as |
Fixes #33684
Clause-②: yes (narrowing) — widened: the public
AutomationEngine.childFlowStartRefusal(flowName, context)methodMetadata-protocol: semantic
Skills-docs: follow-up #39842
维护者速读
What changes
The rule: a child flow started from a
subflowstep, or from amapstep for one of its items, admits the acting user against the child'srequiredPermissions, with the same capability check a door that starts a flow by name asks (the door's rule 3).childFlowStartRefusal, whose body (child-flow-start-admission.ts) asksrequiredPermissionsStartRefusalfrom@objectstack/core— the rule-3 functionflowStartRefusal(@objectstack/runtime) asks at every by-name door and a dry run asks of a draft. The capability arithmetic, the refusal's code (PERMISSION_DENIED) and its message are that function's.service-automationdoes not depend onruntime, which is why the shared rule lives incore.flowStartRefusaladmits onlyexecutionContext.isSystem === trueand asks rule 3 of every other caller whether or not the flow runs as the system (packages/runtime/src/flow-start-admission.ts, the first line offlowStartRefusal, and rule 3's "elevated or not" in the module header). A step follows the same rule:userId: the trigger's user, or the decider after a human decision), whatever the parent'srunAs; their capabilities are read through the grants resolver run setup already uses (the read a dry run's admission makes);faultedge), carrying the door's refusal as the run'sinnerRefusal(code+message), so the door that answers the parent's failure names it indetails.innerRefusal. The child never starts and has no run.mapasks once per entry, before the entry starts its first item.executeruns: the name resolves for the calling flow's package exactly asRunFacet.executeresolves it. An unresolvable or refused name is not judged here;executeanswers it as before.FlowSchema.requiredPermissionsdocblock and.describe(), the flow form's help text (all ten locales),content/docs/automation/flows.mdx, the regenerated reference pages, the liveness ledger note, and the doc comments offlow-start-admission.ts/flow-start-rules.tsnow state the rule instead of "a subflow node is not a door".Tests
The pin
subflow-required-permissions.test.ts, which asserted the old behaviour, is rewritten to the new rule on the real engine (13 cases), for each step: a member without the capability is refused and the child never starts, with the door's refusal asinnerRefusal; a member holding it runs the child (map: both items); unreadable grants refuse; a start with no user and no caller grants runs as the system principal; a no-user caller with forwarded grants is refused. Plus: an elevated parent still judges the user it runs for; an ungated child runs, and the admission reads no grants for it (the resolver's calls are counted across the admission call alone, so run setup's own read of the parent's user does not mask it).Readings on head
2360404ac(git rev-parse --short HEAD):src/subflow-required-permissions.test.tsTests 13 passed (13); speccheck:generatedexit 0 (All 14 generated artifacts are up to date, against a spec dist built from this branch's spec source);check-i18n-bundlesexit 0 (OK (10 package(s) — all bundles in sync). The commits after1725a6516change text only (doc comments,.describe()strings, form help, changeset, one test title, docs and regenerated reference pages); CI at2360404ac: 76 check-runs, every one success or skipped, 0 failed. The suites below were read on the earlier heads named.Suites
e88276c57:@objectstack/service-automationfull suite, 4 shards: 307 files, 4579 tests passed (77/77/77/76 files; 1265/1209/1143/962 tests).@objectstack/service-automationsrc/subflow-required-permissions.test.ts:Tests 13 passed (13);typecheckexit 0 (test layer: 0 errors).@objectstack/specfull suite, 2 shards: 515 + 515 files; 16324 passed (4 todo) and 14784 passed (1 todo).1e47e3e44, not re-run (the later commits are comment, doc and test-only):@objectstack/runtimesrc/flow-start-required-permissions.test.ts81 passed;@objectstack/platform-objectstranslations 30 files, 694 passed;@objectstack/coretypecheck exit 0.Ablation
The engine's
childFlowStartRefusalbody replaced on disk byPromise.resolve(null)(the steps admit every start, the old behaviour), pin re-run: 7 failed, 6 passed — every refusal case red, every admit case green. Restored: blob equal to HEAD,git diff HEADempty, pin back to 13 passed.On head
e88276c57: the admission made to read the run user's grants before the ungated-child return, pin re-run: the ungated-child case goes red (expected [ 1 ] to deeply equal [ +0 ]). Restored withgit checkout HEAD --,git statusclean.Acceptance notes
Surface beyond the claim's file list, declared:
engine.ts(a one-line stub; the facade stays within its line ceiling, 7834 of 7835) andengine-run-facet.ts(the run facet's host gains the grants resolver) host the new modulechild-flow-start-admission.ts, the admission the two nodes call;flow.metadata-form.tsand the ten locale bundles ofplatform-objectscarry the form help text that restated the old rule;liveness/flow.json(ledger note); comment-only edits in@objectstack/runtime(flow-start-admission.ts, its pin's header) and@objectstack/core(flow-start-rules.tsheader); regenerated reference pages.First-party impact: no example app or dogfood fixture declares a flow-level
requiredPermissions, so nothing in-tree moves.Skills-docs:
skills/objectstack-automation/references/examples-flows.mdstill states the old rule; this PR isdomain:server, so the edit is carried by skills: the automation flow examples say a subflow step is not checked against a child flow's requiredPermissions #39842 (the skills follow-up card).NOT MEASURED locally on
e88276c57(CI owns each):check:query-options-erasure,check:slot-lookup,check:type-check-debt(repo-wide scans killed by a 150 stimeouton a loaded shared box, exit 124);check-plugin-teardown-shape --self-test, speccheck:skill-examples,check:dual-build-cjs-loads,check:i18n, lintcheck:doc-formula-expressionsandcheck:doc-security-posture(each refused its own build prerequisite, exit 3; no form help text changed after1e47e3e44, wherecheck:i18nread in sync).@objectstack/runtimefull suite and typecheck: not run locally, the runtime diff is comment-only;Test Corecovers it.Review round 1 (L1 rework): the
FlowUserGrants.systemPermissionsandFlowUserGrantsResolverdocblocks and the plugin bridge comment now name the child-start admission as a reader, and say an engine with no resolver wired refuses every gated child for a run that names a user; theAutomationResult.innerRefusaldocblock lists the child start as a producer; the step's check is named the same capability check (changeset,FlowSchemadocblock and.describe(),flows.mdx, regenerated reference pages; the form help text did not carry the sentence, so the ten locale bundles are unchanged);Clause-②is declared as narrowing in the changeset and here.Review round 2 (L2 item 2; superseded in part by round 3): every public text for
requiredPermissionsnow states all three cases a child start decides: a run that names a user is judged on that user's capabilities; a run that names no user and carries no caller's grants starts the child as the system principal does; a run that names no user but carries the positions or permission sets a door forwarded for its caller (the guest principal included) holds no capability, so a child that names any capability fails the step with the same refusal. Changed: theFlowSchemadocblock and.describe(), the flow form's help text (English source and the nine translated locale bundles),content/docs/automation/flows.mdx, the regenerated reference pages, and the changeset, whose upgrade note now says such a run is fixed only by restructuring the flows (gating at the entry, or starting the child from a run that acts for a user) and that no switch restores the old behaviour.Review round 2 (L2 items 1, ruled): the child-start admission now cites the maintainer's ruling Automation: subflow and map start a child flow without checking the child's requiredPermissions #33684 comment 7450613672, which supersedes the subflow pass-through clause of ruling record 6377848497 (letter A); the rest of 6377848497 still stands for the entry doors. Cited in the module header of
child-flow-start-admission.ts(whose first sentence now says "the same capability check"), the header ofsubflow-required-permissions.test.ts, theliveness/flow.jsonnote and theFlowSchema.requiredPermissionsdocblock. The runtimeflow-start-admission.tsheader and the@objectstack/coreheader keep 6377848497, which they cite for the doors.Round 2 readings on head
1725a6516(after a merge oforigin/mainateecae948a):src/subflow-required-permissions.test.tsTests 13 passed (13);@objectstack/service-automationtypecheckexit 0;@objectstack/specfull suite, 2 shards: 515 + 515 files, 16324 passed (4 todo) and 14784 passed (1 todo) (taken onb6bbdc3ba; the later commit changes comments and a docblock only); speccheck:generatedexit 0 (all 14 artifacts up to date);check-i18n-bundlesexit 0.dispatch-gates --commandsderives 130 families;--ran:130 derived famil(ies) accounted for — 126 run, 4 NOT-MEASURED (3 DERIVED from a recorded exit 3, 1 claimed), exit 0 (exit 3:check-plugin-teardown-shape --self-test, speccheck:skill-examples,check:dual-build-cjs-loads; claimed:check:query-options-erasure, a 280 s timeout on the shared box). CI on1725a6516: every check-run completed success or skipped, includingType Check · source gates,Lint & Repo Gates,TypeScript Type Check,Test CoreandLint · scoped · query-options erasure.Review round 3 (L1 delta + L2 items, text only; no behaviour change): the flow form help now says a run with no user that carries a caller's grants is treated as holding none of the capabilities, so the step fails (English regenerated, de, es-ES, fr, pt-BR, ru and ar by hand; zh-CN, ja-JP and ko already said it is treated as holding none of them). The changeset names one fix for that run, moving the gate: the parent declares the list and the child declares none. The no-switch sentence now sits beside the BREAKING line. The two
innerRefusal.describe()strings and the section 7a header inautomation-api.zod.tsname the refused child start as the third producer, and the reference pages are regenerated. TheFlowSchematext says grants that cannot be read admit no capability.Clause-②readsyes (narrowing)and names the widenedAutomationEngine.childFlowStartRefusal, here and in the changeset. Thechild-flow-start-admission.tsheader names the by-name doors' check, and theflow-start-rules.tsheader cites Automation: subflow and map start a child flow without checking the child's requiredPermissions #33684 comment 7450613672 beside 6377848497. The admission header, the changeset, one pin's case title, theFlowSchemadocblock and.describe(),flows.mdxand the regenerated reference pages state the no-user, no-grants case as current behaviour only (last commit2360404ac).Verification
Read first, by risk:
packages/services/service-automation/src/child-flow-start-admission.ts— the identity rule (childFlowStartRefusal, the no-user branch).packages/services/service-automation/src/builtin/map-node.ts— the once-per-entry check before the item loop.packages/services/service-automation/src/engine.ts—childFlowStartRefusal, the host that resolves the child asexecutedoes.Two-minute check:
pnpm --filter @objectstack/service-automation exec vitest run --maxWorkers=2 src/subflow-required-permissions.test.ts— expectTests 13 passed (13).Derived gates
node scripts/pm/dispatch-gates.mjs --commandson head41448e5c2derives 130 families; the--ranreconciliation reads:130 derived famil(ies) accounted for — 124 run, 6 NOT-MEASURED (3 DERIVED from a recorded exit 3, 3 claimed), exit 0. Exit 3:check-plugin-teardown-shape --self-test, speccheck:skill-examples,check:dual-build-cjs-loads. Claimed (a 200 s timeout on the shared box, exit 124):check-comment-mask-corpus,check:query-options-erasure,check:type-check-debt; CI owns each.check:nul-bytes,check:i18n,check:doc-authoring, speccheck:docsexit 0. The two commits after41448e5c2change text only:45ed364d8a doc comment, a changeset sentence and a test title;2360404actheFlowSchemadocblock and.describe(),flows.mdxand the two regenerated reference pages (CI's generated-artifact gate is green at2360404ac).🤖 Generated with Claude Code
https://claude.ai/code/session_017xRBcV4xBHWbZEmo3HuvyX
Generated by Claude Code