@astram/core 0.1.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/admin/admin-service.d.ts +1 -1
  2. package/dist/admin/command/grants.js +3 -3
  3. package/dist/admin/command/grants.js.map +1 -1
  4. package/dist/admin/command/invitations.d.ts +2 -2
  5. package/dist/admin/command/invitations.js +8 -8
  6. package/dist/admin/command/invitations.js.map +1 -1
  7. package/dist/admin/command/service-accounts.d.ts +1 -1
  8. package/dist/admin/command/service-accounts.js +1 -1
  9. package/dist/admin/query/simulate.d.ts.map +1 -1
  10. package/dist/admin/query/simulate.js +4 -0
  11. package/dist/admin/query/simulate.js.map +1 -1
  12. package/dist/admin/safeguards-impl.d.ts +2 -2
  13. package/dist/admin/safeguards-impl.js +9 -9
  14. package/dist/admin/safeguards-impl.js.map +1 -1
  15. package/dist/admin/safeguards.d.ts +4 -4
  16. package/dist/admin/safeguards.js +4 -4
  17. package/dist/admin/types.d.ts +1 -1
  18. package/dist/admin/types.d.ts.map +1 -1
  19. package/dist/authentication/authenticator.d.ts +2 -2
  20. package/dist/authentication/authenticator.js +2 -2
  21. package/dist/authentication/authenticator.js.map +1 -1
  22. package/dist/authentication/credential-resolver.d.ts +1 -1
  23. package/dist/authorization/cross-tenant/grant-evaluator.d.ts +2 -2
  24. package/dist/authorization/cross-tenant/grant-evaluator.js +2 -2
  25. package/dist/authorization/decision-authority.d.ts +2 -2
  26. package/dist/authorization/decision-authority.d.ts.map +1 -1
  27. package/dist/authorization/decision-authority.js +11 -3
  28. package/dist/authorization/decision-authority.js.map +1 -1
  29. package/dist/authorization/errors.d.ts +37 -0
  30. package/dist/authorization/errors.d.ts.map +1 -1
  31. package/dist/authorization/errors.js +43 -0
  32. package/dist/authorization/errors.js.map +1 -1
  33. package/dist/authorization/gates/object-type.d.ts +2 -2
  34. package/dist/authorization/gates/object-type.d.ts.map +1 -1
  35. package/dist/authorization/gates/object-type.js +20 -7
  36. package/dist/authorization/gates/object-type.js.map +1 -1
  37. package/dist/authorization/gates/tenant.d.ts +3 -3
  38. package/dist/authorization/gates/tenant.js +7 -7
  39. package/dist/authorization/gates/tenant.js.map +1 -1
  40. package/dist/authorization/index.d.ts +33 -4
  41. package/dist/authorization/index.d.ts.map +1 -1
  42. package/dist/authorization/index.js +39 -4
  43. package/dist/authorization/index.js.map +1 -1
  44. package/dist/authorization/ports.d.ts +3 -3
  45. package/dist/authorization/reason-codes.d.ts +7 -1
  46. package/dist/authorization/reason-codes.d.ts.map +1 -1
  47. package/dist/authorization/reason-codes.js +9 -1
  48. package/dist/authorization/reason-codes.js.map +1 -1
  49. package/dist/authorization/record/owner-baseline.d.ts +43 -0
  50. package/dist/authorization/record/owner-baseline.d.ts.map +1 -0
  51. package/dist/authorization/record/owner-baseline.js +72 -0
  52. package/dist/authorization/record/owner-baseline.js.map +1 -0
  53. package/dist/authorization/record/permit-tier.d.ts.map +1 -1
  54. package/dist/authorization/record/permit-tier.js +16 -5
  55. package/dist/authorization/record/permit-tier.js.map +1 -1
  56. package/dist/identity/broker.d.ts +8 -8
  57. package/dist/identity/broker.d.ts.map +1 -1
  58. package/dist/identity/broker.js +8 -8
  59. package/dist/identity/broker.js.map +1 -1
  60. package/dist/identity/claim-mapper.d.ts +8 -8
  61. package/dist/identity/claim-mapper.d.ts.map +1 -1
  62. package/dist/identity/claim-mapper.js +4 -4
  63. package/dist/identity/index.d.ts +2 -2
  64. package/dist/identity/index.d.ts.map +1 -1
  65. package/dist/identity/internal-adapter.d.ts +12 -12
  66. package/dist/identity/internal-adapter.d.ts.map +1 -1
  67. package/dist/identity/internal-adapter.js +9 -9
  68. package/dist/identity/internal-adapter.js.map +1 -1
  69. package/dist/metadata/index.d.ts +43 -0
  70. package/dist/metadata/index.d.ts.map +1 -1
  71. package/dist/metadata/index.js +6 -0
  72. package/dist/metadata/index.js.map +1 -1
  73. package/dist/metadata/registry.d.ts.map +1 -1
  74. package/dist/metadata/registry.js +2 -1
  75. package/dist/metadata/registry.js.map +1 -1
  76. package/dist-cjs/admin/admin-service.js +159 -0
  77. package/dist-cjs/admin/command/grants.js +200 -0
  78. package/dist-cjs/admin/command/index.js +38 -0
  79. package/dist-cjs/admin/command/invitations.js +246 -0
  80. package/dist-cjs/admin/command/permissions.js +69 -0
  81. package/dist-cjs/admin/command/pipeline.js +110 -0
  82. package/dist-cjs/admin/command/policies.js +223 -0
  83. package/dist-cjs/admin/command/service-accounts.js +278 -0
  84. package/dist-cjs/admin/command/service.js +130 -0
  85. package/dist-cjs/admin/command/tiers.js +81 -0
  86. package/dist-cjs/admin/index.js +78 -0
  87. package/dist-cjs/admin/ports.js +41 -0
  88. package/dist-cjs/admin/query/audit-view.js +88 -0
  89. package/dist-cjs/admin/query/catalog.js +174 -0
  90. package/dist-cjs/admin/query/explain.js +149 -0
  91. package/dist-cjs/admin/query/index.js +74 -0
  92. package/dist-cjs/admin/query/simulate.js +98 -0
  93. package/dist-cjs/admin/safeguards-impl.js +322 -0
  94. package/dist-cjs/admin/safeguards.js +95 -0
  95. package/dist-cjs/admin/types.js +40 -0
  96. package/dist-cjs/audit/audit-recorder.js +269 -0
  97. package/dist-cjs/audit/canonicalize.js +176 -0
  98. package/dist-cjs/audit/errors.js +44 -0
  99. package/dist-cjs/audit/index.js +39 -0
  100. package/dist-cjs/audit/ports.js +27 -0
  101. package/dist-cjs/audit/sensitive.js +162 -0
  102. package/dist-cjs/audit/walk.js +123 -0
  103. package/dist-cjs/authentication/authenticator.js +210 -0
  104. package/dist-cjs/authentication/credential-resolver.js +21 -0
  105. package/dist-cjs/authentication/index.js +42 -0
  106. package/dist-cjs/authentication/password-hasher.js +21 -0
  107. package/dist-cjs/authentication/totp.js +155 -0
  108. package/dist-cjs/authorization/cross-tenant/grant-evaluator.js +167 -0
  109. package/dist-cjs/authorization/decision-authority.js +213 -0
  110. package/dist-cjs/authorization/default-gates.js +53 -0
  111. package/dist-cjs/authorization/delegation/operation-identity.js +226 -0
  112. package/dist-cjs/authorization/errors.js +110 -0
  113. package/dist-cjs/authorization/gates/object-type.js +192 -0
  114. package/dist-cjs/authorization/gates/tenant.js +89 -0
  115. package/dist-cjs/authorization/gates/wiring.js +59 -0
  116. package/dist-cjs/authorization/index.js +134 -0
  117. package/dist-cjs/authorization/ports.js +36 -0
  118. package/dist-cjs/authorization/reason-codes.js +117 -0
  119. package/dist-cjs/authorization/record/owner-baseline.js +74 -0
  120. package/dist-cjs/authorization/record/permit-tier.js +92 -0
  121. package/dist-cjs/authorization/record/rule-evaluator.js +128 -0
  122. package/dist-cjs/authorization/record/shares.js +110 -0
  123. package/dist-cjs/identity/broker.js +139 -0
  124. package/dist-cjs/identity/claim-mapper.js +51 -0
  125. package/dist-cjs/identity/index.js +39 -0
  126. package/dist-cjs/identity/internal-adapter.js +91 -0
  127. package/dist-cjs/index.js +63 -0
  128. package/dist-cjs/metadata/completeness.js +108 -0
  129. package/dist-cjs/metadata/dependencies.js +110 -0
  130. package/dist-cjs/metadata/index.js +76 -0
  131. package/dist-cjs/metadata/registry.js +207 -0
  132. package/dist-cjs/package.json +3 -0
  133. package/dist-cjs/risk/evaluator.js +63 -0
  134. package/dist-cjs/risk/index.js +35 -0
  135. package/dist-cjs/risk/risk-engine.js +290 -0
  136. package/dist-cjs/risk/signals.js +106 -0
  137. package/dist-cjs/risk/thresholds.js +63 -0
  138. package/dist-cjs/session/index.js +35 -0
  139. package/dist-cjs/session/lifetimes.js +70 -0
  140. package/dist-cjs/session/ports.js +23 -0
  141. package/dist-cjs/session/session-authority.js +398 -0
  142. package/package.json +13 -10
