Skip to content

fix(security): the owner deletes a record beside an authored delete policy - #39448

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-39339-wip
Dec 4, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-39339-wip

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

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/delete using policy; on delete that 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 delete only, when the declared write authority (ISharingService.checkDelete) answered allow and the caller holds no Modify All on the object, that allow is ownership (the owner, someone above the owner by write depth, a declared writeScope: '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 (a deny keeps today's composition, floor and authored term both).

Unchanged on purpose:

  • update (its allow also carries an edit share and the queue, which are not ownership);
  • a Modify All holder keeps the floor plus authored term (ADR-0066 ①: Modify All does not lift an authored write policy on a business object);
  • an object with no owner column keeps the created_by floor (the authority abstains there);
  • the delegated (on-behalf-of) by-id delete keeps both floors.

The predicate (bulk) delete reaches the same rows through predicateWriteFloorRelief, and security/explain agrees 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) and delegated-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:

  1. security-plugin-rls-filter.ts, the ownershipAllowAdmitsRow hunk: the three conditions (floor replaced, delete, no Modify All) are the whole widening.
  2. owner-beside-authored-delete-policy.test.ts: 20 cases on public_read_write and private, by id, by predicate and via security/explain, including the Modify All, creator-who-no-longer-owns and stranger refusals.
  3. predicate-write-floor-deferral.test.ts: the rewritten plugin-security: on a by-id write, a sharing allow drops 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 with origin/main 5c00c57).

New pin, green at the tip and 9 red with the fix reverted
pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/owner-beside-authored-delete-policy.test.ts
 Test Files  1 passed (1)
      Tests  20 passed (20)

Fix reverted on disk with scripts/ablation-replace.mjs (anchor allRlsPolicies = ownershipAllowAdmitsRow ? [] : collected; x1 -> x0, blob 2b4ebae9c700 -> b88a5348b620; the subject is imported from src/, no build in the path):

 Test Files  1 failed (1)
      Tests  9 failed | 11 passed (20)

The 9 red: owner, manager above the owner and write depth org by 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 HEAD empty.

Package suite and typecheck
pnpm --filter @objectstack/plugin-security test
 Test Files  293 passed (293)
      Tests  7439 passed | 52 skipped (7491)
pnpm --filter @objectstack/plugin-security typecheck   exit 0
check:test-typecheck: OK, 0 file(s) / 0 error(s) held in test-typecheck-debt.json
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's dist/; CI runs both). dispatch-gates --ran: 69 derived, 67 run, 2 NOT-MEASURED, 0 UNRUN. check-plugin-teardown-shape --self-test first exited 3 on the shallow clone (its pinned fixture commit unreachable) and exited 0 after fetching that commit.

Acceptance notes

Verification

Two minutes: pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/owner-beside-authored-delete-policy.test.ts shows 20 passed; change ownershipAllowAdmitsRow ? [] : collected to collected and the same command shows 9 failed.


Generated by Claude Code

@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 Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-security, touching 1 documentable anchor(s).

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

  • content/docs/permissions/permissions-matrix.mdx (via computeLayeredRlsFilter (symbol, a top-level function))
  • content/docs/permissions/sharing-rules.mdx (via computeLayeredRlsFilter (symbol, a top-level function))
What this run could not see
  • the SDK route bridge reached 71 of 256 client-bound route-ledger rows — the other 185 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 185: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 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 — 18 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 c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c → packageMentionDocs.

Which tree this was computed on

This run read content/docs from aaf32983b2ce219f3d5c7582fcf0e3462b092ff5 — the merge of head e8c0f8ff6eb585e6356e66f1525c0d73b53be2a2 into base c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c, 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 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

⚠️ 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 c9ea363d71087bd9d16e0a8ee6de0c5f76331e0c → 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

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj

Final green head: 2026-12-04T01:10Z · e8c0f8ff6eb585e6356e66f1525c0d73b53be2a2 · check-runs 39 success, 18 skipped, 0 failed (the PR-body claim guard re-run after the re-posted claim 7397241774 names claude/issue-39339-wip). os-dev report 7397150541 on #39339. Sent to L1-b for review; zone em-bill.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj

