Commit 504c8d5
fix(security,sharing): materialize the RBAC catalog per organization (#11121)
* fix(security,sharing): materialize the RBAC catalog per organization (#10103)
On a walled posture every principal listed ZERO positions, permission sets and
sharing rules while the tables held rows: Layer 0's strict
`organization_id = :tenant` AND-composes over the driver's
`(organization_id = :tenant OR organization_id IS NULL)`, and the conjunction is
the strict equality alone. The rows were all organization-less.
The wall is untouched at both layers. The rows get an owner:
- the four declared/built-in seeders upsert by `(name, organization_id)` and run
one pass per organization under a walled posture, built-ins included;
- seeding also fires on organization creation, not only at `kernel:ready`;
- `single` posture keeps exactly one organization-less pass.
Nothing is reaped — grants point at these rows by id. A per-organization pass
that meets pre-fix organization-less rows warns loudly, naming the rows and the
remedy, and still creates the organization's own copies. That closes the silent
no-op where a tenant-threaded pass saw the old row through the driver's
compatibility arm and created nothing.
The enforcement-plane reads that only become exposures once copies exist are
scoped in the same landing: `resolve-authz-context`'s section 6a name-sweep
(packages/core) and plugin-security's permission-set dbLoader, whose `limit` was
also a truncation once several organizations hold a row per name.
Boot reconciliation is O(changed declarations); steady state rides the
organization-creation hook.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
* test(security): pin the per-organization catalog seam through the producer's update dispatch
`check:engine-double-contract` reads the suite's registry-facing seam as an
engine double: it declares update() (and previously delete()) alongside engine
siblings, and a delegating pass-through wrapping a real engine is exactly the
shape that reads as "not a double" and then admits a call the real engine would
reject.
- update() now opens with `assertEngineUpdateDispatch(data, options)` from
@objectstack/metadata-core, the producer's own predicate;
- delete() is dropped entirely — none of the three seeders deletes, so the seam
no longer makes a contract nothing exercises.
The ledger movement is the TIGHTENING one: one row added to
`engine-double-contract.pinned.json` recording new pinned coverage, written by
the gate's own `--write`. The shrink-only `engine-double-contract.baseline.json`
is untouched — no measured exemption was added.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
* refactor(security): one spelling of "which catalog row is mine" across the merge
The batched seed existence read (#10946) and the per-organization catalog
(#10103) landed independently and each grew a resolution for the same question.
Two implementations of one question is the shape that produced the defect this
scoping repairs, so `seed-name-lookup.ts` now delegates to
`resolveOwnOrganizationRow` and only translates its answer into the module's
present/absent tri-state.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 5fdd463 commit 504c8d5
14 files changed
Lines changed: 1525 additions & 149 deletions
File tree
- .changeset
- packages
- core/src/security
- plugins
- plugin-security/src
- plugin-sharing/src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
122 | 136 | | |
123 | 137 | | |
124 | | - | |
| 138 | + | |
| 139 | + | |
125 | 140 | | |
126 | 141 | | |
127 | 142 | | |
| |||
462 | 477 | | |
463 | 478 | | |
464 | 479 | | |
465 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
466 | 505 | | |
467 | 506 | | |
468 | 507 | | |
| |||
Lines changed: 61 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
19 | 35 | | |
20 | 36 | | |
21 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
22 | 44 | | |
23 | 45 | | |
24 | 46 | | |
| |||
39 | 61 | | |
40 | 62 | | |
41 | 63 | | |
42 | | - | |
43 | | - | |
44 | 64 | | |
45 | 65 | | |
46 | 66 | | |
47 | 67 | | |
48 | 68 | | |
49 | 69 | | |
50 | | - | |
| 70 | + | |
51 | 71 | | |
52 | | - | |
| 72 | + | |
53 | 73 | | |
54 | 74 | | |
55 | 75 | | |
56 | | - | |
57 | | - | |
| 76 | + | |
| 77 | + | |
58 | 78 | | |
59 | | - | |
60 | | - | |
| 79 | + | |
| 80 | + | |
61 | 81 | | |
62 | 82 | | |
63 | 83 | | |
64 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
65 | 90 | | |
66 | 91 | | |
67 | 92 | | |
| |||
71 | 96 | | |
72 | 97 | | |
73 | 98 | | |
| 99 | + | |
74 | 100 | | |
75 | 101 | | |
| 102 | + | |
| 103 | + | |
76 | 104 | | |
77 | 105 | | |
78 | 106 | | |
| |||
82 | 110 | | |
83 | 111 | | |
84 | 112 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
88 | 125 | | |
89 | 126 | | |
90 | 127 | | |
91 | | - | |
| 128 | + | |
92 | 129 | | |
93 | 130 | | |
94 | 131 | | |
95 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
96 | 140 | | |
97 | 141 | | |
0 commit comments