Repository navigation
fix(plugin-security)!: a delegated business-unit walk never starts at a unit outside the caller's organization - #31442
Conversation
…a unit outside the caller's organization ADR-0105 D6 red line 2: every BU mechanism operates within one organization. The walk's root is now held to the same organization predicate as its descendants. Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
… a unit outside the caller's organization Posture rig (single, group, isolated) at the gate and the data door, and a fake-engine pin on a driver that scopes nothing. Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…root-in-organization Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 17 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 c0e288242070482f984cf1f92d62d71a52059c9d && git checkout c0e288242070482f984cf1f92d62d71a52059c9d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 37e2c14b9769b11457e9aaaba6f57b139f1b85ba b731e114b69db52714ab7141753c827c142ef7c5 && git checkout -B drift-repro 37e2c14b9769b11457e9aaaba6f57b139f1b85ba && git merge --no-ff b731e114b69db52714ab7141753c827c142ef7c5
node scripts/docs-audit/affected-docs.mjs --json 37e2c14b9769b11457e9aaaba6f57b139f1b85ba
|
…, BREAKING Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f 席位核对ACCEPT at
Implemented-by: os-dev (security#1 order, |
Clause-②: no (narrowing) — the delegated-administration gate holds the root of every delegated business-unit walk to the same organization as its descendants, so the range a self-delegation's anchor is judged against holds units of the caller's organization only. Nothing is widened: no export, error code or status is added.
Metadata-protocol: none
Skills-docs: none — a runtime authorization bound inside
@objectstack/plugin-security; no authorable key, value or metadata type changes, and noskills/**or docs page teaches the self-delegation anchor range's organization bound.维护者速读
packages/plugins/plugin-security/src/delegated-admin-gate.ts的resolveSubtreeById(根判定那一段);再看两个测试文件末尾新增的 describe。pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/delegated-admin-own-name-set.posture.test.ts -t "never starts at a unit outside",预期Tests 15 passed。What changes
Rule (ADR-0105 D6, red line 2: "Every BU mechanism —
unit_and_subordinatessharing,adminScopedelegation, depth scopes — operates within one organization. There is no cross-org tree."): a delegated business-unit walk never starts at a unit outside the caller's organization.DelegatedAdminGate.resolveSubtreeByIdreads the walk's root under the bound organization's own scoped context and applies to it the same row predicate the walk already applies to every descendant. A root that is not a unit of that organization covers nothing.403 PERMISSION_DENIED, the same answer whichever organization the unit belongs to.resolveSubtree(a scope's by-name anchor) keeps its answers: its root is already resolved inside the organization, so the new predicate holds for it by construction. It gains one by-id read per resolved scope.Tests
delegated-admin-own-name-set.posture.test.ts, new describe a delegated business-unit walk never starts at a unit outside the caller's organization, on a realObjectQLengine andSqlDriverwith the realSecurityPlugin, insingle,groupandisolated(5 tests per posture, 15 in all):delegated-admin-gate.test.ts, new describe on a double that scopes nothing, so the row predicate is the only thing standing: 3 tests, one of them a CONTROL, including an organization-less unit.boottakes optional extra catalog entries, so the new describe's delegatable position does not change what the other describes enumerate.Acceptance notes
Verification
Readings at
3de01b6fbunless stated. The final headb731e114bchanges only the changeset (the narrowing declaration, its BREAKING paragraph and the ADR-0087 marker).b731e114b: lockVERDICT command-exit 0,Test Files 438 passed | 3 skipped (441),Tests 3622 passed | 41 skipped (3663), no failures.Package suite and typecheck
pnpm --filter @objectstack/plugin-security test:Test Files 249 passed (249),Tests 5886 passed | 45 skipped (5931), lockVERDICT command-exit 0.pnpm --filter @objectstack/plugin-security typecheck: exit 0 (tscsrc and scripts, pluscheck:test-typecheckOK).cf5c2456c. The commit after it changes only the changeset's declaration line.Ablation (one-time, nothing left in the tree)
scripts/ablation-replace.mjs(anchor hits 1 → 0, blob4cd4659e28e4→e0c1deb04f78). The subject resolves through relativesrcimports, so nodistis in the path.Tests 11 failed | 242 passed (253): the 9 posture legs (3 per posture) and the 2 fake-engine pins that are not controls. Every CONTROL stayed green.HEAD(4cd4659e28e4) andgit diff HEADis empty. The same files then reportTests 253 passed (253).Derived gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat3de01b6fb: 66 commands. Each ran from the worktree, with its exit code captured before any pipe: 66 of 66 exit 0.--ranreconciliation:66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN(a derived zero: every line records its exit code).cf5c2456c, the first sweep hadcheck:dual-build-cjs-loadsandcheck:i18nrefuse their prerequisite (exit 3, missingdist). After building the closure thatcheck:i18nnames, both measure green on the head re-run: 122 require entry points across 72 packages load, and 10 packages' bundles are in sync.check-adr-0087-registration,check-changeset-no-majorandcheck-empty-changeset(all--base origin/main) exit 0, and so doescheck:nul-bytes.