feat(security): ADR-0057 ERP authorization core + open/paid hierarchy seam (closes #2077)#2084
Merged
Merged
Conversation
…ss 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>
…uggable 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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 8 package(s): 98 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…r (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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ADR-0057 — a Dataverse-core / Salesforce-discipline authorization model on top of the existing widening layer, the open/paid seam that keeps hierarchy-relative visibility an enterprise capability, and the close-out of #2077 (declared
roles/sharingRulesnow seed at boot).Highlights (each with a runtime dogfood proof)
own / own_and_reports / unit / unit_and_below / org— security stashes the grant's depth, sharing widens the owner-match (owner_id IN …) and still OR-s in shares. No RLS-compiler change.showcase-scope-depth(5/5, incl. fail-closed).sys_department→sys_business_unitclean pre-launch rename (object + member table + graph + recipient enum + fields + i18n).sys_user_role— platform-owned RBAC assignment, decoupled from better-auth's membership role; merged inresolve-execution-context.role_and_subordinatesre-homed onto the working BU subtree.showcase-bu-hierarchy-sharing(4/4).roles+sharingRulesat runtime (enforce-or-remove) — unblocksrole_and_subordinatesshowcase demo #2077 seed declared roles + sharingRules at boot (CEL→criteria_jsonfor field-equality; owner/group rules honestly skipped as experimental).showcase-declarative-rbac-seeding(4/4).IHierarchyScopeResolver; the open edition ships none and fails closed to owner-only (never fail-open);defineStackerrors if a grant uses a hierarchy scope withoutrequires: ['hierarchy-security']. The enterprise resolver lives in the private@objectstack/security-enterprise.engine.find({filter})was silently ignored (driver readswhere) → over-grant; normalizedfilter→wherein the engine.Tests
Full build 75/75 · objectql 670 · runtime 395 · plugin-security 112 · plugin-sharing 63 · plugin-approvals 90 · full dogfood 21 files / 123 tests — all green; no blast-radius regression from activating declared rules.
Notes
Closes #2077.
🤖 Generated with Claude Code