@@ -1 +1 @@
1
- {"version":3,"file":"decision-authority.js","sourceRoot":"","sources":["../../src/authorization/decision-authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAgB5D,OAAO,EACL,KAA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AQ,CAAC;IAClB,CAAC;CACF;AAKD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,IAAoC;IAEpC,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC"}
@@ -18,6 +18,23 @@
18
18
  *
19
19
  * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
20
20
  */
21
+ /**
22
+ * ⛔ CROSS-BUILD BRAND (ADR-0016 hardening). `@astram/core` is DUAL-BUILT (ESM `dist/` +
23
+ * CJS `dist-cjs/`). A guard adapter compiled against one build can throw an
24
+ * `AuthorizationUnavailableError` whose class is a DIFFERENT realized constructor from the
25
+ * one the wiring loaded in the other build — so a bare `err instanceof
26
+ * AuthorizationUnavailableError` returns FALSE across the build boundary, and a genuine
27
+ * store OUTAGE would be mis-classified as `deny_by_default` (403 terminal) instead of the
28
+ * retryable 503 the ADR mandates.
29
+ *
30
+ * `Symbol.for(...)` is keyed on the GLOBAL symbol registry, shared across every module
31
+ * realm/build in the process — so a value carrying this brand is recognizable regardless of
32
+ * WHICH core build minted it. It is the robust, cross-realm transient signal;
33
+ * {@link isAuthorizationUnavailable} tests `instanceof` FIRST (fast, primary) then this
34
+ * brand (the dual-build fallback). A coincidental `name` alone is deliberately NOT trusted
35
+ * as the sole signal (see the guard).
36
+ */
37
+ export declare const AUTHORIZATION_UNAVAILABLE_BRAND: unique symbol;
21
38
  /**
22
39
  * A TYPED, transient-unavailable signal thrown by `decide()` ONLY when an injected
23
40
  * port genuinely CANNOT answer (ADR-0016) — e.g. the hot-facts read yields
@@ -49,6 +66,26 @@ export declare class AuthorizationUnavailableError extends Error {
49
66
  * never returned to the caller, never reveals whether a resource exists.
50
67
  */
51
68
  readonly detail?: string;
69
+ /**
70
+ * The global-registry brand (see {@link AUTHORIZATION_UNAVAILABLE_BRAND}). Stamped `true`
71
+ * on every instance so {@link isAuthorizationUnavailable} recognizes the error across the
72
+ * ESM/CJS dual-build boundary, where `instanceof` alone can be false.
73
+ */
74
+ readonly [AUTHORIZATION_UNAVAILABLE_BRAND]: true;
52
75
  constructor(detail?: string, cause?: unknown);
53
76
  }
