From dca1f17e8585b3eb953ba7928e05ac125594c575 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 15:17:34 +0000 Subject: [PATCH 1/2] docs(adr): ADR-0139 / ADR-0055 record the view-all unrestricted-reader chain drop Ruling record 6893666857 (the maintainer's re-ruling, replacing record 6893097935) lifts ADR-0139 D6's no-interim-removal prohibition for one reader class and nothing else: a reader who holds view-all on the detail AND whose every master hop answers unrestricted (the engine's per-hop scope), with a required master FK. Every other reader keeps the chain. - ADR-0139: a dated status-line entry, and a dated D6 paragraph carrying the ruling's binding bullets verbatim. D6's other prohibition (an interim with two spellings of one scope) stands. - ADR-0055: a status entry, a note under the 2026-10-22 entry, and in-place notes at section 2 and under "The rules the read keeps" of the 2026-11-06 amendment, so the rows-with-no-master rule reads as one statement. Append-only: insertions only, no existing line changed. Declares only; the code change is a separate card and by the ruling lands after this one. Claude-Session: https://claude.ai/code/session_01ADHkmPhSc3AHNRvPRkKRq8 Co-authored-by: Claude --- ...0055-master-detail-controlled-by-parent.md | 6 +++ ...rnal-semi-join-leaf-readable-parent-ids.md | 37 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/docs/adr/0055-master-detail-controlled-by-parent.md b/docs/adr/0055-master-detail-controlled-by-parent.md index 0bb36cf315a..3c6e3f4663f 100644 --- a/docs/adr/0055-master-detail-controlled-by-parent.md +++ b/docs/adr/0055-master-detail-controlled-by-parent.md @@ -3,11 +3,13 @@ **Status**: Accepted (2026-06-19) — implemented in this PR (P0–P2) · **Amended** (2026-09-07, #11082 / PR #11183 — the "Single-level only in v1" limit under Consequences and the "Transitive nested master-detail chains" **Non-goal** are both **reversed**: since `@objectstack/plugin-security` 17.3.0 (merged 2026-08-23) the read derivation and the write gate compose `controlled_by_parent` across a chain, bounded by a cycle guard and a cost ceiling that both fail **closed**. Nothing else in this record changes — §1–§4, the mechanism choice, the set-size limit and the share-table non-goal all stand. See **"Amendment (2026-09-07, #11082): transitive chains compose — the single-level non-goal is reversed"** at the end.) · **Revisited in part** (2026-10-10, [ADR-0139](./0139-engine-internal-semi-join-leaf-readable-parent-ids.md), Proposed) — §2's alternatives row (a) is reversed for ONE engine-internal, non-authorable leaf the engine composes from the compiler's output; the RLS compiler still has no subquery form, and §2's chosen mechanism (b), its `rlsMembership` IN-form and the set-size limit all stand. · **Amended** (2026-10-22, #24932, ruling B `6303721609` and Q1 C / Q2 A `6329027469`) — **§2's chosen mechanism (b) is retired for `controlled_by_parent`, and the set-size limit with it**: the read derivation (`packages/plugins/plugin-security/src/security-plugin.ts#computeControlledByParentFilter`) answers ADR-0139's `ReadableIds` leaf over the master, the engine composes it from this plugin's own `canReadObject` / `getReadFilter` of the master, and the driver compiles one statement with the master inside a subquery — the seventh consumer of that leaf, in the end-state form. No master id set is pre-resolved any more. The 2026-10-10 line above reads as of its date. What still stands: §1 (the one required `master_detail`), §3 (the write gate), the cycle guard and the depth bound (now the engine's own cut, judged first over the registry), and the RLS compiler's `rlsMembership` IN-form, which serves `current_user.` memberships and never served this derivation. The limit that replaces the set-size ceiling is ADR-0139 D5's two master shapes, which the boot refuses (#25144). +⚠️ **Amended 2026-11-15 (#33696, ruling `6893666857`)** — by that ruling the parent chain over a **required** master is dropped for one reader class, whose read then carries no master predicate and no master subquery; every other reader is answered as this line says. See the 2026-11-15 line below. · **Amended** (2026-10-26, #25760, ruling `6398566164`) — **§3 gains one per-object opt-in**: `sharing.controlledByParent.ownerMayEdit: true` lets the OWNER of a detail row (its `owner_id`) pass the write gate on a by-id `update` of that row with **read** access to the master; every other caller, and every insert, delete, predicate update and on-behalf-of write, keeps the master-**edit** rule. The default is unchanged. See **"Amendment (2026-10-26, #25760): the owner of a detail row may update it with read on the master, by opt-in"** at the end. ⚠️ **Amended 2026-11-14 (#33250 / PR #33369)** — that "every other caller … keeps the master-edit rule" no longer holds on a detail that declares the second opt-in, `writeRequiresMasterRead`: there every write asks **read** on the master. The two opt-ins are refused together. See the 2026-11-14 line below. · **Amended** (2026-10-27, #26591 / PR #26658) — **the 2026-10-26 amendment's Lint bullet is narrowed in place**: the lint prescribes the opt-in only for an `owner_id`-keyed `update` / `all` policy on a `controlled_by_parent` detail that carries `owner_id` and has not opted in; any other caller-keyed update policy is flagged in both states with the `owner_id` remedy, never the opt-in. The gate, the spec and the lint are unchanged by this note. See the note under **Lint** in "What the opt-in does, exactly". · **Amended** (2026-11-06, #30905, maintainer ruling 「A」) — **§1 admits an optional master and §2 gains a null-master arm**: a `controlled_by_parent` object whose only `master_detail` is declared `required: false` derives an OPTIONAL master. A detail row that names its master is read through it, unchanged; a row whose master reference is empty is read by its owner (`owner_id`) and by View All on the detail, through a second arm OR-ed with the master arm inside the one read chokepoint, `computeControlledByParentFilter`. §3 (the write gate) is unchanged by this note: a write that leaves the reference empty is still refused. ⚠️ **Amended 2026-11-07 (#30906 / PR #31082)** — that §3 sentence no longer holds; see the next line. See **"Amendment (2026-11-06, #30905): an optional master, and the null-master row its owner reads"** at the end. · **Amended** (2026-11-07, #30906 / PR #31082, the same ruling 「A」) — **§3 judges the null-master row by an owner rule**: a row of an optional master whose reference is empty is written by its owner (`owner_id`) and by Modify All on the detail, everyone else `403`; an insert naming no master is admitted; setting a master asks edit on it, emptying one asks edit on the stored master (the 2026-10-26 opt-in does not cover it); a chain hop with no master of its own ends the chain under the same rule. A required master is unchanged. See **"Amendment (2026-11-07, #30906): the null-master row its owner writes"** at the end. · **Amended** (2026-11-14, #33250 / PR #33369, ruling A+ `6880588685`) — **§3 gains a second per-object opt-in, and for the objects that declare it the 2026-10-26 amendment's "Option 2 … was not chosen" line is lifted**: `sharing.controlledByParent.writeRequiresMasterRead: true` makes **read** on the master the master question for every write of the detail (insert, update and delete, by id or by predicate, and the lifecycle verbs); the detail's own object permissions, row-level security, field-level security and the platform ownership floors decide the rest. The default is unchanged: a write's answer moves only if its own object, or a `controlled_by_parent` master on its chain, declares the key. See **"Amendment (2026-11-14, #33250): read on the master is enough to write, by opt-in"** at the end. +· **Amended** (2026-11-15, #33696, ruling 「只对管理员去掉」 `6893666857`) — **for one reader class the parent chain over a REQUIRED master is dropped, and that class alone reads that master's detail rows whose reference is empty or dangling**: a reader who holds View All on the detail AND whose every master hop answers unrestricted (the engine's per-hop scope, not `hasSuperuserReadBypass`) sees those rows — naming no master, or a master that does not exist — inside its own tenant wall. That is consistent with the 2026-11-06 ruling 「A」, whose reader of a row with no master, beside its owner, is View All on the detail. Every other reader, members included, keeps the chain unchanged. An optional master's two arms are outside the ruling, and §3 (the write gate) is not amended by this note. The ruling lifts ADR-0139 D6's ⛔ ("interim removal of the predicate for an unrestricted master scope") for that class only, and [ADR-0139](./0139-engine-internal-semi-join-leaf-readable-parent-ids.md) D6 as amended 2026-11-15 carries the ruling's binding bullets verbatim. This is the "ADR-0055's 10-22 note in step" the ruling orders, and it precedes the code: #33696's change lands only after it. See the note under **"The rules the read keeps"** in the 2026-11-06 amendment. **Deciders**: ObjectStack Protocol Architects **Builds on**: [ADR-0049](./0049-no-unenforced-security-properties.md) (enforce-or-remove), [ADR-0054](./0054-runtime-proof-for-authorable-surface.md) (prove-it-runs) **Surfaced by**: an audit of master-detail permission semantics — `OWDModel.controlled_by_parent` is **declared but unenforced** (zero runtime consumers; not reachable through the object's `sharingModel` enum; the RLS compiler is relationship-blind). This is *false compliance* (ADR-0049) and *unproven liveness* (ADR-0054). @@ -53,6 +55,8 @@ This composes with the detail's own tenant/owner RLS (all AND-ed) and flows to a ⚠️ **Amended 2026-11-06 (#30905, ruling A):** for an **optional** master (§1 as amended), the derivation is one `$or` of two arms that never share a row — the master arm (now ADR-0139's leaf, per the 2026-10-22 amendment) and a **null-master** arm for rows whose master reference is empty, read by the row's owner and by View All on the detail. The `$or` is the cbp layer's own answer, so it is still AND-ed under the tenant wall and beside the detail's own layers. A required master's derivation is unchanged. See the amendment at the end. +⚠️ **Amended 2026-11-15 (#33696, ruling `6893666857`):** for one reader class the read of a **required** master's detail no longer follows the master. For a reader who holds View All on the detail and whose every master hop answers unrestricted, the ruling drops the parent chain, so that reader also sees the rows whose master reference is empty or dangling. Every other reader keeps the chain. See the 2026-11-15 status line. + **Why this mechanism (trade-offs):** | Option | Verdict | Why | @@ -229,6 +233,8 @@ The ruling names **update**. So the leg does not reach: an **insert** (no row to - In a chain, an intermediate row whose own master is empty is read by its owner, and the next level's master arm sees exactly that: its leaf is composed with the intermediate level's own read scope, the `$or` included. - A caller who reads another master does not read the null-master rows they do not own. +⚠️ **Amended 2026-11-15 (#33696, ruling `6893666857`) — on a required master, the rows with no master gain one reader class.** The rules above are an **optional** master's, and they stand. A **required** master has no null-master arm: a detail row under it whose master reference is empty, or names a master that does not exist, matches no reader's master arm. By the ruling one class reads those rows, inside its own tenant wall: a reader who holds View All on the detail AND whose every master hop answers unrestricted (the engine's per-hop scope, not `hasSuperuserReadBypass`; a master scope that is the tenant wall is not unrestricted), for whom the parent chain is dropped. That is consistent with ruling 「A」, whose reader of a row with no master, beside its owner, is View All on the detail; on a required master the owner has no arm, and View All on the detail alone still "does not open the master arm". Every other reader, members included, keeps the chain unchanged. Where the 2026-11-06 amendment calls a required master unchanged ("byte-identical" under Read above, "byte for byte" under "What is unchanged" below), that reads as of its date for this one class. [ADR-0139](./0139-engine-internal-semi-join-leaf-readable-parent-ids.md) D6 as amended 2026-11-15 carries the ruling's binding bullets verbatim; the change is #33696's and lands only after this note. + ### Fail-closed boundaries - An omitted `required` on an object that reached the registry without the parse resolves no master (the runtime reads `required === false`, not its absence), so every read is denied, as before. diff --git a/docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md b/docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md index 8b07f7079e6..2ed60476c61 100644 --- a/docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md +++ b/docs/adr/0139-engine-internal-semi-join-leaf-readable-parent-ids.md @@ -17,6 +17,17 @@ Directive #14); the execution cards under [Execution plan](#execution-plan-after and ⛔ never before it. Until then the platform stayed in the ruling's letter D state, and letter C (a located 400 at the bound, after objectui#12081 item 8) is the `domain:services` lane's interim on [#22590](https://github.com/objectstack-ai/objectstack/issues/22590). +**Amended** (2026-11-15): D6's ⛔ on "interim removal of the predicate for an unrestricted master scope" +([#24932](https://github.com/objectstack-ai/objectstack/issues/24932) ruling B, item 4) is lifted **for one reader class +and nothing else** — a reader who holds view-all on the detail AND whose every master hop answers unrestricted (the +engine's per-hop scope, not `hasSuperuserReadBypass`), with a required master FK. For that reader the parent chain is +dropped, and it sees null and dangling-FK rows inside its own tenant wall; every other reader, members included, keeps +the chain unchanged, and D6's other ⛔ (an interim with two spellings of one scope) stands (the maintainer's re-ruling +「只对管理员去掉」, drop the chain for administrators only: ruling record +[`6893666857`](https://github.com/objectstack-ai/objectstack/issues/33696#issuecomment-6893666857) on +[#33696](https://github.com/objectstack-ai/objectstack/issues/33696)). D6 carries the ruling's binding bullets verbatim, +and ADR-0055 is noted in step, as the ruling orders. This amendment declares; #33696's change lands only after it +merges. **Decided by**: the maintainer, 「同意」 to the director seat's batch #312 item 2 (ruling [`6097072172`](https://github.com/objectstack-ai/objectstack/issues/22590#issuecomment-6097072172), 2026-10-10T11:34Z): **A is the end state, its first deliverable an ADR**; B (an unbounded `$in`) and a raised cap are ⛔ not taken. The @@ -298,6 +309,32 @@ an unrestricted master scope: it would expose rows with a null or dangling forei mechanism (b) therefore stands until the switch lands, and ADR-0055's own text moves only in that switch's edit, never here. +**Amended 2026-11-15 — the second of the two things above that the ruling ⛔ does not take is lifted for one reader +class and nothing else, by the maintainer's re-ruling 「只对管理员去掉」 (drop the chain for administrators only): +ruling record [`6893666857`](https://github.com/objectstack-ai/objectstack/issues/33696#issuecomment-6893666857) on +[#33696](https://github.com/objectstack-ai/objectstack/issues/33696), 2026-11-15T11:31Z, replacing record `6893097935`. +Its bullets that bind this record, verbatim:** + +> - The parent chain is dropped only for a reader who holds view-all on the detail AND whose every master hop answers +> unrestricted (the engine's per-hop scope, not `hasSuperuserReadBypass`), with a required master FK. That reader sees +> null and dangling-FK rows inside its own tenant wall, consistent with #30905 ruling A. Every other reader, members +> included, keeps the chain unchanged. +> - This deliberately lifts #24932 ruling B item 4 and ADR-0139 D6's ⛔ for that reader class only. **The PR must not +> land before the ADR-0139 status-line amendment** (citing this record; ADR-0055's 10-22 note in step) merges. That +> amendment is a docs/adr/** card for the skills lane, which the seat files. +> - Multi-tenant deployments: a tenant admin's master scope is the tenant wall, so it is not unrestricted. No speed-up +> there, by design; widening that is a separate decision. + +What moves is the second of those two things, item 4 of ruling `6303721609`, and only for the reader the first bullet +names, all three conditions together. A reader who meets part of them keeps the predicate: a member whose master hops +are unrestricted but who holds no view-all on the detail, and a holder of view-all on the detail with a restricted +master hop. The first (an interim with two spellings of one scope) stands as written. The 2026-10-21 sentence +"ADR-0055's own text moves only in that switch's edit, never here" kept ADR-0055 out of that edit and in the switch's, +its 2026-10-22 amendment; this edit does carry an ADR-0055 note, and the reason is the ruling's own order — "citing this +record; ADR-0055's 10-22 note in step". That note states the row rule beside ruling A of #30905. The record's two other +bullets (pins, a release note) bind the code card and are not restated here. This amendment implements nothing: the +change is #33696's, and by the ruling it lands only after this amendment merges. + ## Consequences - **Positive.** A reader gets every row they may see and a `total` that is true, on any table size; the pre-scan, From 0e1c1bca51d2d6639712b356381d955883211471 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 15:40:27 +0000 Subject: [PATCH 2/2] docs(adr): ADR-0055 note restates the full reader class Two of the lines this branch added to ADR-0055 are reworded; no base line changes and ADR-0139 is untouched. - The 2026-11-15 note in section 2 now names the whole reader class: the per-hop qualifier after "every master hop answers unrestricted", and "inside its own tenant wall" for the rows that reader sees. - The mark under the 2026-10-22 status entry states the rule (the parent chain is dropped for one reader class) and no longer describes the shape of a read. Claude-Session: https://claude.ai/code/session_01ADHkmPhSc3AHNRvPRkKRq8 Co-authored-by: Claude --- docs/adr/0055-master-detail-controlled-by-parent.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/adr/0055-master-detail-controlled-by-parent.md b/docs/adr/0055-master-detail-controlled-by-parent.md index 3c6e3f4663f..3f5b2d4a9c5 100644 --- a/docs/adr/0055-master-detail-controlled-by-parent.md +++ b/docs/adr/0055-master-detail-controlled-by-parent.md @@ -3,7 +3,7 @@ **Status**: Accepted (2026-06-19) — implemented in this PR (P0–P2) · **Amended** (2026-09-07, #11082 / PR #11183 — the "Single-level only in v1" limit under Consequences and the "Transitive nested master-detail chains" **Non-goal** are both **reversed**: since `@objectstack/plugin-security` 17.3.0 (merged 2026-08-23) the read derivation and the write gate compose `controlled_by_parent` across a chain, bounded by a cycle guard and a cost ceiling that both fail **closed**. Nothing else in this record changes — §1–§4, the mechanism choice, the set-size limit and the share-table non-goal all stand. See **"Amendment (2026-09-07, #11082): transitive chains compose — the single-level non-goal is reversed"** at the end.) · **Revisited in part** (2026-10-10, [ADR-0139](./0139-engine-internal-semi-join-leaf-readable-parent-ids.md), Proposed) — §2's alternatives row (a) is reversed for ONE engine-internal, non-authorable leaf the engine composes from the compiler's output; the RLS compiler still has no subquery form, and §2's chosen mechanism (b), its `rlsMembership` IN-form and the set-size limit all stand. · **Amended** (2026-10-22, #24932, ruling B `6303721609` and Q1 C / Q2 A `6329027469`) — **§2's chosen mechanism (b) is retired for `controlled_by_parent`, and the set-size limit with it**: the read derivation (`packages/plugins/plugin-security/src/security-plugin.ts#computeControlledByParentFilter`) answers ADR-0139's `ReadableIds` leaf over the master, the engine composes it from this plugin's own `canReadObject` / `getReadFilter` of the master, and the driver compiles one statement with the master inside a subquery — the seventh consumer of that leaf, in the end-state form. No master id set is pre-resolved any more. The 2026-10-10 line above reads as of its date. What still stands: §1 (the one required `master_detail`), §3 (the write gate), the cycle guard and the depth bound (now the engine's own cut, judged first over the registry), and the RLS compiler's `rlsMembership` IN-form, which serves `current_user.` memberships and never served this derivation. The limit that replaces the set-size ceiling is ADR-0139 D5's two master shapes, which the boot refuses (#25144). -⚠️ **Amended 2026-11-15 (#33696, ruling `6893666857`)** — by that ruling the parent chain over a **required** master is dropped for one reader class, whose read then carries no master predicate and no master subquery; every other reader is answered as this line says. See the 2026-11-15 line below. +⚠️ **Amended 2026-11-15 (#33696, ruling `6893666857`)** — by that ruling the parent chain over a **required** master is dropped for one reader class; every other reader is answered as this line says. See the 2026-11-15 line below. · **Amended** (2026-10-26, #25760, ruling `6398566164`) — **§3 gains one per-object opt-in**: `sharing.controlledByParent.ownerMayEdit: true` lets the OWNER of a detail row (its `owner_id`) pass the write gate on a by-id `update` of that row with **read** access to the master; every other caller, and every insert, delete, predicate update and on-behalf-of write, keeps the master-**edit** rule. The default is unchanged. See **"Amendment (2026-10-26, #25760): the owner of a detail row may update it with read on the master, by opt-in"** at the end. ⚠️ **Amended 2026-11-14 (#33250 / PR #33369)** — that "every other caller … keeps the master-edit rule" no longer holds on a detail that declares the second opt-in, `writeRequiresMasterRead`: there every write asks **read** on the master. The two opt-ins are refused together. See the 2026-11-14 line below. · **Amended** (2026-10-27, #26591 / PR #26658) — **the 2026-10-26 amendment's Lint bullet is narrowed in place**: the lint prescribes the opt-in only for an `owner_id`-keyed `update` / `all` policy on a `controlled_by_parent` detail that carries `owner_id` and has not opted in; any other caller-keyed update policy is flagged in both states with the `owner_id` remedy, never the opt-in. The gate, the spec and the lint are unchanged by this note. See the note under **Lint** in "What the opt-in does, exactly". · **Amended** (2026-11-06, #30905, maintainer ruling 「A」) — **§1 admits an optional master and §2 gains a null-master arm**: a `controlled_by_parent` object whose only `master_detail` is declared `required: false` derives an OPTIONAL master. A detail row that names its master is read through it, unchanged; a row whose master reference is empty is read by its owner (`owner_id`) and by View All on the detail, through a second arm OR-ed with the master arm inside the one read chokepoint, `computeControlledByParentFilter`. §3 (the write gate) is unchanged by this note: a write that leaves the reference empty is still refused. ⚠️ **Amended 2026-11-07 (#30906 / PR #31082)** — that §3 sentence no longer holds; see the next line. See **"Amendment (2026-11-06, #30905): an optional master, and the null-master row its owner reads"** at the end. @@ -55,7 +55,7 @@ This composes with the detail's own tenant/owner RLS (all AND-ed) and flows to a ⚠️ **Amended 2026-11-06 (#30905, ruling A):** for an **optional** master (§1 as amended), the derivation is one `$or` of two arms that never share a row — the master arm (now ADR-0139's leaf, per the 2026-10-22 amendment) and a **null-master** arm for rows whose master reference is empty, read by the row's owner and by View All on the detail. The `$or` is the cbp layer's own answer, so it is still AND-ed under the tenant wall and beside the detail's own layers. A required master's derivation is unchanged. See the amendment at the end. -⚠️ **Amended 2026-11-15 (#33696, ruling `6893666857`):** for one reader class the read of a **required** master's detail no longer follows the master. For a reader who holds View All on the detail and whose every master hop answers unrestricted, the ruling drops the parent chain, so that reader also sees the rows whose master reference is empty or dangling. Every other reader keeps the chain. See the 2026-11-15 status line. +⚠️ **Amended 2026-11-15 (#33696, ruling `6893666857`):** for one reader class the read of a **required** master's detail no longer follows the master. For a reader who holds View All on the detail and whose every master hop answers unrestricted (the engine's per-hop scope, not `hasSuperuserReadBypass`), the ruling drops the parent chain, so that reader also sees, inside its own tenant wall, the rows whose master reference is empty or dangling. Every other reader keeps the chain. See the 2026-11-15 status line. **Why this mechanism (trade-offs):**