Commit 06c762e
fix(plugin-security): retire seven dead
* fix(plugin-security): retire seven dead `{ records }` find-result limbs, and stop the permission-set loader inventing an empty page
Six of the seven `Array.isArray(x) ? x : x.records` blocks in this plugin carried
an unreachable envelope limb over an engine `find()` result. The limb is removed
on a MEASUREMENT rather than on the declared type: `IDataEngine.find` says
`Promise<any[]>`, but a declared type is not proof here — this repo also carries
a `find()` that resolves a `QueryResult` envelope and never an array. A real
`ObjectQL` over a real `SqlDriver` was booted and each seam driven through the
shipped function that owns it; every one answered a bare array with no own
`records` key, on a populated page and an empty one alike.
Each of the six keeps its existing disposition for a non-array. Removing a dead
limb must not quietly convert a seam that gaps into one that invents an empty.
The seventh block is the opposite defect and is repaired in the opposite
direction. `SecurityPlugin`'s `sys_permission_set` loader swallowed a thrown read
into `[]` and mapped an unreadable result to `[]` too, so three distinct facts
left by one door. This is the enforcement plane: "no permission sets" silently
withdraws grants that exist while every request still looks normal, and the
swallow made `PermissionEvaluator.resolvePermissionSets`' own "db lookup failed"
warn unreachable — the diagnostic this repo had already built for exactly this
loss. The read fault now propagates and an unreadable page is refused with
`DATABASE_ERROR`; a page carrying a non-row refuses too, where the trailing
filter used to drop it in silence. Enforcement is unchanged in both directions —
an unanswered read still grants nothing — but it is now sayable.
Seven pins, one per block, each driving its own seam against the real engine.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
* test(plugin-security): route the pin's engine seam through the producer predicates, and re-anchor the rotted system-context rows
Two gate repairs on the #15598 pins, neither a behaviour change.
`check:engine-double-contract`: the pin file's `observed()` recorder forwards
every verb to a real `ObjectQL`, but a seam that merely forwards is exactly the
shape that reads as "not a double" and then admits a call the real engine would
refuse. Its `update`/`findOne`/`delete` now open with the producer's own
predicates (`assertEngineUpdateDispatch` / `assertEngineFindOnePredicate` /
`assertEngineDeleteDispatch` from `@objectstack/metadata-core`), and the ledger
learns about the newly pinned double — the ratchet grows, it is not weakened.
`check:system-context-census`: line rot, not a finding. The loader repair added
a net 66 lines to `security-plugin.ts` (77 added / 11 deleted), and every rotted
anchor the census reported was off by exactly 66. Repaired with the gate's own
`--fix`; only line numbers in `content/docs/permissions/system-context.mdx`
change, no prose.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
* docs(changeset): qualify the enforcement claim — unchanged on every reachable input, fail-closed on the two that are not
Clause-② review measured `PermissionEvaluator.resolvePermissionSets` through
this PR's own `dbLoaderFor(ORG)` over a real ObjectQL/SqlDriver, at HEAD and at
the merge-base blob, on five engine conditions. A healthy page, a thrown read
and `undefined` resolve identically before and after — every result the shipped
engine actually produces. An envelope and a page carrying a non-object element
do NOT: they granted at base and refuse at HEAD.
Both are fail-closed and both are unreachable on the measured engine, which is
what the eleven pins establish, so this is a declared narrowing rather than a
discovered move — but "unchanged in both directions" is an unqualified claim
about behaviour and it sits in the changeset, which feeds release notes. The
reviewer's wording replaces it verbatim.
⛔ No source change: the refusal itself was reviewed and passed exactly as it
stands. Changeset and PR body carry identical wording.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>{ records } find-result limbs, and stop the permission-set loader inventing an empty page (#15838)1 parent 924f0fe commit 06c762e
11 files changed
Lines changed: 671 additions & 36 deletions
File tree
- .changeset
- content/docs/permissions
- packages/plugins/plugin-security/src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
| |||
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
177 | 186 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
| 187 | + | |
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
| |||
0 commit comments