77
+ /**
78
+ * The robust, dual-build-safe transient test: is `err` an {@link AuthorizationUnavailableError}
79
+ * (ADR-0016 transient signal) regardless of WHICH core build (ESM `dist/` vs CJS `dist-cjs/`)
80
+ * minted it?
81
+ *
82
+ * Checks `instanceof` FIRST (primary, fast, exact within one build), then falls back to the
83
+ * GLOBAL-registry {@link AUTHORIZATION_UNAVAILABLE_BRAND} (cross-build/cross-realm safe). The
84
+ * brand is a `Symbol.for(...)` on the process-shared registry, so a differently-realized
85
+ * constructor still carries the SAME brand symbol — impossible to spoof by a coincidental
86
+ * `name` (we do NOT trust `name` as the sole signal; only the brand or a true `instanceof`).
87
+ * An ordinary `Error` has neither → returns false → the caller fail-closes it to
88
+ * `deny_by_default` (the ordinary-error path is unchanged).
89
+ */
90
+ export declare function isAuthorizationUnavailable(err: unknown): err is AuthorizationUnavailableError;
54
91
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/authorization/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD;;;;OAIG;IACH,SAAkB,KAAK,CAAC,EAAE,OAAO,CAAC;IAElC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEb,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAQ7C"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/authorization/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,+BAA+B,EAAE,OAAO,MAEpD,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD;;;;OAIG;IACH,SAAkB,KAAK,CAAC,EAAE,OAAO,CAAC;IAElC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,CAAC,+BAA+B,CAAC,EAAG,IAAI,CAAU;gBAE/C,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAQ7C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,OAAO,GACX,GAAG,IAAI,6BAA6B,CAOtC"}
@@ -18,6 +18,23 @@
18
18
  *
19
19
  * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
20
20
  */
21
+ /**
22
+ * ⛔ CROSS-BUILD BRAND (ADR-0016 hardening). `@astram/core` is DUAL-BUILT (ESM `dist/` +
23
+ * CJS `dist-cjs/`). A guard adapter compiled against one build can throw an
24
+ * `AuthorizationUnavailableError` whose class is a DIFFERENT realized constructor from the
25
+ * one the wiring loaded in the other build — so a bare `err instanceof
26
+ * AuthorizationUnavailableError` returns FALSE across the build boundary, and a genuine
27
+ * store OUTAGE would be mis-classified as `deny_by_default` (403 terminal) instead of the
28
+ * retryable 503 the ADR mandates.
29
+ *
30
+ * `Symbol.for(...)` is keyed on the GLOBAL symbol registry, shared across every module
31
+ * realm/build in the process — so a value carrying this brand is recognizable regardless of
32
+ * WHICH core build minted it. It is the robust, cross-realm transient signal;
33
+ * {@link isAuthorizationUnavailable} tests `instanceof` FIRST (fast, primary) then this
34
+ * brand (the dual-build fallback). A coincidental `name` alone is deliberately NOT trusted
35
+ * as the sole signal (see the guard).
36
+ */
37
+ export const AUTHORIZATION_UNAVAILABLE_BRAND = Symbol.for('astram.core.AuthorizationUnavailable');
21
38
  /**
22
39
  * A TYPED, transient-unavailable signal thrown by `decide()` ONLY when an injected
23
40
  * port genuinely CANNOT answer (ADR-0016) — e.g. the hot-facts read yields
@@ -49,6 +66,12 @@ export class AuthorizationUnavailableError extends Error {
49
66
  * never returned to the caller, never reveals whether a resource exists.
50
67
  */
51
68
  detail;
69
+ /**
70
+ * The global-registry brand (see {@link AUTHORIZATION_UNAVAILABLE_BRAND}). Stamped `true`
71
+ * on every instance so {@link isAuthorizationUnavailable} recognizes the error across the
72
+ * ESM/CJS dual-build boundary, where `instanceof` alone can be false.
73
+ */
74
+ [AUTHORIZATION_UNAVAILABLE_BRAND] = true;
52
75
  constructor(detail, cause) {
53
76
  super(detail ?? 'authorization_unavailable');
54
77
  this.name = 'AuthorizationUnavailableError';
@@ -60,4 +83,24 @@ export class AuthorizationUnavailableError extends Error {
60
83
  Object.setPrototypeOf(this, AuthorizationUnavailableError.prototype);
61
84
  }
62
85
  }
86
+ /**
87
+ * The robust, dual-build-safe transient test: is `err` an {@link AuthorizationUnavailableError}
88
+ * (ADR-0016 transient signal) regardless of WHICH core build (ESM `dist/` vs CJS `dist-cjs/`)
89
+ * minted it?
90
+ *
91
+ * Checks `instanceof` FIRST (primary, fast, exact within one build), then falls back to the
92
+ * GLOBAL-registry {@link AUTHORIZATION_UNAVAILABLE_BRAND} (cross-build/cross-realm safe). The
93
+ * brand is a `Symbol.for(...)` on the process-shared registry, so a differently-realized
94
+ * constructor still carries the SAME brand symbol — impossible to spoof by a coincidental
95
+ * `name` (we do NOT trust `name` as the sole signal; only the brand or a true `instanceof`).
96
+ * An ordinary `Error` has neither → returns false → the caller fail-closes it to
97
+ * `deny_by_default` (the ordinary-error path is unchanged).
98
+ */
99
+ export function isAuthorizationUnavailable(err) {
100
+ if (err instanceof AuthorizationUnavailableError)
101
+ return true;
102
+ return (typeof err === 'object' &&
103
+ err !== null &&
104
+ err[AUTHORIZATION_UNAVAILABLE_BRAND] === true);
105
+ }
63
106
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/authorization/errors.ts"],"names":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AAK,GAAG,KAAK,CAAC;QAC5C,+EAA+E;QAC/E,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,6BAA6B,CAAC,SAAS,CAAC,CAAC;IACvE,CAAC;CACF;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,0BAA0B,CACxC,GAAY;IAEZ,IAAI,GAAG,YAAY,6BAA6B;QAAE,OAAO,IAAI,CAAC;IAC9D,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACX,GAAoC,CAAC,+BAA+B,CAAC,KAAK,IAAI,CAChF,CAAC;AACJ,CAAC"}
@@ -30,13 +30,13 @@
30
30
  * view here and never mutate the frozen slot.)