Final green head: 2026-12-04T01:12Z · e8c0f8ff6eb585e6356e66f1525c0d73b53be2a2 · check-runs 39 success, 18 skipped, 0 failed (the PR-body claim guard re-run after the re-posted claim 7397241774 names claude/issue-39339-wip). os-dev report 7397150541 on #39339. Sent to L1-b for review; zone em-bill.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czzaKz49WLAvKtdyiY

席位核对

L1 verdict (L1-b): ACCEPT at head e8c0f8ff6e (Fixes #39339, p2), with two follow-up cards owed before landing (below). Read at 2026-12-04T01:15Z.

Face: l1-face --pr 39448 — 13 ok, none flagged (mergeable_state was still unknown on the first read; re-read at landing). Check-runs at e8c0f8ff6e: 39 success · 18 expected skip · 0 failed · 0 pending. Floor checks success. Dogfood not owed. Draft, base main, Fixes #39339 only.

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, ISharingService.checkDelete's allow is ownership plus write depth plus Modify All. With Modify All excluded (hasSuperuserWriteBypass), that allow is the owner half of ruling A's creator/owner term, so Layer 1 composes to a true OR term ([]). That reading holds in the code at security-plugin-rls-filter.ts (the new ownershipAllowAdmitsRow).

  • Only Layer 1 (the permissive OR) is emptied. Layer 0 tenant isolation is computed separately and AND-composed below, so the tenant wall is not touched.
  • Gated on dropPlatformOwnershipFloor (the authority already answered allow) and rlsOperation === 'delete'. Update keeps the floor (its allow carries edit shares and the queue). An object with no owner column gets no allow, so it keeps the creator floor (pinned).

Tests. New pin, 20 cases: by-id owner / manager / org-depth delete with security/explain agreeing first; strangers and the non-owner creator refused; Modify All unchanged; the no-owner-column object; predicate delete matches by-id row for row (ruling A); edit untouched. 9 red before the fix (pause note 7382216369), ablation at this head in the report 7397150541. The two rewritten pins (predicate-write-floor-deferral, delegated-write-never-exceeds-delegator) are in the claim's surface. Each rewrite cites ruling C. The rewrites flip exactly the owner-not-creator delete cells (BOB r3/r4, ALICE r2; delegator's own delete of an owned row). Update cells and the delegated refusal stay as they were.

Changeset (read sentence by sentence): patch @objectstack/plugin-security. The "owner deletes again" bullet matches the diff. The "Unchanged" bullet is accurate, including its sentence that a Modify All holder deletes "the records the policy admits and the ones they created, and no others".

Follow-ups owed (seat files, then rewrite the PR's Acceptance notes to filed #N):

  1. Modify All holder who OWNS a row loses to a plain owner. After this PR, a plain owner deletes their row beside an authored delete policy. A Modify All holder who owns the same row (and did not create it) is refused. Holding more permission now gives less. Before the PR both were refused. ADR-0066 ① keeps the bypass out, but ruling C says ownership decides delete, and that should not depend on also holding Modify All. This is a composition question (ADR-0066 ① × ruling C), so it goes to the decision inbox, not straight to a dev.
  2. Update has the same shape on private / public_read (code reading, not measured). The update allow carries edit shares and the queue, which neither ruling covers, so this is also a decision card.
    The delegated by-id delete keeping both floors is pre-existing and pinned, so no card is owed for it.

Not checked by me: whether an object with an authored select using and no delete policy (the select fallback at the top of the Layer 1 block) ever reaches the new branch with the floor removed. The pins cover delete policies only. Unlikely, since the write floor is not in the select set, so I am noting it rather than asking for rework.

Landing: non-governed, 422 lines, Clause-②: no (a widening, no narrowing arm), no L2 face touched. The zone lands once the follow-up cards are filed.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj

Landing: 2026-12-04T01:30Z · zone em-bill · head e8c0f8ff6e · L1-b ACCEPT 7397640060 · non-governed (422 lines, Clause-②: no, no L2 face) · follow-ups filed #39464, #39467 (Acceptance notes rewritten) · the maintainer chose 「落地 PR #39448」 in the zone thread · ready + auto-merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 4, 2026 01:30
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit 91f131b Dec 4, 2026
62 of 63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-39339-wip branch December 4, 2026 01:54
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/m 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.

Sharing: an authored delete policy refuses the owner of a row they did not create (ownership adds no rows beside the policy), against ruling C

2 participants