From d0c4a985ff1a998468ada97f13e14c03d2412ecf Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 22:43:52 +0000 Subject: [PATCH] docs(permissions): under record sharing a predicate write is bounded by the write scope rls.mdx and permissions-matrix.mdx said a predicate (multi: true) update or delete reaches every row the caller can read, which an app update widener then admits. With record sharing composed, a predicate write is bounded by the caller's write scope (owner depth, queue, and edit shares for an update), so a row held only through a read share is left unwritten with no error; addressing it by id alone writes it. The v17.2 migration row that prescribes the multi: true form now says so and points at the by-id remedy. Claude-Session: https://claude.ai/code/session_01ADHkmRfW5u1LRmhWwaYHRp Co-authored-by: Claude --- content/docs/permissions/permissions-matrix.mdx | 2 +- content/docs/permissions/rls.mdx | 14 ++++++++++++++ content/docs/releases/v17/17-2.mdx | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/content/docs/permissions/permissions-matrix.mdx b/content/docs/permissions/permissions-matrix.mdx index 8da9870677c..46b5d8798eb 100644 --- a/content/docs/permissions/permissions-matrix.mdx +++ b/content/docs/permissions/permissions-matrix.mdx @@ -370,7 +370,7 @@ flowchart TD | 7 | **Field-Level Security** | Which fields is the user allowed to see/edit? | -**Performance:** For reads, steps 2–6 are compiled into a query filter (owner-match ∪ materialized shares, AND-ed with RLS) at query time, not evaluated record-by-record. By-id writes are verified with a pre-image check: the target row is re-read through the write-scope filter before the mutation, and a row the caller cannot read answers exactly what a missing id answers (`404 RECORD_NOT_FOUND`). A predicate (`multi: true`) update or delete matches only the rows the caller can read: a row the read door would not return is not written, not counted and not refused, and above 10 000 such rows the write is refused (`400 INVALID_FILTER`) rather than narrowed by a cut-off list. A caller whose read of the object is refused writes none of its records: its by-id and predicate updates and deletes are refused, whatever rows they address. This keeps security checks efficient even on tables with millions of rows. +**Performance:** For reads, steps 2–6 are compiled into a query filter (owner-match ∪ materialized shares, AND-ed with RLS) at query time, not evaluated record-by-record. By-id writes are verified with a pre-image check: the target row is re-read through the write-scope filter before the mutation, and a row the caller cannot read answers exactly what a missing id answers (`404 RECORD_NOT_FOUND`). A predicate (`multi: true`) update or delete matches only the rows the caller can read: a row the read door would not return is not written, not counted and not refused, and above 10 000 such rows the write is refused (`400 INVALID_FILTER`) rather than narrowed by a cut-off list. Under record sharing it is bounded further, by the rows the caller may write (owner depth and queue, plus edit shares for an update; a share never grants delete, ADR-0111 D3): a row the caller can only read through a read share is not written by a predicate write, even when an app `update` widener admits it, and the write answers no error; address that row by id alone to write it. A caller whose read of the object is refused writes none of its records: its by-id and predicate updates and deletes are refused, whatever rows they address. This keeps security checks efficient even on tables with millions of rows. ## See also diff --git a/content/docs/permissions/rls.mdx b/content/docs/permissions/rls.mdx index 65a70b6ac54..ec9bfc2149a 100644 --- a/content/docs/permissions/rls.mdx +++ b/content/docs/permissions/rls.mdx @@ -100,6 +100,20 @@ records, their access depth and the records shared with them, so an `update` widener reaches **only rows the caller can already read**; everything else it admits by predicate is still refused. +**Under record sharing, a predicate write is bounded by the write scope, not +the read scope.** When record sharing is composed (`@objectstack/plugin-sharing`), +a predicate (`multi: true`) `update` / `delete` on a `private` object writes only +the rows the caller may **write**: their own records, their access depth and +queue membership, plus **edit** shares for an `update` (a share never grants +`delete`, ADR-0111 D3). A row the caller holds only through +a **read** share is readable, and an app `update` widener admits it, but a +predicate write does not reach it: the row is left as it was and the write +answers no error. To write such a row, address it **by id alone** +(`where: { id }`, or the payload `id`): a by-id write is judged by id, and the +widener admits it as written. A `where` that carries a scalar `id` **beside +other keys** under `multi: true`, and an `id` that is falsy (`''`, `0`), run as +predicate writes and meet the same bound. + **Known limitation — an app-authored write widener does nothing on a `private` object without a matching read grant.** To let a position edit diff --git a/content/docs/releases/v17/17-2.mdx b/content/docs/releases/v17/17-2.mdx index 906747babb4..cd5b32d2ddd 100644 --- a/content/docs/releases/v17/17-2.mdx +++ b/content/docs/releases/v17/17-2.mdx @@ -108,7 +108,7 @@ an intent decision no codemod may make for you: | You wrote | Decide | | :--- | :--- | -| `{ where: { id, …other } }` without `multi` | declare `multi: true` so the full `where` is honoured (the result becomes the matched count), or drop the extra `where` keys to keep an unconditional single-row write | +| `{ where: { id, …other } }` without `multi` | declare `multi: true` so the full `where` is honoured (the result becomes the matched count), or drop the extra `where` keys to keep an unconditional single-row write. Under record sharing the `multi: true` form is a predicate write, bounded by the caller's write scope: a row the caller holds only through a read share, admitted by an app `update` widener, is left unwritten with no error. To write that row, address it by id alone (`where: { id }`) ([details](/docs/permissions/rls)) | | `data.id` ≠ `where.id` | make the two ids equal (or drop `where.id`) to address the row by the payload id, or remove `id` from the payload to address it by `where.id` | ⚠️ **Flow authors reach this through `update_record` / `delete_record` nodes**