31
31
  *
32
32
  * ── Cross-tenant case (§7.3.3): when the tenant DIFFERS (and the principal is not
33
- * the platform superuser), gate 3 only let evaluation proceed BECAUSE a
33
+ * the root), gate 3 only let evaluation proceed BECAUSE a
34
34
  * cross-tenant grant covers it — and that grant's scope + action-ceiling SERVES
35
35
  * AS the object-type grant. Coarse facts are the WRONG-tenant facts, so this
36
36
  * gate does NOT consult them; it RE-RESOLVES the grant via
37
37
  * {@link CrossTenantGrantPort} (gate 3 is pure and stashed nothing) and, if the
38
38
  * action is in-ceiling, `continue`s (record level → gate 6 runs) or `allow`s
39
- * (feature/object-type level → terminates). A superuser crossing tenants is NOT
39
+ * (feature/object-type level → terminates). A root crossing tenants is NOT
40
40
  * grant-backed; it takes the normal coarse-grants path below.
41
41
  *
42
42
  * ── Decision:
@@ -1 +1 @@
1
- {"version":3,"file":"object-type.d.ts","sourceRoot":"","sources":["../../../src/authorization/gates/object-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAGH,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AA0ClC;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,gBAAgB,CA4DvD"}
1
+ {"version":3,"file":"object-type.d.ts","sourceRoot":"","sources":["../../../src/authorization/gates/object-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAGH,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AA2ClC;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,gBAAgB,CAyEvD"}
@@ -30,13 +30,13 @@
30
30
  * view here and never mutate the frozen slot.)
31
31
  *
32
32
  * ── Cross-tenant case (§7.3.3): when the tenant DIFFERS (and the principal is not
33
- * the platform superuser), gate 3 only let evaluation proceed BECAUSE a
33
+ * the root), gate 3 only let evaluation proceed BECAUSE a
34
34
  * cross-tenant grant covers it — and that grant's scope + action-ceiling SERVES
35
35
  * AS the object-type grant. Coarse facts are the WRONG-tenant facts, so this
36
36
  * gate does NOT consult them; it RE-RESOLVES the grant via
37
37
  * {@link CrossTenantGrantPort} (gate 3 is pure and stashed nothing) and, if the
38
38
  * action is in-ceiling, `continue`s (record level → gate 6 runs) or `allow`s
39
- * (feature/object-type level → terminates). A superuser crossing tenants is NOT
39
+ * (feature/object-type level → terminates). A root crossing tenants is NOT
40
40
  * grant-backed; it takes the normal coarse-grants path below.
41
41
  *
42
42
  * ── Decision:
@@ -52,8 +52,9 @@
52
52
  * ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
53
53
  */
54
54
  import { gateAllow, gateContinue, gateDeny, } from '../decision-authority.js';
55
- import { denyMissingObjectTypeGrant, strictTrue } from '../reason-codes.js';
55
+ import { denyMissingObjectTypeGrant, denyRootDataPlane, strictTrue } from '../reason-codes.js';
56
56
  import { isCrossTenantGrantApplicable } from '../cross-tenant/grant-evaluator.js';
