Commit e16f2a8
* feat(security): ADR-0057 ERP authorization core — scope-depth, business units, seed declared RBAC (#2077)
Dataverse-core / Salesforce-discipline hybrid. Adds the ERP partition + scope-depth
+ hierarchy-rollup core on top of the existing widening layer, and makes the role
system self-owned (decoupled from better-auth membership). Closes #2077.
- D1 scope-depth grants on ObjectPermission (own/unit/unit_and_below/org): security
stashes the grant's depth, sharing widens the owner-match (owner IN unit-set) and
still OR's in shares. No RLS-compiler change. Proof: showcase-scope-depth (4).
- D2 rename sys_department → sys_business_unit (pre-launch clean rename, no aliases):
object + member table + BusinessUnitGraphService + recipient enum + fields + i18n.
- D3 BU rollup via BusinessUnitGraphService subtree expansion.
- D4 sys_user_role (platform-owned RBAC assignment); resolve-execution-context merges
it with sys_member.role.
- D5 re-home role_and_subordinates onto the working BU subtree. Proof:
showcase-bu-hierarchy-sharing (4).
- D6 seed stack-declared roles + sharingRules at boot (bootstrapDeclaredRoles /
bootstrapDeclaredSharingRules; AppPlugin surfaces security metadata; seeders read
the engine registry; field-equality CEL→criteria_json; owner/group experimental).
Proof: showcase-declarative-rbac-seeding (4). Closes #2077.
- D8 authz-conformance matrix rows for the new primitives.
- Fix latent over-grant: engine.find({filter}) was silently ignored (driver reads
`where`); normalize filter→where in the engine. objectql 670 green.
Full dogfood 21 files / 122 tests; objectql 670 / runtime 395 / security 112 /
sharing 63 / approvals 90 — all green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor(security): ADR-0057 open/paid seam — hierarchy scopes via pluggable IHierarchyScopeResolver
Hierarchy-relative visibility (scope unit/unit_and_below/own_and_reports) is an
enterprise capability, not open-core. The open framework keeps the secure baseline
(RLS/sharing/roles/own·org scope, BU data model + explicit business_unit recipient)
and a pluggable seam; the resolver implementation ships in the private
@objectstack/security-enterprise.
- spec/contracts: IHierarchyScopeResolver + HierarchyScope.
- plugin-sharing: SharingService delegates unit*/own_and_reports to a late-bound
resolver (hierarchy-scope-resolver service); fails CLOSED to owner-only when absent
(never fail-open). Removed the BU/manager rollup logic from the open SharingService.
- spec/defineStack: compile-error if a grant uses a hierarchy scope without
requires:['hierarchy-security'] (ADR-0049 — no silent lie).
- dogfood showcase-scope-depth: registers a reference resolver (test fixture) to prove
the seam (5/5), incl. a fail-closed case (no resolver → owner-only).
- authz-conformance + ADR-0057: record the seam.
Full build 75/75; spec 6599; dogfood 21/123; sharing 63; security 112 — all green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(changeset): ADR-0057 ERP authorization core (#2077)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(spec): classify readScope/writeScope in permission liveness ledger (ADR-0057)
Spec property liveness gate (ADR-0054) requires every authorable property be
classified. readScope/writeScope are live (consumed by permission-evaluator
getEffectiveScope + sharing owner-match; hierarchy values delegated to the
enterprise resolver, fail-closed in open).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 713d405 commit e16f2a8
44 files changed
Lines changed: 1541 additions & 200 deletions
File tree
- .changeset
- docs/adr
- packages
- dogfood/test
- objectql/src
- platform-objects
- scripts
- src
- apps
- translations
- identity
- plugins
- plugin-approvals/src
- plugin-security/src
- objects
- plugin-sharing/src
- objects
- translations
- runtime/src
- security
- spec
- liveness
- src
- automation
- contracts
- security
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| 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 | + | |
Lines changed: 359 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
| |||
54 | 62 | | |
55 | 63 | | |
56 | 64 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
| |||
Lines changed: 103 additions & 0 deletions
| 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 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
Lines changed: 56 additions & 0 deletions
| 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 | + | |
0 commit comments