Skip to content

Commit 54df640

Browse files
plugin-security, plugin-sharing: at boot, the administrator is told when an upgrade renamed, removed or collided with an access choice (#24446 U1) (#25311)
Part of #24446 U1 of #24446: the access-class upgrade comparison and its boot report. It works to the measurement in 6353200007 and the seat's GO in 6353222762, under claim 6353092498. U2, the marketplace refusal, follows as a separate PR. The ADR-0126 dated note is a separate Tier H docs PR that the seat cuts. Clause-②: yes (widening: plugin-sharing's exported `SharingRuleService` gains `listDeclaredRules()`; the report itself refuses nothing and adds no key, code or setting) Metadata-protocol: none ## What changed **`plugin-security`: `access-upgrade-report.ts` (new), wired at `kernel:bootstrapped` beside `catalog-reference-report.ts`.** At every boot it compares the customer's access state with the registry this boot registered. The customer's state is the activation-ledger rows, the permission sets and positions this system authored (`_provenance: 'org'`, clones included), and the `sys_sharing_rule` rows. It covers sharing rules, permission sets, positions and capabilities, and lists: 1. **Orphans:** ledger rows of type `position`, `permission` or `sharing_rule` whose name the registry no longer resolves. 2. **Suspected re-enablements:** a switched-off orphan whose recorded `package_id` is P, with every name of the same type that P now ships and no ledger row covers. A permission-set candidate names the positions whose definition binds it, which are the acceptance's "affected positions". 3. **Sharing-rule collisions, per organization:** a `sys_sharing_rule` row that holds a declared rule's name. Position, permission-set and capability collisions are already refused at registration or at boot (`security-catalog-namespace.ts`), so a boot that reaches this report holds none of them. 4. **Broken references in the customer's items:** - an environment-authored permission set that names an object, a field or a capability the registry lacks. A capability counts as known when it is registered or a package-shipped set still carries it, ADR-0066 ⑨'s rule. This is the capability type's whole part, because capabilities are code-only and never switched; - a `sys_sharing_rule` row that names an object or a criteria field the registry lacks. 5. **Field denies a customer set lacks:** a package-shipped set denies a field (`readable: false`, or not `editable` on an object it grants edit on), and an environment-authored set grants the same object with no entry for that field. It writes nothing and refuses nothing. It follows `catalog-reference-report.ts`'s fail-closed shape: - a scan, catalog read or declared-rule read that throws stops the report, and nothing is judged from it; - an absent ledger object, sharing-rule object or sharing service is named in `absent`, and no `sharing_rule` row is judged without the declared-rule list. **Who is told.** The log gets one line per category, as now. The existing notification ingress, `messaging.emit()` (ADR-0030), also gets one `security.access_upgrade` event with `severity: 'warning'`. It appears in Setup → Diagnostics → Notification Events and in the in-app inbox. No object, page, route or setting is added. - **`single`:** the Default Organization's `admin_full_access` holders and any `OS_PLATFORM_OWNER_EMAIL` address. - **`group` / `isolated`:** no emit. One `error` line is addressed to the operator, because the notification family is organization-scoped (ADR-0131 D9; the seat's option A, 6353787407). The ledger and the catalog are deployment-level, and under a wall only the operator may switch or clone (ADR-0126 §5, ADR-0131 D3). A tenant administrator is never the fallback. - **`dedupKey`** is the finding set's digest, so an unchanged set notifies once, not at every boot. - **No messaging service, no recipient, or a failed emit:** one error line says the findings reached no administrator and names the fix. - **Mandatory (the seat's question):** not set. The ingress has no per-emit mandatory flag, so a recipient's mute hides it. Making it mute-proof without a new setting means adding `security.access_upgrade` to the messaging plugin's existing `mandatoryTopics` option. The changeset says so. **`plugin-sharing`: `SharingRuleService.listDeclaredRules()`.** It answers every declared rule with its `packageId`. It answers `null` when the service reads no declarations, which is no answer about any name. plugin-security reaches it as the `sharingRules` service through a structural type and gains no dependency. ## Two limits (accepted by the seat, 6353222762) Both follow from ADR-0126 §9, under which a clone records no base, no package and no link, and from the bare `(metadata_type, name)` ledger key with its unread `package_id`: - **A re-enablement is suspected.** Nothing records which name replaced which, and the ledger keeps no version, so "arrived" can only mean "shipped now by P with no ledger row". A package with several unswitched names yields several candidates. - **The field-deny check reads "grants the same object", not "copied from that set".** It may name an unrelated customer set, so it is a review item. - **"The old name carrying a clone" is carried by the switch-off half.** The sanctioned ceremony is clone plus switch-off, and a clone whose base stays on is not a choice a rename un-makes. So the acceptance's "switched off or cloned" case is met through the switch-off half. The seat reads this as within ruling 6259332195's intent, not a change to it. ## Scope held - `packages/core/src/security/resolve-authz-context.ts` is unchanged. It is read-only while #25248 is open, and this PR only imports `readDefaultOrganizationId` from it. - Not `packages/cloud-connection/**` (U2), not `docs/adr/**`, and no `ORGANIZATION_OWNERSHIP_SHAPE_GENERATION` change. ## Tests - `access-upgrade-report.test.ts`: per access type (permission set, position, sharing rule, capability), under `single` and walled, each with a CONTROL that raises nothing. It also covers clone bodies, the fail-closed stops, and delivery: the dedup key, no messaging service, no operator under a wall, a failed emit, and one log line per category. - `access-upgrade-report.wiring.test.ts`: the acceptance end to end on a real `ObjectQL` engine with `SecurityPlugin` started, under `single`, `isolated` and `group`, with CONTROLs. - Ablations, each red and then restored: - dropping the re-enablement finding turns 10 pins red; - letting a walled posture resolve the `single` audience turns 7 red; - judging every package-less set as customer-authored turns the stack-set CONTROL red. The proof readings are in the os-dev-report on #24446: CI, dispatch gates, `check-governed-merges --branch`, R1, R4 under `isolated` and `group`, and the upgrade harness. --- _Generated by [Claude Code](https://claude.ai/code/session_01MbmmTHFS1B1rgE6n8npUPN)_ --- Seat amendment · 2026-10-23T00:22Z (epic PM `session_01Y5583bs2RDd53MH6kM1ca3`): `Clause-②` is corrected to `yes (widening)` for the new public `SharingRuleService.listDeclaredRules()`, and the walled bullet now follows option A. The changeset line follows in the dev's next commit. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 97967a9 commit 54df640

6 files changed

Lines changed: 1567 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
'@objectstack/plugin-security': patch
3+
'@objectstack/plugin-sharing': patch
4+
---
5+
6+
feat: at boot, an administrator is told when a package upgrade renamed, removed or collided with an access item the customer switched off, cloned or authored
7+
8+
Clause-②: yes (widening: plugin-sharing's exported `SharingRuleService` gains `listDeclaredRules()`; the report itself refuses nothing and adds no key, code or setting)
9+
Metadata-protocol: none
10+
11+
ADR-0126 §6 wall 3 says no upgrade un-makes a customer's choice. A switch-off, a clone or a sharing rule row is kept by name, so a vendor rename made a switched-off item active again under its new name, and nothing told anyone. At `kernel:bootstrapped`, beside the catalog reference report, `SecurityPlugin` now compares the customer's access state with the registry this boot registered. It covers sharing rules, permission sets, positions and capabilities, and lists:
12+
13+
- **Orphans:** activation-ledger rows (`position`, `permission`, `sharing_rule`) whose name the registry no longer resolves.
14+
- **Suspected re-enablements:** a switched-off orphan whose recorded `package_id` is P, with every name of the same type P now ships that no ledger row covers. A permission-set candidate names the positions that bind it.
15+
- **Sharing-rule collisions, per organization:** a `sys_sharing_rule` row holding a declared rule's name, so the declared rule is served nowhere in that scope. A position, permission-set or capability collision is already refused at registration or at boot.
16+
- **Broken references in the customer's items:** a permission set authored in this system naming an object, field or capability the registry lacks, and a `sys_sharing_rule` row naming an object or criteria field the registry lacks.
17+
- **Field denies a customer set lacks:** a package-shipped set that denies a field, beside a set authored in this system that grants the same object with no entry for that field. An unlisted field is visible.
18+
19+
The findings are logged once per category, as now. They are also raised to the people who can act on them:
20+
21+
- **Under `single`,** through the existing notification ingress (`messaging.emit()`, topic `security.access_upgrade`, severity `warning`), which writes a Notification Events row in Setup and the in-app inbox. It reaches the Default Organization's `admin_full_access` holders and any `OS_PLATFORM_OWNER_EMAIL` address.
22+
- The `dedupKey` is the finding set's digest, so an unchanged set notifies once, not at every boot.
23+
- With no messaging service, nobody to tell, or an emit the ingress refuses, one log line says the findings reached no administrator and names the fix for that cause.
24+
- The notification is not mandatory: the ingress has no per-emit flag, so a recipient's mute hides it. To make it mute-proof, add `security.access_upgrade` to the messaging plugin's existing `mandatoryTopics` option.
25+
- **Under `group` or `isolated`,** to the platform operator alone, by one `error` line addressed to the operator. The ledger and the catalog are deployment-level, so only the operator can act. The notification family is organization-scoped, and a walled write with no organization is refused (ADR-0131 D9); stamping an organization would hand the finding to a tenant. So no notification is attempted, and no organization is told.
26+
27+
Two limits follow from ADR-0126 §9, under which a clone records no base, and from the bare `(metadata_type, name)` ledger key:
28+
29+
- A re-enablement is **suspected** and may list several same-package candidates. Nothing records which name replaced which.
30+
- The field-deny check reads "grants the same object", not "copied from that set", so it may name an unrelated set. It is a review item.
31+
32+
"The old name carrying a clone" is carried by the switch-off half. The sanctioned ceremony is clone plus switch-off, and a clone whose base stays on is not a choice a rename un-makes. A read that fails stops the report for that boot, and nothing is judged from an unread store.
33+
34+
- **`@objectstack/plugin-sharing`:** `SharingRuleService.listDeclaredRules()` answers every declared rule with its `packageId`, or `null` when the service reads no declarations.

0 commit comments

Comments
 (0)