57
+ import { resolvePlane } from '../../metadata/index.js';
57
58
  /**
58
59
  * A minimal, defensive typed VIEW of the opaque `cachedFacts` slot (ADR-0011). We
59
60
  * do NOT trust the slot to already be a well-formed {@link CoarseGrants}; we probe
@@ -101,14 +102,14 @@ export function createObjectTypeGate() {
101
102
  return async function objectTypeGate(ctx) {
102
103
  const { principal, action, resource, deps } = ctx;
103
104
  const isRecordLevel = resource.level === 'record';
104
- // ── Cross-tenant grant path (§7.3.3): a non-superuser reaching a foreign
105
+ // ── Cross-tenant grant path (§7.3.3): a non-root reaching a foreign
105
106
  // tenant proceeded past gate 3 ONLY via a cross-tenant grant, whose scope +
106
107
  // ceiling SERVES AS the object-type grant. Re-resolve it here (gate 3 is
107
- // pure), NOT the wrong-tenant coarse facts. Superuser is not grant-backed;
108
+ // pure), NOT the wrong-tenant coarse facts. Root is not grant-backed;
108
109
  // it falls through to the coarse-grants path.
109
110
  const crossesTenant = resource.tenantId !== undefined &&
110
111
  principal.tenantId !== resource.tenantId &&
111
- !strictTrue(principal.isPlatformSuperuser);
112
+ !strictTrue(principal.isRoot);
112
113
  if (crossesTenant) {
113
114
  // Re-resolve the grant through the SINGLE-SOURCE cross-tenant helper (TEAM C)
114
115
  // so gates 3/5/6 share ONE ceiling+scope+expiry implementation (RULING 1 /
@@ -129,7 +130,7 @@ export function createObjectTypeGate() {
129
130
  // No covering grant on the foreign tenant ⇒ no object-type grant applies.
130
131
  return gateDeny(denyMissingObjectTypeGrant());
131
132
  }
132
- // ── Same-tenant (or superuser) path — coarse feature/object-type grants
133
+ // ── Same-tenant (or root) path — coarse feature/object-type grants
133
134
  // (ADR-0011). Derive the required stable permission key by re-resolving the
134
135
  // registered action over the frozen registry surface.
135
136
  const registered = deps.registry
@@ -140,6 +141,18 @@ export function createObjectTypeGate() {
140
141
  return gateDeny(denyMissingObjectTypeGrant());
141
142
  }
142
143
  const requiredKey = registered.permissionKey;
144
+ // ── ROOT CAP (§0/§2, ISO A.8.2 / A.5.3): a root is
145
+ // control-plane ONLY. Deny every data-plane capability BY CONSTRUCTION —
146
+ // grant-independent (even a fully-granted root is denied). Control-plane
147
+ // capabilities are allowed WITHOUT a grant (root's authority is the flag +
148
+ // plane classification, not RBAC grants). Default plane is `data` → a
149
+ // forgotten classification denies root (fail-safe).
150
+ if (strictTrue(principal.isRoot)) {
151
+ if (resolvePlane(registered.action) === 'data') {
152
+ return gateDeny(denyRootDataPlane());
153
+ }
154
+ return isRecordLevel ? gateContinue() : gateAllow();
155
+ }
143
156
  // Hot path: prefer the request's cached facts when they are FRESH; reload on a
144
157
  // stale version or an unusable cache.
145
158
  const grants = await resolveCoarseGrants(ctx, requiredKey);
@@ -1 +1 @@
1
- {"version":3,"file":"object-type.js","sourceRoot":"","sources":["../../../src/authorization/gates/object-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAGH,OAAO,EACL,SAAS,EACT,YAAY,EACZ,QAAQ,GAIT,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF;;;;;GAKG;AACH,SAAS,cAAc,CAAC,IAAa;IACnC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,SAAS,GAAG,IAAyE,CAAC;IAC5F,IAAI,OAAO,SAAS,CAAC,kBAAkB,KAAK,QAAQ,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,iFAAiF;IACjF,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,qBAAqB,EAAE,CAAC;QAClD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO;QACL,kBAAkB,EAAE,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ACH,KAAK,UAAU,mBAAmB,CAChC,GAAgB,EAChB,YAAoB;IAEpB,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IAChC,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAE7D,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,yBAAyB,CACzE,SAAS,CAAC,EAAE,EACZ,SAAS,CAAC,QAAQ,CACnB,CAAC;QACF,+EAA+E;QAC/E,gFAAgF;QAChF,IAAI,MAAM,CAAC,kBAAkB,IAAI,cAAc,EAAE,CAAC;YAChD,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED,mEAAmE;IACnE,OAAO,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;AACjF,CAAC"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * The tenant boundary is the platform's DEFAULT authorization boundary (§7.3): a
5
5
  * principal may only reach a resource its own tenant owns, UNLESS it is the
6
- * platform superuser (break-glass) or an active, consented cross-tenant grant
6
+ * root (break-glass) or an active, consented cross-tenant grant
7
7
  * (ADR-0009) lets evaluation PROCEED. This gate can ONLY block (`deny`) or let
8
8
  * evaluation continue (`continue`) — it NEVER returns `allow`. An `allow` from
9
9
  * the tenant gate would be a fail-open (the pipeline treats an unexpected `allow`
@@ -18,9 +18,9 @@
18
18
  * carries no instance tenant) ⇒ `continue`. A feature/object-type-level
19
19
  * resource with no `tenantId` is same-tenant BY CONSTRUCTION — there is no
20
20
  * foreign instance to cross into, so it is the principal's own tenant.
21
- * 2. MISMATCH + platform superuser (STRICT `=== true`) ⇒ `continue` (break-glass,
21
+ * 2. MISMATCH + root (STRICT `=== true`) ⇒ `continue` (break-glass,
22
22
  * audited by a later layer — not this gate's concern).
23
- * 3. MISMATCH + not superuser ⇒ consult {@link CrossTenantGrantPort}:
23
+ * 3. MISMATCH + not root ⇒ consult {@link CrossTenantGrantPort}:
24
24
  * - an ACTIVE grant whose action-ceiling INCLUDES this action (STRICT
25
25
  * membership) ⇒ `continue` (proceed only; it confers no object-type/record
26
26
  * permission — those gates still run);
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * The tenant boundary is the platform's DEFAULT authorization boundary (§7.3): a
5
5
  * principal may only reach a resource its own tenant owns, UNLESS it is the
6
- * platform superuser (break-glass) or an active, consented cross-tenant grant
6
+ * root (break-glass) or an active, consented cross-tenant grant
7
7
  * (ADR-0009) lets evaluation PROCEED. This gate can ONLY block (`deny`) or let
8
8
  * evaluation continue (`continue`) — it NEVER returns `allow`. An `allow` from
9
9
  * the tenant gate would be a fail-open (the pipeline treats an unexpected `allow`
@@ -18,9 +18,9 @@
18
18
  * carries no instance tenant) ⇒ `continue`. A feature/object-type-level
19
19
  * resource with no `tenantId` is same-tenant BY CONSTRUCTION — there is no
20
20
  * foreign instance to cross into, so it is the principal's own tenant.
21
- * 2. MISMATCH + platform superuser (STRICT `=== true`) ⇒ `continue` (break-glass,
21
+ * 2. MISMATCH + root (STRICT `=== true`) ⇒ `continue` (break-glass,
22
22
  * audited by a later layer — not this gate's concern).
23
- * 3. MISMATCH + not superuser ⇒ consult {@link CrossTenantGrantPort}:
23
+ * 3. MISMATCH + not root ⇒ consult {@link CrossTenantGrantPort}:
24
24
  * - an ACTIVE grant whose action-ceiling INCLUDES this action (STRICT
25
25
  * membership) ⇒ `continue` (proceed only; it confers no object-type/record
26
26
  * permission — those gates still run);
@@ -56,12 +56,12 @@ export function createTenantGate() {
56
56
  if (resource.tenantId === undefined || principal.tenantId === resource.tenantId) {
57
57
  return gateContinue();
58
58
  }
59
- // 2. Mismatch + platform superuser (break-glass). STRICT === true — a truthy
60
- // non-boolean superuser flag must NOT bypass the tenant boundary.
61
- if (strictTrue(principal.isPlatformSuperuser)) {
59
+ // 2. Mismatch + root (break-glass). STRICT === true — a truthy
60
+ // non-boolean root flag must NOT bypass the tenant boundary.
61
+ if (strictTrue(principal.isRoot)) {
62
62
  return gateContinue();
63
63
  }
64
- // 3. Mismatch + not superuser — the ONLY sanctioned crossing is an active,
64
+ // 3. Mismatch + not root — the ONLY sanctioned crossing is an active,
65
65
  // consented cross-tenant grant (ADR-0009). Resolve applicability through the
66
66
  // SINGLE-SOURCE cross-tenant helper (TEAM C) so gates 3/5/6 share ONE
67
67
  // ceiling+scope+expiry implementation (RULING 1 / AC-13 defense-in-depth): a
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.js","sourceRoot":"","sources":["../../../src/authorization/gates/tenant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,YAAY,EACZ,QAAQ,GAIT,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,KAAK,UAAU,UAAU,CAAC,GAAgB;QAC/C,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;QAElD,6EAA6E;QAC7E,8EAA8E;QAC9E,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAChF,OAAO,YAAY,EAAE,CAAC;QACxB,CAAC;QAED,6EAA6E;QAC7E,qEAAqE;QACrE,IAAI,UAAU,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAC9C,OAAO,YAAY,EAAE,CAAC;QACxB,CAAC;QAED,2EAA2E;QAC3E,gFAAgF;QAChF,yEAAyE;QACzE,gFAAgF;QAChF,8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F;QAChF,yEAAyE;QACzE,gFAAgF;QAChF,8EAA8E;QAC9E,gFAAgF;QAChF,iFAAiF;QACjF,8EAA8E;QAC9E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,4BAA4B,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC/E,SAAS;YACT,MAAM;YACN,QAAQ;SACT,CAAC,CAAC;QAEH,IAAI,UAAU,EAAE,CAAC;YACf,0EAA0E;YAC1E,0EAA0E;YAC1E,OAAO,YAAY,EAAE,CAAC;QACxB,CAAC;QAED,gFAAgF;QAChF,iEAAiE;QACjE,OAAO,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC;AACJ,CAAC"}
@@ -28,6 +28,16 @@ export type AccessTier = 'public' | 'authenticated_global' | 'gated';
28
28
  * `gated` (ADR-0004: unclassified ⇒ Gated, and absent a grant, denied).
29
29
  */
