Repository navigation
fix(security): the owner deletes a record beside an authored delete policy - #39448
Conversation
…efore the fix) Claude-Session: https://claude.ai/code/session_01Utp6CaJjkQx5fPE4Fbmoeq Co-authored-by: Claude <noreply@anthropic.com>
…licy Claude-Session: https://claude.ai/code/session_01Utp6CaJjkQx5fPE4Fbmoeq Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CaJjkQx5fPE4Fbmoeq Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 18 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 aaf32983b2ce219f3d5c7582fcf0e3462b092ff5 && git checkout aaf32983b2ce219f3d5c7582fcf0e3462b092ff5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c e8c0f8ff6eb585e6356e66f1525c0d73b53be2a2 && git checkout -B drift-repro c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c && git merge --no-ff e8c0f8ff6eb585e6356e66f1525c0d73b53be2a2
node scripts/docs-audit/affected-docs.mjs --json c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c
|
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj Final green head: 2026-12-04T01:10Z · |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj Final green head: 2026-12-04T01:12Z · |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czzaKz49WLAvKtdyiY 席位核对L1 verdict (L1-b): ACCEPT at head Face: Route vs rulings. The card left a choice: "ownership admits beside an authored widener (Modify All out per ADR-0066 ①)" or "confirm as intended". Triage touch 7381095597 graded it a Bug under ruling C (7288570890) and queued it, so the first branch is the ruled one. The fix sits where ruling A (7063130499) put the OR term. On delete,
Tests. New pin, 20 cases: by-id owner / manager / org-depth delete with Changeset (read sentence by sentence): patch Follow-ups owed (seat files, then rewrite the PR's Acceptance notes to
Not checked by me: whether an object with an authored select Landing: non-governed, 422 lines, Generated by Claude Code |
|
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj Landing: 2026-12-04T01:30Z · zone em-bill · head |
repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj
Requested by Elon · project thread
Fixes #39339
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
One composition in
packages/plugins/plugin-security/src/security-plugin-rls-filter.ts(computeLayeredRlsFilter). Under ruling A (7063130499) the platform floor stays an OR term beside an authored update/deleteusingpolicy; ondeletethat term was only the creator half (created_by == current_user.id), so the record's owner who did not create the row was refused 403 on every row the authored policy does not admit, against ruling C (7288570890).Now, on
deleteonly, when the declared write authority (ISharingService.checkDelete) answeredallowand the caller holds no Modify All on the object, thatallowis ownership (the owner, someone above the owner by write depth, a declaredwriteScope: 'org'), so the OR has a true term for the row and Layer 1 is null. The floor widens to ownership; it is not dropped (adenykeeps today's composition, floor and authored term both).Unchanged on purpose:
allowalso carries aneditshare and the queue, which are not ownership);created_byfloor (the authority abstains there);The predicate (bulk) delete reaches the same rows through
predicateWriteFloorRelief, andsecurity/explainagrees with both.Two existing pins encoded the defect and are rewritten to ruling C:
predicate-write-floor-deferral.test.ts(BOB, owner of rows he did not create, now deletes them beside the widener; update unchanged) anddelegated-write-never-exceeds-delegator.test.ts(the delete cells' rows follow ownership; a new cell pins the delegator's own delete of an owned row admitted while the delegated delete stays refused). Patch changeset.Read first, by risk:
security-plugin-rls-filter.ts, theownershipAllowAdmitsRowhunk: the three conditions (floor replaced,delete, no Modify All) are the whole widening.owner-beside-authored-delete-policy.test.ts: 20 cases onpublic_read_writeandprivate, by id, by predicate and viasecurity/explain, including the Modify All, creator-who-no-longer-owns and stranger refusals.predicate-write-floor-deferral.test.ts: the rewritten plugin-security: on a by-id write, a sharingallowdrops owner_only_writes out of the OR of permissive policies, so an owner-creator holding an authored widener is refused on their own row #35917 matrix cells.Tests
All readings at head
e8c0f8ff(the branch merged withorigin/main5c00c57).New pin, green at the tip and 9 red with the fix reverted
Fix reverted on disk with
scripts/ablation-replace.mjs(anchorallRlsPolicies = ownershipAllowAdmitsRow ? [] : collected;x1 -> x0, blob 2b4ebae9c700 -> b88a5348b620; the subject is imported fromsrc/, no build in the path):The 9 red: owner, manager above the owner and write depth
orgby id on both objects (6), the owner's predicate delete on both objects (2), the manager's predicate delete (1). Restored: blob == HEAD (2b4ebae9c700),git diff HEADempty.Package suite and typecheck
Derived gates (dispatch-gates --commands, 69 families)
67 run, all exit 0; 2 NOT MEASURED locally (
check:dual-build-cjs-loads,check:i18n: PREREQUISITE NOT MET, they read every package'sdist/; CI runs both).dispatch-gates --ran: 69 derived, 67 run, 2 NOT-MEASURED, 0 UNRUN.check-plugin-teardown-shape --self-testfirst exited 3 on the shallow clone (its pinned fixture commit unreachable) and exited 0 after fetching that commit.Acceptance notes
private/public_readhas the same shape; itsallowalso carries edit shares and the queue). The delegated by-id delete keeping both floors is pre-existing and pinned, so no card is owed.claude/issue-39339-wip, not the claim'sclaude/issue-39339-owner-beside-delete-policy: this run may push only to that name. It carries the previous holder's three commits unchanged plus one merge oforigin/main.Verification
Two minutes:
pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/owner-beside-authored-delete-policy.test.tsshows 20 passed; changeownershipAllowAdmitsRow ? [] : collectedtocollectedand the same command shows 9 failed.Generated by Claude Code