Repository navigation
fix(plugin-security): a delegated administrator's refused assignment write answers the same for a row it cannot read as for a missing one - #29950
Conversation
…write answers the same for a row it cannot read as for a missing one Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
… write answers the same for a row it cannot read as for a missing one Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…question reuses it Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…nswers the same at the HTTP door for a row it cannot read as for a missing one Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…or's assignment write answer Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…he door Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…ptions Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
|
security#1 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj Contract-review-claim: session_01QSeKYn5CmmdShCJifm6WYj · head d57b423 · 2026-11-03T17:01Z |
📓 Docs Drift CheckThis PR changes 1 package(s): 14 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 13 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 3652020d8c0481e3cf394085a9e8ed3e388d7e71 && git checkout 3652020d8c0481e3cf394085a9e8ed3e388d7e71
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6a4737abae46e1d6847d7abfe430e5d62cd927f0 d57b423215a1c113740b409110558096c29f69f2 && git checkout -B drift-repro 6a4737abae46e1d6847d7abfe430e5d62cd927f0 && git merge --no-ff d57b423215a1c113740b409110558096c29f69f2
node scripts/docs-audit/affected-docs.mjs --json 6a4737abae46e1d6847d7abfe430e5d62cd927f0
|
|
security#1 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj Contract reviewServed-tier: Reviewed on the net diff against ① Derived judgmentsWhat changes. In the delegated branch of the ADR-0090 D12 gate, whether a by-id update or delete has a row to judge is now answered by the caller's own by-id read (the read door's answer, every read visibility and wall included), and the gate refuses at once when that read returns no row. The verdict on a row the caller reads is still taken on the stored row, so its guidance is unchanged. The organization branch's caller read (landed by the sibling) and the delegated branch's read are now one method, and the security plugin hands the gate its per-operation pre-image read so the gate, the read-door question after a refusal, and the later write gates read the row once between them.
② Semver level
③ Boundary flags
④ Design judgmentTried to break it against the cited code; no must-fix found.
Implemented-by: VERDICT: PASS |
|
security#1 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj 席位核对ACCEPT · head
|
Clause-②: no
Metadata-protocol: none
维护者速读
adminScope的调用者,包括同时持有adminScope的组织管理员)按 id 修改或删除授权行(sys_user_position、sys_user_permission_set)被拒时,对它读不到的行和根本不存在的 id 给出完全相同的回答(状态码、错误码、文案、details 全同);委派管理闸门先以调用者自己的读取取得这一行,读得到的行仍按存储行判定。packages/plugins/plugin-security/src/delegated-admin-gate.ts的delegatedTargets与hiddenFromCaller(风险 hunk:读取被拒绝不算“读不到”,仍按存储行判);security-plugin.ts中readAsCaller的接线;org-admin-assignment-boundary.posture.test.ts末尾新增的 describe。pnpm --filter @objectstack/plugin-security exec vitest run src/org-admin-assignment-boundary.posture.test.ts,预期 70/70 通过(含group/isolated下三类委派调用者的新用例与single对照)。What changes
DelegatedAdminGate(ADR-0090 D12) judges a delegate's by-id update or delete of an assignment row (sys_user_position,sys_user_permission_set) only once the caller's own by-id read of that row — the read door's answer to this caller, every read visibility and wall included — has returned it. The read is fix(plugin-security): an organization administrator's refused assignment write answers the same for a row it cannot read as for a missing one #29932's organization-branch read, now one method (callerRead) both branches use.403 PERMISSION_DENIED, "the assignment row it addresses could not be read", details{ operation, object }. Neither case reaches the engine, so a removal of an id that names no row now answers that refusal instead of404 RECORD_NOT_FOUND.readDoorAnswerForGateRefusal), for every id alike — the same reading the by-id write door gives such a caller. A store fault in either read propagates as raised.readAsCaller→getCallerPreImage), so the organization branch, the delegated walk and the read-door questions after them share one read of the row.@objectstack/plugin-securitypatch.Tests
ObjectQL+ SQL driver +SecurityPlugin(org-admin-assignment-boundary.posture.test.ts, new top-level describe; the harness now also registers the two business-unit objects):groupandisolated, for three callers — a delegate, an organization administrator who also holds the scope, and a delegate refused the read of both tables — and both tables, the update and the delete of a row the caller cannot read answer exactly what the same write answers for an id that names no row, compared whole (status, code, sentence, details); the no-row answer is the gate's 403, never the engine's; the row stays;single: a row the delegate reads keeps its guidance, and every in-scope update and delete lands — the delegate refused the read included — reading the row as the caller once.packages/qa/dogfood/test/delegated-admin-assignment-write-unreadable-row.dogfood.test.ts, showcase behind a realisolatedwall, the showcase's ownshowcase_field_ops_delegateset): for a delegate and for an organization owner who also holds the set,PATCHandDELETEof an assignment row the caller cannot read answer exactly what an id naming no row answers; the row stays. Controls: the wall is real, each caller reads no such row; a row inside the scope that the delegate wrote is admitted; a row outside it keeps the guidance naming its unit.git diff HEADempty):node scripts/ablation-replace.mjs, anchor hit 1 time, blob78e3ddaf→47eb74de): posture rig 2 failed | 68 passed — the two walled "answers exactly what an id naming no row answers" cases; every control green;4e1045f1→e13d4015): 3 failed | 67 passed — the three cases that count the caller's reads of the row (2, not 1);78e3ddaf→35c1210c), plugin-security rebuilt,node scripts/ablation-dist-preflight.mjs @objectstack/plugin-security PLANTED_TEXTexit 0 (hitdist/index.js,dist/index.mjs): dogfood pin 1 failed | 2 passed — the unreadable-row case; restored, rebuilt, preflight--absentexit 0, 3/3.Acceptance notes
Clause-②: no. The writes this newly refuses are by-id updates and deletes whose row the caller's read does not return; each was refused before too. An id naming no row was refused by the gate or answered404by the engine. A row the caller cannot read was refused by the gate or answered404 RECORD_NOT_FOUNDby the by-id write door's own read question — measured on the real engine undergroupandisolatedfor rows whose stored image is inside the scope (before: 404, row untouched; after: the gate's 403, row untouched). Every admission stays: in-scope rows the caller reads are admitted under all three postures, and a delegate refused the read keeps its in-scope writes undersingle(pinned).test-budget: 20header was written at 60 cases; the file now holds 70, and its tests took 8.9 s here on a shared box, inside the budget.delegated-admin-gate.test.ts's harness reads through a fakeqlthat ignores context, so its by-id cases stand for a caller who reads the row; their expectations are unchanged.Verification
Final head d57b423 (main merged at 098261a, clean)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderives (5 paths vs merge base 21510bb): 65 commands, each exit 0, captured before any pipe;--ranreconciliation: 65 derived, 65 run, 0 NOT-MEASURED (derived from the recorded exit codes).check:dual-build-cjs-loadsandcheck:type-check-debtran with the lock held and the dist they read built.pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/org-admin-assignment-boundary.posture.test.ts: 70/70.pnpm --filter @objectstack/plugin-security typecheck: exit 0 (tsc, scripts tsc, test layer 0 errors).pnpm --filter @objectstack/dogfood test(full battery, once, under the verify lock): 415 files passed, 3 skipped; 3430 tests passed, 28 skipped; command-exit 0.At 098261a (the main merge; the one later commit types two test reads)
pnpm turbo run build --filter=@objectstack/dogfood --concurrency=2: exit 0, 68 tasks.pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2(full suite): 242 files, 5266 passed, 45 skipped.pnpm --filter @objectstack/plugin-security typecheck,pnpm --filter @objectstack/dogfood typecheck: exit 0 each.pnpm --filter @objectstack/dogfood exec vitest run --project isolatedon this PR's pin and the organization-branch pin beside it: 2 files, 6/6.check:query-options-erasureexit 1 (test surface 236 to 238, the two new reads cast to any; typed in d57b423, then exit 0) andcheck:dual-build-cjs-loadsexit 3 (prerequisite: seven packages outside the dogfood closure unbuilt; built, then exit 0). The whole derived set was then re-run on d57b423 (above).Authored in session
session_01QSeKYn5CmmdShCJifm6WYj(security#1 dispatch, no card).