30
30
  export declare const DEFAULT_ACCESS_TIER: AccessTier;
31
+ /**
32
+ * The framework-wide DI token for the ONE {@link DecisionAuthority} (ADR-0001) — the single
33
+ * decision entry both the guard's enforcement layer and the engine's permission-gate stage
34
+ * consult. Defined HERE in `@astram/core` (the shared base both `@astram/guard` and
35
+ * `@astram/engine` already depend on) so neither has to import the other for it — breaking the
36
+ * `engine ↔ guard` import cycle a guard-local token would create. `@astram/guard` re-exports it
37
+ * for back-compat; `ShieldModule.forRoot()` provides it app-wide (default: the deny-by-default
38
+ * stub, overridable via the `decisionAuthority` option).
39
+ */
40
+ export declare const SHIELD_DECISION_AUTHORITY: unique symbol;
31
41
  /**
32
42
  * The **stable permission identity** a grant binds to (ADR-0010). It is derived
33
43
  * from the module/type/action *keys* — business-meaningful identifiers that
@@ -46,16 +56,34 @@ export type PermissionKey = string & {
46
56
  * A single-source constant so producers/consumers can't drift.
47
57
  */
48
58
  export declare const PERMISSION_KEY_SEPARATOR: ":";
59
+ /**
60
+ * The required format for each permission-key segment (moduleKey / typeKey /
61
+ * actionKey): `snake_case` — a lowercase letter, then lowercase letters, digits,
62
+ * and underscores. Single-source so the rule can't drift between producers.
63
+ * Enforced in {@link derivePermissionKey} as a fail-loud reject (never normalized),
64
+ * so every consumer app names its modules/types/actions uniformly and a casing
65
+ * typo fails at boot instead of silently denying at request time.
66
+ */
67
+ export declare const SEGMENT_FORMAT: RegExp;
49
68
  /**
50
69
  * Derive the stable permission identity `feature:object:action` from a module's
51
70
  * `moduleKey`, an object type's `typeKey`, and an action's `actionKey`
52
71
  * (ADR-0010, confirmed decision #1). PURE — no I/O, no state, deterministic.
53
72
  *
54
73
  * This is the ONLY sanctioned way to construct a {@link PermissionKey}; grants
55
- * bind to its result. Segments must be non-empty and free of the separator so
56
- * the key round-trips unambiguously.
74
+ * bind to its result. Segments must be non-empty, free of the separator, and in
75
+ * `snake_case` so the key round-trips unambiguously AND every consumer app names
76
+ * its modules/types/actions uniformly.
77
+ *
78
+ * `snake_case` = {@link SEGMENT_FORMAT} = lowercase start, then lowercase letters,
79
+ * digits, and underscores (`^[a-z][a-z0-9_]*$`). This is enforced here — the single
80
+ * sanctioned key constructor — so a stray `CompanyBranch`/`company-branch` typeKey
81
+ * is a HARD, loud failure at boot (when the registry builds keys), never a silent
82
+ * casing mismatch that denies at request time. It is a format REJECT, never a
83
+ * normalization: the key is used exactly as written (the gate compares with `===`),
84
+ * so we refuse a bad name rather than silently rewrite an identity string.
57
85
  *
58
- * @throws if any segment is empty or contains the `:` separator.
86
+ * @throws if any segment is empty, contains the `:` separator, or is not snake_case.
59
87
  */
60
88
  export declare function derivePermissionKey(moduleKey: string, typeKey: string, actionKey: string): PermissionKey;
61
89
  /**
@@ -98,7 +126,7 @@ export type DecisionEffect = 'allow' | 'deny';
98
126
  * failing gate/absent grant for troubleshooting, WITHOUT leaking the existence
99
127
  * of resources the principal may not know about (§7.5 / §13 privacy).
100
128
  */
101
- export type DecisionReasonCode = 'allowed' | 'not_authenticated' | 'tenant_mismatch' | 'missing_object_type_grant' | 'no_record_permit' | 'explicit_deny_policy' | 'resource_not_registered' | 'deny_by_default';
129
+ export type DecisionReasonCode = 'allowed' | 'not_authenticated' | 'tenant_mismatch' | 'missing_object_type_grant' | 'no_record_permit' | 'explicit_deny_policy' | 'resource_not_registered' | 'root_data_plane_denied' | 'deny_by_default';
102
130
  /** The output of the single decision function (§7.1, §7.5). */
