From b1632a68b10f5f6e96855e4c6422b060b9413cc8 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 06:28:25 +0000 Subject: [PATCH 1/5] test(plugin-security): pin the Modify All owner's delete beside an authored delete policy (red) Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj Co-authored-by: Claude --- ...wner-beside-authored-delete-policy.test.ts | 80 ++++++++++++++----- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/packages/plugins/plugin-security/src/owner-beside-authored-delete-policy.test.ts b/packages/plugins/plugin-security/src/owner-beside-authored-delete-policy.test.ts index 090706a5a0f..8bf254daed9 100644 --- a/packages/plugins/plugin-security/src/owner-beside-authored-delete-policy.test.ts +++ b/packages/plugins/plugin-security/src/owner-beside-authored-delete-policy.test.ts @@ -20,6 +20,11 @@ * Modify All stays out of that OR (ADR-0066 ①: it does not lift an authored * write policy on a business object). * + * Ruling of record 7403225870 (route A): the owner term admits delete for + * every owner, Modify All holders included, and the Modify All bypass stays + * excluded. A Modify All holder therefore deletes the rows they own beside the + * authored policy, and still no row they neither own nor created. + * * One real stack, as `public-read-write-owner-delete.test.ts` builds it: an * `ObjectKernel` with `ObjectQLPlugin` over better-sqlite3, the real * `SecurityPlugin` (the real `member_default` floor) and the real @@ -163,7 +168,7 @@ function fixturePlugin(): Plugin { }; } -describe('an authored delete policy on an owned object: ownership admits the row beside it, Modify All does not', () => { +describe('an authored delete policy on an owned object: ownership admits the row beside it, the Modify All bypass does not', () => { let kernel: ObjectKernel; let ql: ObjectQL; let security: Required>; @@ -220,14 +225,17 @@ describe('an authored delete policy on an owned object: ownership admits the row }); describe('by id, on a row the authored policy does not admit: ownership deletes it', () => { - for (const [what, context] of [ - ['the owner (not the creator)', member(OWNER, REP.name)], - ['the manager above the owner (own_and_reports)', member(MANAGER, LEAD.name)], - ['a holder of write depth org, without Modify All', member(ORG_DEPTH, WIDE.name)], + for (const [what, context, owner] of [ + ['the owner (not the creator)', member(OWNER, REP.name), OWNER], + ['the manager above the owner (own_and_reports)', member(MANAGER, LEAD.name), OWNER], + ['a holder of write depth org, without Modify All', member(ORG_DEPTH, WIDE.name), OWNER], + // [ruling of record 7403225870] Holding Modify All takes nothing away + // from what owning the row gives. + ['a Modify All holder who owns the row (not the creator)', member(MODIFY_ALL, ADMIN.name), MODIFY_ALL], ] as const) { for (const object of [DEAL, SECRET]) { it(`${object}: ${what} deletes the row, and security/explain says so first`, async () => { - const id = await seed(object, OWNER, CREATOR); + const id = await seed(object, owner, CREATOR); expect(await explainDelete(object, id, context), 'explain agrees with the door').toBe(true); expect(await deleteById(object, id, context)).toEqual({ kind: 'landed' }); expect(await exists(object, id), 'the row is gone').toBe(false); @@ -256,6 +264,28 @@ describe('an authored delete policy on an owned object: ownership admits the row } }); + describe('by id: the Modify All bypass stays out of the OR beside the authored policy (ADR-0066 ①)', () => { + for (const object of [DEAL, SECRET]) { + it(`${object}: a Modify All holder who owns other rows is refused a row someone else owns`, async () => { + const mine = await seed(object, MODIFY_ALL, CREATOR); + const theirs = await seed(object, OWNER, CREATOR); + const context = member(MODIFY_ALL, ADMIN.name); + expect(await explainDelete(object, theirs, context), 'explain agrees with the door').toBe(false); + expect(await deleteById(object, theirs, context)).toMatchObject({ kind: 'refused', status: 403 }); + expect(await exists(object, theirs), 'the row stays').toBe(true); + expect(await exists(object, mine), 'nothing else moved').toBe(true); + }); + + it(`${object}: a Modify All holder is refused a row that has no owner, which only the bypass would admit`, async () => { + const id = await seed(object, null, CREATOR); + const context = member(MODIFY_ALL, ADMIN.name); + expect(await explainDelete(object, id, context), 'explain agrees with the door').toBe(false); + expect(await deleteById(object, id, context)).toMatchObject({ kind: 'refused', status: 403 }); + expect(await exists(object, id), 'the row stays').toBe(true); + }); + } + }); + it('unchanged: a Modify All holder who created a row it no longer owns deletes it through the creator term', async () => { const id = await seed(DEAL, OWNER, MODIFY_ALL); expect(await explainDelete(DEAL, id, member(MODIFY_ALL, ADMIN.name))).toBe(true); @@ -271,6 +301,14 @@ describe('an authored delete policy on an owned object: ownership admits the row expect(await deleteById(MEMO, closed, member(STRANGER, REP.name))).toEqual({ kind: 'landed' }); }); + it('an object with no owner column: a Modify All holder keeps the creator rule beside the authored policy', async () => { + const theirs = await seed(MEMO, null, CREATOR); + expect(await deleteById(MEMO, theirs, member(MODIFY_ALL, ADMIN.name))).toMatchObject({ kind: 'refused', status: 403 }); + expect(await exists(MEMO, theirs)).toBe(true); + const mine = await seed(MEMO, null, MODIFY_ALL); + expect(await deleteById(MEMO, mine, member(MODIFY_ALL, ADMIN.name))).toEqual({ kind: 'landed' }); + }); + describe('a predicate delete matches exactly the rows the by-id delete admits (ruling A)', () => { for (const object of [DEAL, SECRET]) { it(`${object}: the owner's predicate delete removes the row it owns and leaves the one it only created`, async () => { @@ -300,18 +338,24 @@ describe('an authored delete policy on an owned object: ownership admits the row expect(await exists(DEAL, other)).toBe(true); }); - it(`${DEAL}: a Modify All holder's predicate delete removes the closed row and the one it created, and no other`, async () => { - const closed = await seed(DEAL, OWNER, CREATOR, 'closed'); - const created = await seed(DEAL, OWNER, MODIFY_ALL, 'bulk'); - const other = await seed(DEAL, OWNER, CREATOR, 'bulk'); - const out = await outcomeOf(ql.delete(DEAL, { - where: { id: { $in: [closed, created, other] } }, multi: true, context: member(MODIFY_ALL, ADMIN.name), - } as never)); - expect(out).toEqual({ kind: 'landed' }); - expect(await exists(DEAL, closed)).toBe(false); - expect(await exists(DEAL, created)).toBe(false); - expect(await exists(DEAL, other), 'Modify All does not lift the authored policy').toBe(true); - }); + for (const object of [DEAL, SECRET]) { + it(`${object}: a Modify All holder's predicate delete removes the closed row, the one it created and the one it owns, and no other`, async () => { + const closed = await seed(object, OWNER, CREATOR, 'closed'); + const created = await seed(object, OWNER, MODIFY_ALL, 'bulk'); + const owned = await seed(object, MODIFY_ALL, CREATOR, 'bulk'); + const other = await seed(object, OWNER, CREATOR, 'bulk'); + const ownerless = await seed(object, null, CREATOR, 'bulk'); + const out = await outcomeOf(ql.delete(object, { + where: { id: { $in: [closed, created, owned, other, ownerless] } }, multi: true, context: member(MODIFY_ALL, ADMIN.name), + } as never)); + expect(out).toEqual({ kind: 'landed' }); + expect(await exists(object, closed)).toBe(false); + expect(await exists(object, created)).toBe(false); + expect(await exists(object, owned), 'the row it owns is gone, as by id').toBe(false); + expect(await exists(object, other), 'Modify All does not lift the authored policy').toBe(true); + expect(await exists(object, ownerless), 'nor admit a row that has no owner').toBe(true); + }); + } }); it('edit is untouched by this composition: the authored policy is delete-only, and every member edits the deal', async () => { From fbdf5c86d6d2da03db56c5a1b73bb8e51beeb651 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 06:31:28 +0000 Subject: [PATCH 2/5] fix(plugin-security): keep the Modify All holder's owner term beside an authored delete policy (by id) Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj Co-authored-by: Claude --- .../src/modify-all-owner-delete-term.ts | 82 +++++++++++++++++++ .../src/security-plugin-rls-filter.ts | 17 +++- 2 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 packages/plugins/plugin-security/src/modify-all-owner-delete-term.ts diff --git a/packages/plugins/plugin-security/src/modify-all-owner-delete-term.ts b/packages/plugins/plugin-security/src/modify-all-owner-delete-term.ts new file mode 100644 index 00000000000..3bb6173282d --- /dev/null +++ b/packages/plugins/plugin-security/src/modify-all-owner-delete-term.ts @@ -0,0 +1,82 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * [ruling of record 7403225870, route A] The owner term a Modify All holder + * keeps beside an app-authored DELETE row policy. + * + * Beside an authored delete policy the OR term the platform floor keeps is the + * creator/owner term (ruling of record 7063130499, A), and its owner half is + * the one the declared write authority's `allow` speaks for (ruling of record + * 7288570890, C). For a caller who holds no Modify All on the object that + * `allow` IS ownership, so it admits the row whole + * (`security-plugin-rls-filter.ts`, `ownershipAllowAdmitsRow`). For a Modify + * All holder it is not: the write depth the bit manufactures is `org`, which + * matches every owned row, and the authority answers its bypass `allow` on the + * rest, so admitting on it would lift the authored policy for every row, which + * ADR-0066 ① forbids. Until this module that holder kept the creator half + * alone, and the owner of a row they did not create was refused a delete a + * plain owner gets: holding more permission gave less. + * + * The ruling: the owner term admits delete for every owner, Modify All holders + * included, and the bypass stays excluded. So the term handed back here is the + * record's OWNER, read off the row, `owner_id == current_user.id`, and nothing + * the bit or the authority's `allow` adds: never a row with no owner (the + * bypass's own reach, `ISharingService.checkDelete` step 7), never a row of + * another owner. It joins the OR beside the floor's creator term and the + * authored terms, so it only ever adds the caller's own rows. + * + * What it does NOT carry: someone above the owner by write depth. A Modify All + * set declares no depth of its own (the spec refuses a `writeScope` beside + * `modifyAllRecords`), so a holder's depth apart from the bit is `own` unless a + * second set declares one, and reading that depth's owner set takes the + * hierarchy resolution that lives behind the sharing service. + * + * Asked only where the composition is about to keep the floor beside an + * authored term for a Modify All holder whose by-id delete the declared write + * authority answered `allow` (`dropPlatformOwnershipFloor`), which it does only + * on an object whose delete ownership decides (an owner column, a model that + * does not open delete, a principal, no on-behalf-of identity). The owner + * column must also be provable from the object's declaration: a federated + * object whose `owner_id` is only the platform's injected anchor has no owner a + * row can be matched on (`isOwnerAnchorUnprovable`), so no term is handed back + * there and the holder keeps the composition as it stood. + */ + +import type { RowLevelSecurityPolicy } from '@objectstack/spec/security'; +import { isOwnerAnchorUnprovable } from '@objectstack/spec/data'; + +/** The column the platform stamps a record's owner in. */ +const OWNER_FIELD = 'owner_id'; + +/** The owner half of the creator/owner term, as a row predicate. */ +export const MODIFY_ALL_OWNER_DELETE_PREDICATE = `${OWNER_FIELD} == current_user.id`; + +/** + * The name the term compiles under. Not a shipped policy: the floor's + * provenance test (`isPlatformOwnershipFloorPolicy`) never recognises it, so no + * floor replacement can take it out of the OR it was added to. + */ +export const MODIFY_ALL_OWNER_DELETE_TERM_NAME = 'platform_modify_all_owner_delete'; + +/** + * The owner term for `object`, or `null` where none applies. The caller has + * already decided the composition keeps the floor beside an authored term for + * a Modify All holder under an `allow`; this answers only whether the row can + * name its owner. + */ +export function modifyAllOwnerDeleteTerm( + object: string, + schema: unknown, + objectFields: ReadonlySet | undefined, +): RowLevelSecurityPolicy | null { + // A schema that cannot be read, or a field set that could not be loaded, + // proves no owner column: no term, the composition as it stood. + if (!schema || !objectFields || !objectFields.has(OWNER_FIELD)) return null; + if (isOwnerAnchorUnprovable(schema)) return null; + return { + name: MODIFY_ALL_OWNER_DELETE_TERM_NAME, + object, + operation: 'delete', + using: MODIFY_ALL_OWNER_DELETE_PREDICATE, + } as RowLevelSecurityPolicy; +} diff --git a/packages/plugins/plugin-security/src/security-plugin-rls-filter.ts b/packages/plugins/plugin-security/src/security-plugin-rls-filter.ts index 2b4ebae9c70..fec48dc3362 100644 --- a/packages/plugins/plugin-security/src/security-plugin-rls-filter.ts +++ b/packages/plugins/plugin-security/src/security-plugin-rls-filter.ts @@ -87,6 +87,7 @@ import { RESERVED_RLS_MEMBERSHIP_KEYS } from '@objectstack/spec/contracts'; import { isConfiguredPlatformAdminEmail, resolvePlatformAdminEmails } from '@objectstack/core'; import { RLS_DENY_FILTER, policyDeclaresClause } from './rls-compiler.js'; import { isPlatformOwnershipFloorPolicy } from './platform-ownership-policies.js'; +import { modifyAllOwnerDeleteTerm } from './modify-all-owner-delete-term.js'; import { rlsOperationForVerb } from './lifecycle-verb-rls-operation.js'; import { noteResolverStagedKeys, policiesReadCurrentUserKey, stageDeclaredMembershipKeys } from './object-membership-keys.js'; import { stageKernelQueues } from './kernel-queue-membership.js'; @@ -463,14 +464,24 @@ export async function computeLayeredRlsFilter( // The predicate write reaches the same answer per row: its floor // relief asks this composition with the floor replaced, finds it null, // and hands each row its by-id verdict (`predicateWriteFloorRelief`). - const ownershipAllowAdmitsRow = + // + // [ruling of record 7403225870, route A] The Modify All holder keeps the + // OWNER term, read off the row and nothing wider: the owner half the + // `allow` cannot speak for them is added to the OR beside the floor + // (`modify-all-owner-delete-term.ts`), and the bypass stays out. + const holdsModifyAllOnDelete = !!opts?.dropPlatformOwnershipFloor && rlsOperation === 'delete' && - !this.permissionEvaluator.hasSuperuserWriteBypass(object, permissionSets, { isPrivate: meta.isPrivate }); + this.permissionEvaluator.hasSuperuserWriteBypass(object, permissionSets, { isPrivate: meta.isPrivate }); + const ownershipAllowAdmitsRow = + !!opts?.dropPlatformOwnershipFloor && rlsOperation === 'delete' && !holdsModifyAllOnDelete; if (withoutFloor.length < collected.length) { const rest = fieldExistencePassOne(withoutFloor); if (rest.dropped > 0 || rest.compilable.some((p) => !!p.using)) { - allRlsPolicies = ownershipAllowAdmitsRow ? [] : collected; + const ownerTerm = holdsModifyAllOnDelete + ? modifyAllOwnerDeleteTerm(object, this.ql?.getSchema?.(object), objectFields) + : null; + allRlsPolicies = ownershipAllowAdmitsRow ? [] : ownerTerm ? [...collected, ownerTerm] : collected; } } if (allRlsPolicies.length > 0) { From d1c89790fba976c50e9588401d00ddecbe74e657 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 06:33:07 +0000 Subject: [PATCH 3/5] fix(plugin-security): accept the null field set the composition carries Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj Co-authored-by: Claude --- .../plugins/plugin-security/src/modify-all-owner-delete-term.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/plugin-security/src/modify-all-owner-delete-term.ts b/packages/plugins/plugin-security/src/modify-all-owner-delete-term.ts index 3bb6173282d..14edcadf290 100644 --- a/packages/plugins/plugin-security/src/modify-all-owner-delete-term.ts +++ b/packages/plugins/plugin-security/src/modify-all-owner-delete-term.ts @@ -67,7 +67,7 @@ export const MODIFY_ALL_OWNER_DELETE_TERM_NAME = 'platform_modify_all_owner_dele export function modifyAllOwnerDeleteTerm( object: string, schema: unknown, - objectFields: ReadonlySet | undefined, + objectFields: ReadonlySet | null | undefined, ): RowLevelSecurityPolicy | null { // A schema that cannot be read, or a field set that could not be loaded, // proves no owner column: no term, the composition as it stood. From 5ed02225079ae59431c737b5cb5f3dd38de70e58 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 08:08:55 +0000 Subject: [PATCH 4/5] fix(plugin-security): a predicate delete asks the rows the Modify All holder's owner term admits Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj Co-authored-by: Claude --- .../src/security-plugin-authz-middleware.ts | 54 +++++++++++++++---- .../src/security-plugin-rls-filter.ts | 4 +- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts b/packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts index 486cbd8a0a1..14b2653ed18 100644 --- a/packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts +++ b/packages/plugins/plugin-security/src/security-plugin-authz-middleware.ts @@ -3193,13 +3193,17 @@ export function idsOfReadableScope(scope: Record): (string | nu * 1. The floor must be in play for this write class at all (the provenance * test {@link resolvePreImageFloorDrop} applies). If not, `null`. * 2. The Layer 1 the by-id write of a row composes once its floor is - * replaced: `computeLayeredRlsFilter` with `dropPlatformOwnershipFloor`. - * If that is not `null`, an authored write-class policy remains, and - * `null` is answered with no verdict asked. Policies compose by `$or` only - * (`rls-compiler.ts`), and a replacement keeps the floor's term in an OR - * an authored term stands in ([#35917]), so the by-id write of every - * matched row is held to `floored` itself: replacing the floor adds no - * row there and removes none, so nothing is asked. + * replaced (`replaced`): `computeLayeredRlsFilter` with + * `dropPlatformOwnershipFloor`. `null` where the floor was the OR's last + * term. Where an authored write-class policy remains, a replacement keeps + * the floor's term in the OR the authored term stands in ([#35917]), so + * `replaced` is the same tree as `floored` and `null` is answered with no + * verdict asked: replacing the floor adds no row there and removes none. + * [ruling of record 7403225870, route A] The one composition where the + * two differ is a Modify All holder's delete beside an authored delete + * policy: `replaced` there carries the holder's owner term beside the + * floor (`modify-all-owner-delete-term.ts`), which the by-id write of an + * owned row is admitted by, so step 4 asks it. * 3. The rows `floored` already admits are read once, under the caller's * context, and set aside: they are matched today whatever any verdict says, * so nothing is asked about them and the check they are held to does not @@ -3207,11 +3211,14 @@ export function idsOfReadableScope(scope: Record): (string | nu * than the floor when the question could not be asked. * 4. Every other matched row gets the by-id decision for that row, * {@link predicateWriteFloorDropIds} — `resolvePreImageFloorDrop` itself. + * Where `replaced` is not `null`, the by-id write of a row whose floor is + * replaced is still held to `replaced`, so only the rows `replaced` admits + * (one more read, under the caller's context, refused ⇒ `null`) are asked. * * The answer is `floored OR id IN dropIds`. It only ever adds rows to * `floored`, and each row it adds is one the by-id pre-image gate admits for - * the same caller: the floor is the only Layer 1 term the by-id write of it - * would have been held to, and its verdict replaced it. The sharing + * the same caller: its verdict replaced the floor, and the Layer 1 the by-id + * write of it is then held to (`replaced`, or none) admits it. The sharing * middleware's own bulk scope (the owner/depth set, the `edit` shares and the * queue on update only) is ANDed in by that middleware as before, and the * readable scope beside this one still binds. @@ -3238,13 +3245,18 @@ async function predicateWriteFloorRelief( dropPlatformOwnershipFloor: true, }) ).layer1; - if (replaced) return null; // A fresh compile for the read, so nothing the read pipeline does to its // own query reaches the tree the write runs with. Marked `'policy'` like the // by-id re-read's: the read's caller-predicate guard judges `{ id }`, not a // row-level predicate on a field the caller may not query. const probe = (await this.computeLayeredRlsFilter(permissionSets, opCtx.object, opCtx.operation, opCtx.context)).layer1; if (!probe) return null; + // Step 2: an authored term remains and the replacement changed nothing, so + // no row's by-id write is held to anything but `floored`. Compared as the + // compiled trees: both come from the same compile of the same inputs, so an + // unchanged collection is the same tree. A spurious difference only costs + // the step-4 read, whose answer stays the by-id one. + if (replaced && JSON.stringify(replaced) === JSON.stringify(probe)) return null; const admitted = await readUnlessRefused(() => this.ql.find(opCtx.object, { where: { $and: [{ id: { $in: [...readableIds] } }, markFilterSubtreeProvenance({ $and: [probe] }, 'policy')] }, @@ -3261,8 +3273,28 @@ async function predicateWriteFloorRelief( ); // A falsy id is no row address (`resolveEngineUpdateDispatch`), so it is // never one the floor is replaced for. - const candidates = readableIds.filter((id) => !!id && !admittedIds.has(id)); + let candidates = readableIds.filter((id) => !!id && !admittedIds.has(id)); if (candidates.length === 0) return null; + // Step 4's bound where the floor's replacement leaves a Layer 1: the rows it + // admits, and no other, can be admitted by their by-id verdict. + if (replaced) { + const reach = await readUnlessRefused(() => + this.ql.find(opCtx.object, { + where: { $and: [{ id: { $in: [...candidates] } }, markFilterSubtreeProvenance({ $and: [replaced] }, 'policy')] }, + fields: ['id'], + limit: candidates.length + 1, + context: withoutOperationPrivateKeys((opCtx.context ?? {}) as Record), + }), + ); + if (reach.refused) return null; + const reached = new Set( + (Array.isArray(reach.value) ? reach.value : []).map((r: unknown) => + r && typeof r === 'object' ? (r as { id?: unknown }).id : undefined, + ), + ); + candidates = candidates.filter((id) => reached.has(id)); + if (candidates.length === 0) return null; + } const dropIds = await predicateWriteFloorDropIds.call( this, rlsOperation, diff --git a/packages/plugins/plugin-security/src/security-plugin-rls-filter.ts b/packages/plugins/plugin-security/src/security-plugin-rls-filter.ts index fec48dc3362..091abef15f8 100644 --- a/packages/plugins/plugin-security/src/security-plugin-rls-filter.ts +++ b/packages/plugins/plugin-security/src/security-plugin-rls-filter.ts @@ -468,7 +468,9 @@ export async function computeLayeredRlsFilter( // [ruling of record 7403225870, route A] The Modify All holder keeps the // OWNER term, read off the row and nothing wider: the owner half the // `allow` cannot speak for them is added to the OR beside the floor - // (`modify-all-owner-delete-term.ts`), and the bypass stays out. + // (`modify-all-owner-delete-term.ts`), and the bypass stays out. The + // predicate write asks each matched row this composition admits for its + // by-id verdict (`predicateWriteFloorRelief`, step 4). const holdsModifyAllOnDelete = !!opts?.dropPlatformOwnershipFloor && rlsOperation === 'delete' && From 6e344f2e9cfa88981e6c7f934e2cd29c44f6d186 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 08:19:52 +0000 Subject: [PATCH 5/5] chore(changeset): the Modify All holder's owner delete, and the corrected #39339 sentence Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj Co-authored-by: Claude --- .changeset/39339-owner-beside-delete-policy.md | 2 +- .changeset/39464-modify-all-owner-delete.md | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/39464-modify-all-owner-delete.md diff --git a/.changeset/39339-owner-beside-delete-policy.md b/.changeset/39339-owner-beside-delete-policy.md index 8d9a7b4977e..e99f844adc1 100644 --- a/.changeset/39339-owner-beside-delete-policy.md +++ b/.changeset/39339-owner-beside-delete-policy.md @@ -10,4 +10,4 @@ Metadata-protocol: none Who sees it: an app that authors a row-level `delete` policy (for example "anyone may delete a closed deal") on an object with an owner column (`owner_id`), on `private`, `public_read` and `public_read_write` objects alike. - **The record's owner deletes it again.** Before, beside such a policy the platform's own row gate admitted only the person who created the record, so the owner of a record they did not type in (assigned to them, imported, handed over) was refused with 403 on every record the policy does not admit: a rule written to let more people delete took the delete away from owners. Now the owner, someone above the owner by write depth (`writeScope`), and a holder of write depth `org` delete it, as they do on an object with no authored delete policy. A by-id delete and a predicate (bulk) delete reach the same records, and `security/explain` agrees. -- **Unchanged:** Modify All (`modifyAllRecords`) still does not lift an authored delete policy on a business object, so its holder deletes the records the policy admits and the ones they created, and no others. A creator who no longer owns a record is still refused unless the policy admits it. An object with no owner column keeps the creator rule. Edit (update) is not changed by this release. +- **Unchanged:** Modify All (`modifyAllRecords`) still does not lift an authored delete policy on a business object, so its holder deletes the records the policy admits, the ones they created and the ones they own, and no others. A creator who no longer owns a record is still refused unless the policy admits it. An object with no owner column keeps the creator rule. Edit (update) is not changed by this release. diff --git a/.changeset/39464-modify-all-owner-delete.md b/.changeset/39464-modify-all-owner-delete.md new file mode 100644 index 00000000000..08a0cb52362 --- /dev/null +++ b/.changeset/39464-modify-all-owner-delete.md @@ -0,0 +1,13 @@ +--- +'@objectstack/plugin-security': patch +--- + +fix(security): a Modify All holder deletes the records they own beside an app's own delete rule, as any owner does + +Clause-②: no +Metadata-protocol: none + +Who sees it: an app that authors a row-level `delete` policy (for example "anyone may delete a closed deal") on an object with an owner column (`owner_id`), and a user who holds Modify All (`modifyAllRecords`) on that object, typically a manager. + +- **Holding Modify All no longer takes a delete away from an owner.** Before, beside such a policy a Modify All holder was refused (403) a record assigned to them that someone else entered, while a plain owner in the same position deleted it. Now the Modify All holder deletes the records they own as well, by id and by a predicate (bulk) delete alike, and `security/explain` agrees. +- **Unchanged:** Modify All itself still does not lift an authored delete policy on a business object. Its holder deletes the records the policy admits, the ones they created and the ones they own, and no others: a record of another owner, or one with no owner, stays refused. An object with no owner column keeps the creator rule. Edit (update) is not changed by this release.