You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e7396e1
Browse filesBrowse the repository at this point in the historyBrowse files
feat(metadata): a read-only count of the history snapshots the drained-key scrub would rewrite
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
`@objectstack/metadata/migrations` gains `scrubHistoryDrainedKeys(driver, { mode: 'count' })`, the count mode of a one-time scrub of `sys_metadata_history` snapshots written before history started withholding what a connector save drains (undeclared `auth` keys).
11
+
12
+
-**One predicate.** A stored snapshot is counted exactly when `historySnapshotBody` — the helper both history writers already store through — would store a different body for it today. Nothing in the count names a key or a type, so the count and the write-time withholding cannot disagree, and a snapshot written since that withholding landed is never counted.
13
+
-**Read-only.** It takes a driver's `find` and nothing else, pages the table by primary key, and reports the number of affected rows, the number of distinct items they belong to, and the affected rows' ids as opaque handles. A body that is not JSON, or one the snapshot helper cannot reduce, is listed beside the count, never folded into it. The result never carries a key name, a value or a body.
14
+
-**Count only.** Any other mode is refused before anything is read. The rewrite of stored history runs only after the maintainer confirms the count; run the count on a copy of the database and hand its numbers over privately.
feat(plugin-auth): an SSO sign-in grants the ordinary permission set its IdP group is mapped to
7
+
8
+
Clause-②: yes (widening)
9
+
Metadata-protocol: none
10
+
11
+
An enterprise SSO provider (OIDC or SAML, through `@better-auth/sso`) can now drive what its users may do from the groups the identity provider sends at sign-in, through the same `sys_idp_group_mapping` mappings a SCIM connection uses. There is no second mapping model.
12
+
13
+
-**Where the groups come from.** Set the provider's own claim mapping to fill `groups`: `mapping.extraFields: { groups: 'groups' }` for an OIDC claim named `groups`, or the attribute name an IdP uses for SAML (for example Entra ID's groups claim URI). The value may be one string or a list of strings. A provider whose mapping fills no `groups` behaves as before.
14
+
-**Saving a mapping.**`POST /api/v1/auth/admin/scim/set-group-mapping` now also takes `providerId` in place of `connectionId` (exactly one of the two; both is `400 VALIDATION_FAILED` on `providerId`). The grant's organization is the provider's own `organization_id`; a provider that names none, or an unknown provider, is refused `400 VALIDATION_FAILED` on `providerId`. With SSO off the save is refused `503`. The same platform-admin gate and the same organization-boundary judgement apply: administrator sets and every set outside the organization boundary are refused, and without a security service the save is refused `503`. The row is stored with `source_kind: 'sso'` (a new option on `sys_idp_group_mapping.source_kind`) and `source_id` = the provider id.
15
+
-**At each sign-in.** Every sign-in through the provider matches each group value against the provider's mappings (by `groupExternalId` when the mapping names one, which suits Entra ID's group object ids, else by exact `groupDisplayName`) and makes the user's grants follow them: a mapped group grants its set in the provider's organization, and a group the user has left loses the set at their next sign-in. A sign-in with no groups removes the grants that provider made earlier. The boundary is asked again before every grant, so a set that becomes an administrator set after its mapping was saved grants nothing, and with no security service nothing is granted. Only grants the provider made (their `reason` names the provider) are ever removed: a grant made by hand, or by SCIM, is never touched. Every write goes through the engine, so the break-glass last-administrator guard still refuses what it refuses elsewhere. If applying the mappings fails, the sign-in still succeeds and the failure is logged at `error`.
16
+
-**Deleting a mapping.**`POST /api/v1/auth/admin/scim/delete-group-mapping` removes an SSO mapping and, at once, the grants its provider made of that set in that organization, unless another of the provider's mappings still names that set (then each user's next sign-in decides).
fix(metadata-protocol): a tenant's edit follows its item across the packages of one App
6
+
7
+
Clause-②: no — no accept set changes; the lookup scope widens only within one suite (triage 6724363147)
8
+
Metadata-protocol: none
9
+
10
+
When a later version of an App moves an item from one of its packages to another (an ADR-0130 D4 suite split such as a flat App becoming an App plus modules, or the rollback of one), the item's reads no longer drop the tenant's edit of it. Before, the edit was still stored and every read served the vendor's item: the reads looked for the edit under the package that ships the item now, and the edit names the package that shipped it at the time of the edit.
11
+
12
+
-**What follows.** The App pair's (`<app>.custom`) declared override whose `overrides.package` names a former owner of the item, and a row bound to the former owner itself (a Regime O save stored before ADR-0146 D11 closed saves naming the read-only base). Each is served at the package that ships the item now, by name (with and without `?package=`), in the list and as the layered read's `effective`.
13
+
-**Same App, read from the install record.** Two installed packages are of one App when `appOf` answers the same App for both over the registry's installed manifests. When the former owner is no longer installed (a rollback), the record is the row's binding to the App's pair, which the save door admits only for a package of that App. Never an id or name prefix.
14
+
-**What never follows.** A row bound to, or declaring, a package of another App; a row of another App's pair; a row whose former owner still ships the item (it stays that package's edit); an `object` (it takes no tenant overlay, `ITEM_LOCKED`); and, between two former owners' rows, neither.
15
+
-**Nothing is written.** The row keeps its binding and body, so a rollback needs no reverse step; the next save of the item writes the current owner's address, as every save does.
Copy file name to clipboardExpand all lines: content/docs/permissions/tenant-audit-census.mdx
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ are reported as `undecidable` rather than assumed either way.
132
132
133
133
The same holds twice over for the context. An options argument spelled as a
134
134
literal can be read; one spelled `options`, `{ ...opts }`, or handed through a
135
-
forwarding shim cannot, and **57 of the 275 sites are spelled that way**. A
135
+
forwarding shim cannot, and **57 of the 276 sites are spelled that way**. A
136
136
context resolved from an inline literal or a local `const` can be tested for
137
137
`isSystem`; one arriving from a helper call cannot.
138
138
@@ -197,10 +197,10 @@ reproduce them. Where it disagrees, it disagrees on the page:
197
197
198
198
| carried figure | where it survives | this census |
199
199
| :--- | :--- | ---: |
200
-
| 175 write call sites | quoted in the merged changeset |**275**|
200
+
| 175 write call sites | quoted in the merged changeset |**276**|
201
201
| 24 carrying no tenant context | quoted in the merged changeset |**3** provable and tenancy-enabled; **30** more whose options argument is unreadable |
202
-
| 127 of 175 statically decidable, 48 runtime-parameter-name sites | restated on the `isSystem`-scoping card |**195 of 275** decidable, **80** undecidable |
203
-
| 135 (77%) silenced by the `isSystem` guard before the posture gate | the lost issue body — **no surviving corroboration**|**not reproduced**: 152 decidably elevated, 0 decidably not, 113 undecidable |
202
+
| 127 of 175 statically decidable, 48 runtime-parameter-name sites | restated on the `isSystem`-scoping card |**196 of 276** decidable, **80** undecidable |
203
+
| 135 (77%) silenced by the `isSystem` guard before the posture gate | the lost issue body — **no surviving corroboration**|**not reproduced**: 153 decidably elevated, 0 decidably not, 113 undecidable |
204
204
| 141 and 132, two independent re-derivations | the card that filed this work | — |
205
205
206
206
**The differences are not reconciled, and deliberately so.** The old census's
@@ -211,17 +211,17 @@ at any commit.
211
211
212
212
Two structural facts do plausibly widen this reading against any hand or regex
213
213
one, and both are counted in the generated tables below: the 62 sites reached
214
-
through an erased (`any`) receiver, and the 71 that name their object through a
214
+
through an erased (`any`) receiver, and the 72 that name their object through a
215
215
`const` rather than inline. An instrument that read either the way a person does
216
216
would report a smaller number and would not say so.
217
217
218
218
The fourth row is the one worth flagging to anyone citing it. **The 135 / 77%
219
219
figure has no surviving corroboration anywhere in the tree.** This census reads
220
-
152 of 275 (55%) as decidably elevated, with 113 more whose elevation is a
220
+
153 of 276 (55%) as decidably elevated, with 113 more whose elevation is a
221
221
run-time fact — so the claim is neither confirmed nor refuted, and the honest
222
222
answer is that a static reading cannot settle it.
223
223
224
-
⇒ **Cite `3 / 275`, and say what it is**: the sites whose options argument was
224
+
⇒ **Cite `3 / 276`, and say what it is**: the sites whose options argument was
225
225
READ and holds no tenant context, against a decidably tenancy-enabled object.
226
226
That is the control's provable yield surface. ⛔ Do not cite it as "the sites
227
227
without tenant context" — **30 further sites** have an options argument this
@@ -233,29 +233,29 @@ cannot read, and they are neither in nor out.
233
233
234
234
| what | count |
235
235
| :--- | ---: |
236
-
| write call sites on the application surface |**275**|
237
-
| …whose object name is statically decidable |195|
236
+
| write call sites on the application surface |**276**|
237
+
| …whose object name is statically decidable |196|
238
238
| …whose object name is chosen at run time | 80 |
239
-
| …against an object with tenancy ENABLED |189|
239
+
| …against an object with tenancy ENABLED |190|
240
240
| …against an object that declares tenancy off | 6 |
241
-
| threading a tenant context |208|
241
+
| threading a tenant context |209|
242
242
| PROVABLY carrying none (options read, no context key) |**10**|
243
243
| …of those, against a decidably tenancy-enabled object |**3**|
244
244
| options argument UNREADABLE — may or may not carry one | 57 |
245
245
| …of those, against a decidably tenancy-enabled object | 30 |
246
-
| threading a decidably ELEVATED (`isSystem`) context |152|
246
+
| threading a decidably ELEVATED (`isSystem`) context |153|
247
247
| threading a context that is decidably NOT elevated | 0 |
248
248
| threading a context whose elevation is a run-time fact | 113 |
249
249
250
250
| how the instrument reached the site | count |
251
251
| :--- | ---: |
252
-
| receiver carried a readable engine type |213|
252
+
| receiver carried a readable engine type |214|
253
253
| receiver erased, placed by the object NAME | 52 |
254
254
| receiver erased, placed by an `object: string` PARAMETER | 5 |
255
255
| receiver erased, placed by an `UNTYPED_RECEIVERS` row | 5 |
256
256
257
257
| object name spelled inline | 124 |
258
-
| object name spelled through a `const`|71|
258
+
| object name spelled through a `const`|72|
259
259
| object name is an `object: string` parameter | 7 |
260
260
| object name is some other run-time expression | 73 |
261
261
@@ -307,12 +307,12 @@ holds still. They are required to be HERE and to say WHEN they were true;
307
307
their values are not compared. The reasoning, and the measurement behind it,
308
308
are in `scripts/check-tenant-audit-census.mjs`.
309
309
310
-
Measured on 2026-11-08 at `fe3aea79c`.
310
+
Measured on 2026-11-08 at `da13e5987`.
311
311
312
312
| corpus scale (not enforced) | count |
313
313
| :--- | ---: |
314
-
| tracked non-test sources scanned |1063|
315
-
| engine-shaped types recognised |114|
314
+
| tracked non-test sources scanned |1068|
315
+
| engine-shaped types recognised |115|
316
316
| declared objects in the registry | 132 |
317
317
| same-named calls subtracted as non-engine | 243 |
0 commit comments