103
131
  export interface Decision {
104
132
  readonly effect: DecisionEffect;
@@ -131,6 +159,7 @@ export * from './record/rule-evaluator.js';
131
159
  export * from './record/shares.js';
132
160
  export * from './cross-tenant/grant-evaluator.js';
133
161
  export * from './delegation/operation-identity.js';
162
+ export * from './record/owner-baseline.js';
134
163
  export * from './record/permit-tier.js';
135
164
  export * from './gates/wiring.js';
136
165
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,sBAAsB,GAAG,OAAO,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,UAAoB,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAG,GAAY,CAAC;AAErD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,aAAa,CAgBf;AAED;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,4EAA4E;IAC5E,QAAQ,CAAC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BAAyB,CAAC;AAExC,cAAc,oBAAoB,CAAC;AAInC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,4BAA4B,CAAC;AAE3C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,mCAAmC,CAAC;AAElD,cAAc,oCAAoC,CAAC;AAEnD,cAAc,4BAA4B,CAAC;AAE3C,cAAc,yBAAyB,CAAC;AAExC,cAAc,mBAAmB,CAAC"}
@@ -17,21 +17,49 @@
17
17
  * `gated` (ADR-0004: unclassified ⇒ Gated, and absent a grant, denied).
18
18
  */
19
19
  export const DEFAULT_ACCESS_TIER = 'gated';
20
+ /**
21
+ * The framework-wide DI token for the ONE {@link DecisionAuthority} (ADR-0001) — the single
22
+ * decision entry both the guard's enforcement layer and the engine's permission-gate stage
23
+ * consult. Defined HERE in `@astram/core` (the shared base both `@astram/guard` and
24
+ * `@astram/engine` already depend on) so neither has to import the other for it — breaking the
25
+ * `engine ↔ guard` import cycle a guard-local token would create. `@astram/guard` re-exports it
26
+ * for back-compat; `ShieldModule.forRoot()` provides it app-wide (default: the deny-by-default
27
+ * stub, overridable via the `decisionAuthority` option).
28
+ */
29
+ export const SHIELD_DECISION_AUTHORITY = Symbol('SHIELD_DECISION_AUTHORITY');
20
30
  /**
21
31
  * The separator between the three key segments of a {@link PermissionKey}.
22
32
  * A single-source constant so producers/consumers can't drift.
23
33
  */
24
34
  export const PERMISSION_KEY_SEPARATOR = ':';
35
+ /**
36
+ * The required format for each permission-key segment (moduleKey / typeKey /
37
+ * actionKey): `snake_case` — a lowercase letter, then lowercase letters, digits,
38
+ * and underscores. Single-source so the rule can't drift between producers.
39
+ * Enforced in {@link derivePermissionKey} as a fail-loud reject (never normalized),
40
+ * so every consumer app names its modules/types/actions uniformly and a casing
41
+ * typo fails at boot instead of silently denying at request time.
42
+ */
43
+ export const SEGMENT_FORMAT = /^[a-z][a-z0-9_]*$/;
25
44
  /**
26
45
  * Derive the stable permission identity `feature:object:action` from a module's
27
46
  * `moduleKey`, an object type's `typeKey`, and an action's `actionKey`
28
47
  * (ADR-0010, confirmed decision #1). PURE — no I/O, no state, deterministic.
29
48
  *
30
49
  * This is the ONLY sanctioned way to construct a {@link PermissionKey}; grants
31
- * bind to its result. Segments must be non-empty and free of the separator so
32
- * the key round-trips unambiguously.
50
+ * bind to its result. Segments must be non-empty, free of the separator, and in
51
+ * `snake_case` so the key round-trips unambiguously AND every consumer app names
52
+ * its modules/types/actions uniformly.
53
+ *
54
+ * `snake_case` = {@link SEGMENT_FORMAT} = lowercase start, then lowercase letters,
55
+ * digits, and underscores (`^[a-z][a-z0-9_]*$`). This is enforced here — the single
56
+ * sanctioned key constructor — so a stray `CompanyBranch`/`company-branch` typeKey
57
+ * is a HARD, loud failure at boot (when the registry builds keys), never a silent
58
+ * casing mismatch that denies at request time. It is a format REJECT, never a
59
+ * normalization: the key is used exactly as written (the gate compares with `===`),
60
+ * so we refuse a bad name rather than silently rewrite an identity string.
33
61
  *
34
- * @throws if any segment is empty or contains the `:` separator.
62
+ * @throws if any segment is empty, contains the `:` separator, or is not snake_case.
35
63
  */
36
64
  export function derivePermissionKey(moduleKey, typeKey, actionKey) {
37
65
  for (const [name, seg] of [
@@ -39,12 +67,17 @@ export function derivePermissionKey(moduleKey, typeKey, actionKey) {
39
67
  ['typeKey', typeKey],
40
68
  ['actionKey', actionKey],
41
69
  ]) {
70
+ // Order matters: empty and separator checks first so their existing error
71
+ // messages/wording are preserved, then the generic snake_case format check.
42
72
  if (seg.length === 0) {
43
73
  throw new Error(`derivePermissionKey: ${name} must be non-empty`);
44
74
  }
45
75
  if (seg.includes(PERMISSION_KEY_SEPARATOR)) {
46
76
  throw new Error(`derivePermissionKey: ${name} must not contain "${PERMISSION_KEY_SEPARATOR}" (got "${seg}")`);
47
77
  }
78
+ if (!SEGMENT_FORMAT.test(seg)) {
79
+ throw new Error(`derivePermissionKey: ${name} must be snake_case (${SEGMENT_FORMAT.source}) — got "${seg}"`);
80
+ }
48
81
  }
49
82
  return `${moduleKey}${PERMISSION_KEY_SEPARATOR}${typeKey}${PERMISSION_KEY_SEPARATOR}${actionKey}`;
50
83
  }
@@ -75,7 +108,9 @@ export * from './record/shares.js';
75
108
  export * from './cross-tenant/grant-evaluator.js';
76
109
  // - TEAM D: delegation overlay / trusted operation identity (gate 7):
77
110
  export * from './delegation/operation-identity.js';
78
- // - INTEGRATION: the composed gate-6 record permit tier (policy ∪ share, deny-wins):
111
+ // - FRAMEWORK BASELINE: the declaration-driven owner/system/tenantScoped permit (gate 6):
112
+ export * from './record/owner-baseline.js';
113
+ // - INTEGRATION: the composed gate-6 record permit tier (baseline ∪ policy ∪ share, deny-wins):
79
114
  export * from './record/permit-tier.js';
80
115
  // - INTEGRATION: the production gate-set wiring + fully-wired DecisionAuthority factory:
81
116
  export * from './gates/wiring.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgBH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAe,OAAO,CAAC;AAcvD;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAY,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAiB,EACjB,OAAe,EACf,SAAiB;IAEjB,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI;QACxB,CAAC,WAAW,EAAE,SAAS,CAAC;QACxB,CAAC,SAAS,EAAE,OAAO,CAAC;QACpB,CAAC,WAAW,EAAE,SAAS,CAAC;KAChB,EAAE,CAAC;QACX,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,oBAAoB,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC;YAC3C,MAAM,I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C,4EAA4E;AAC5E,cAAc,4BAA4B,CAAC;AAC3C,6EAA6E;AAC7E,cAAc,oBAAoB,CAAC;AACnC,sFAAsF;AACtF,cAAc,mCAAmC,CAAC;AAClD,wEAAwE;AACxE,cAAc,oCAAoC,CAAC;AACnD,4FAA4F;AAC5F,cAAc,4BAA4B,CAAC;AAC3C,kGAAkG;AAClG,cAAc,yBAAyB,CAAC;AACxC,2FAA2F;AAC3F,cAAc,mBAAmB,CAAC"}
@@ -178,7 +178,7 @@ export interface CrossTenantGrantQuery {
178
178
  * PROCEED for a principal whose tenant differs from the resource's — but it is a
179
179
  * HARD action-ceiling: it never widens beyond its declared `allowedActions`,
180
180
  * never crosses to a wildcard, and expires. The engine treats a grant as a
181
- * permit source, never as a superuser bypass.
181
+ * permit source, never as a root bypass.
182
182
  */
183
183
  export interface CrossTenantGrant {
184
184
  /** What the grant spans — a whole object type, or a single record. */
@@ -203,8 +203,8 @@ export interface CrossTenantGrant {
203
203
  }
204
204
  /**
205
205
  * Resolves an active cross-tenant consented grant (ADR-0009) — the ONLY sanctioned
206
- * way a principal reaches a resource owned by a different tenant (short of platform
207
- * superuser). A grant lets gate 3 PROCEED and is a permit source in gate 6, bounded
206
+ * way a principal reaches a resource owned by a different tenant (short of root).
207
+ * A grant lets gate 3 PROCEED and is a permit source in gate 6, bounded
208
208
  * by its action ceiling + expiry.
209
209
  *
210
210
  * Concrete adapter ships in `@astram/guard`.
@@ -37,7 +37,7 @@ export declare function allow(): Decision;
37
37
  export declare function denyNotAuthenticated(detail?: string): Decision;
38
38
  /**
39
39
  * DENY — gate 3 (tenant gate): the principal's tenant differs from the resource's,
40
- * with no active cross-tenant grant and not a platform superuser. Reason
40
+ * with no active cross-tenant grant and not a root. Reason
41
41
  * `tenant_mismatch`. FINAL — the tenant boundary is never relaxed downstream.
42
42
  */
43
43
  export declare function denyTenantMismatch(detail?: string): Decision;
@@ -58,6 +58,12 @@ export declare function denyNoRecordPermit(detail?: string): Decision;
58
58
  * deny matched. Overrides any share/grant widening. Reason `explicit_deny_policy`.
59
59
  */
60
60
  export declare function denyExplicitPolicy(detail?: string): Decision;
61
+ /**
62
+ * DENY — the ROOT CAP: a root attempted a DATA-PLANE
63
+ * capability. Root is control-plane only (§0/§2); data-plane is denied by
64
+ * construction, grant-independent. Reason `root_data_plane_denied`.
65
+ */
66
+ export declare function denyRootDataPlane(detail?: string): Decision;
61
67
  /**
62
68
  * DENY — gate 0 (resource registration): the resource's object type is not
63
69
  * registered with the {@link ModuleRegistry} (unregistered ⇒ Deny, §5.4/5.5).
@@ -1 +1 @@
1
- {"version":3,"file":"reason-codes.d.ts","sourceRoot":"","sources":["../../src/authorization/reason-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,QAAQ,CAEhC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE5D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAEnE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAEvD"}
1
+ {"version":3,"file":"reason-codes.d.ts","sourceRoot":"","sources":["../../src/authorization/reason-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,QAAQ,CAEhC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE5D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAEnE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAEvD"}
@@ -42,7 +42,7 @@ export function denyNotAuthenticated(detail) {
42
42
  }
43
43
  /**
44
44
  * DENY — gate 3 (tenant gate): the principal's tenant differs from the resource's,
45
- * with no active cross-tenant grant and not a platform superuser. Reason
45
+ * with no active cross-tenant grant and not a root. Reason
46
46
  * `tenant_mismatch`. FINAL — the tenant boundary is never relaxed downstream.
47
47
  */
48
48
  export function denyTenantMismatch(detail) {
@@ -71,6 +71,14 @@ export function denyNoRecordPermit(detail) {
71
71
  export function denyExplicitPolicy(detail) {
72
72
  return freezeDeny('explicit_deny_policy', detail);
73
73
  }
74
+ /**
75
+ * DENY — the ROOT CAP: a root attempted a DATA-PLANE
76
+ * capability. Root is control-plane only (§0/§2); data-plane is denied by
77
+ * construction, grant-independent. Reason `root_data_plane_denied`.
78
+ */
79
+ export function denyRootDataPlane(detail) {
80
+ return freezeDeny('root_data_plane_denied', detail);
81
+ }
74
82
  /**
75
83
  * DENY — gate 0 (resource registration): the resource's object type is not
76
84
  * registered with the {@link ModuleRegistry} (unregistered ⇒ Deny, §5.4/5.5).
@@ -1 +1 @@
1
- {"version":3,"file":"reason-codes.js","sourceRoot":"","sources":["../../src/authorization/reason-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,OAAO,CAAC,KAAK,IAAI,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK;IACnB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAe;IAClD,OAAO,UAAU,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAe;IAChD,OAAO,UAAU,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAe;IACxD,OAAO,UAAU,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,C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