@astram/core 0.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.
- package/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/admin/admin-service.d.ts +221 -0
- package/dist/admin/admin-service.d.ts.map +1 -0
- package/dist/admin/admin-service.js +155 -0
- package/dist/admin/admin-service.js.map +1 -0
- package/dist/admin/command/grants.d.ts +40 -0
- package/dist/admin/command/grants.d.ts.map +1 -0
- package/dist/admin/command/grants.js +196 -0
- package/dist/admin/command/grants.js.map +1 -0
- package/dist/admin/command/index.d.ts +23 -0
- package/dist/admin/command/index.d.ts.map +1 -0
- package/dist/admin/command/index.js +23 -0
- package/dist/admin/command/index.js.map +1 -0
- package/dist/admin/command/invitations.d.ts +72 -0
- package/dist/admin/command/invitations.d.ts.map +1 -0
- package/dist/admin/command/invitations.js +241 -0
- package/dist/admin/command/invitations.js.map +1 -0
- package/dist/admin/command/permissions.d.ts +33 -0
- package/dist/admin/command/permissions.d.ts.map +1 -0
- package/dist/admin/command/permissions.js +67 -0
- package/dist/admin/command/permissions.js.map +1 -0
- package/dist/admin/command/pipeline.d.ts +79 -0
- package/dist/admin/command/pipeline.d.ts.map +1 -0
- package/dist/admin/command/pipeline.js +106 -0
- package/dist/admin/command/pipeline.js.map +1 -0
- package/dist/admin/command/policies.d.ts +50 -0
- package/dist/admin/command/policies.d.ts.map +1 -0
- package/dist/admin/command/policies.js +219 -0
- package/dist/admin/command/policies.js.map +1 -0
- package/dist/admin/command/service-accounts.d.ts +58 -0
- package/dist/admin/command/service-accounts.d.ts.map +1 -0
- package/dist/admin/command/service-accounts.js +272 -0
- package/dist/admin/command/service-accounts.js.map +1 -0
- package/dist/admin/command/service.d.ts +65 -0
- package/dist/admin/command/service.d.ts.map +1 -0
- package/dist/admin/command/service.js +128 -0
- package/dist/admin/command/service.js.map +1 -0
- package/dist/admin/command/tiers.d.ts +40 -0
- package/dist/admin/command/tiers.d.ts.map +1 -0
- package/dist/admin/command/tiers.js +79 -0
- package/dist/admin/command/tiers.js.map +1 -0
- package/dist/admin/index.d.ts +36 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +63 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/ports.d.ts +288 -0
- package/dist/admin/ports.d.ts.map +1 -0
- package/dist/admin/ports.js +39 -0
- package/dist/admin/ports.js.map +1 -0
- package/dist/admin/query/audit-view.d.ts +52 -0
- package/dist/admin/query/audit-view.d.ts.map +1 -0
- package/dist/admin/query/audit-view.js +84 -0
- package/dist/admin/query/audit-view.js.map +1 -0
- package/dist/admin/query/catalog.d.ts +70 -0
- package/dist/admin/query/catalog.d.ts.map +1 -0
- package/dist/admin/query/catalog.js +169 -0
- package/dist/admin/query/catalog.js.map +1 -0
- package/dist/admin/query/explain.d.ts +52 -0
- package/dist/admin/query/explain.d.ts.map +1 -0
- package/dist/admin/query/explain.js +145 -0
- package/dist/admin/query/explain.js.map +1 -0
- package/dist/admin/query/index.d.ts +45 -0
- package/dist/admin/query/index.d.ts.map +1 -0
- package/dist/admin/query/index.js +58 -0
- package/dist/admin/query/index.js.map +1 -0
- package/dist/admin/query/simulate.d.ts +42 -0
- package/dist/admin/query/simulate.d.ts.map +1 -0
- package/dist/admin/query/simulate.js +91 -0
- package/dist/admin/query/simulate.js.map +1 -0
- package/dist/admin/safeguards-impl.d.ts +67 -0
- package/dist/admin/safeguards-impl.d.ts.map +1 -0
- package/dist/admin/safeguards-impl.js +318 -0
- package/dist/admin/safeguards-impl.js.map +1 -0
- package/dist/admin/safeguards.d.ts +89 -0
- package/dist/admin/safeguards.d.ts.map +1 -0
- package/dist/admin/safeguards.js +91 -0
- package/dist/admin/safeguards.js.map +1 -0
- package/dist/admin/types.d.ts +485 -0
- package/dist/admin/types.d.ts.map +1 -0
- package/dist/admin/types.js +38 -0
- package/dist/admin/types.js.map +1 -0
- package/dist/audit/audit-recorder.d.ts +129 -0
- package/dist/audit/audit-recorder.d.ts.map +1 -0
- package/dist/audit/audit-recorder.js +265 -0
- package/dist/audit/audit-recorder.js.map +1 -0
- package/dist/audit/canonicalize.d.ts +38 -0
- package/dist/audit/canonicalize.d.ts.map +1 -0
- package/dist/audit/canonicalize.js +174 -0
- package/dist/audit/canonicalize.js.map +1 -0
- package/dist/audit/errors.d.ts +56 -0
- package/dist/audit/errors.d.ts.map +1 -0
- package/dist/audit/errors.js +41 -0
- package/dist/audit/errors.js.map +1 -0
- package/dist/audit/index.d.ts +45 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/index.js +24 -0
- package/dist/audit/index.js.map +1 -0
- package/dist/audit/ports.d.ts +131 -0
- package/dist/audit/ports.d.ts.map +1 -0
- package/dist/audit/ports.js +27 -0
- package/dist/audit/ports.js.map +1 -0
- package/dist/audit/sensitive.d.ts +68 -0
- package/dist/audit/sensitive.d.ts.map +1 -0
- package/dist/audit/sensitive.js +159 -0
- package/dist/audit/sensitive.js.map +1 -0
- package/dist/audit/walk.d.ts +109 -0
- package/dist/audit/walk.d.ts.map +1 -0
- package/dist/audit/walk.js +117 -0
- package/dist/audit/walk.js.map +1 -0
- package/dist/authentication/authenticator.d.ts +74 -0
- package/dist/authentication/authenticator.d.ts.map +1 -0
- package/dist/authentication/authenticator.js +208 -0
- package/dist/authentication/authenticator.js.map +1 -0
- package/dist/authentication/credential-resolver.d.ts +76 -0
- package/dist/authentication/credential-resolver.d.ts.map +1 -0
- package/dist/authentication/credential-resolver.js +21 -0
- package/dist/authentication/credential-resolver.js.map +1 -0
- package/dist/authentication/index.d.ts +52 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +27 -0
- package/dist/authentication/index.js.map +1 -0
- package/dist/authentication/password-hasher.d.ts +41 -0
- package/dist/authentication/password-hasher.d.ts.map +1 -0
- package/dist/authentication/password-hasher.js +21 -0
- package/dist/authentication/password-hasher.js.map +1 -0
- package/dist/authentication/totp.d.ts +101 -0
- package/dist/authentication/totp.d.ts.map +1 -0
- package/dist/authentication/totp.js +151 -0
- package/dist/authentication/totp.js.map +1 -0
- package/dist/authorization/cross-tenant/grant-evaluator.d.ts +90 -0
- package/dist/authorization/cross-tenant/grant-evaluator.d.ts.map +1 -0
- package/dist/authorization/cross-tenant/grant-evaluator.js +165 -0
- package/dist/authorization/cross-tenant/grant-evaluator.js.map +1 -0
- package/dist/authorization/decision-authority.d.ts +212 -0
- package/dist/authorization/decision-authority.d.ts.map +1 -0
- package/dist/authorization/decision-authority.js +200 -0
- package/dist/authorization/decision-authority.js.map +1 -0
- package/dist/authorization/default-gates.d.ts +41 -0
- package/dist/authorization/default-gates.d.ts.map +1 -0
- package/dist/authorization/default-gates.js +47 -0
- package/dist/authorization/default-gates.js.map +1 -0
- package/dist/authorization/delegation/operation-identity.d.ts +132 -0
- package/dist/authorization/delegation/operation-identity.d.ts.map +1 -0
- package/dist/authorization/delegation/operation-identity.js +220 -0
- package/dist/authorization/delegation/operation-identity.js.map +1 -0
- package/dist/authorization/errors.d.ts +54 -0
- package/dist/authorization/errors.d.ts.map +1 -0
- package/dist/authorization/errors.js +63 -0
- package/dist/authorization/errors.js.map +1 -0
- package/dist/authorization/gates/object-type.d.ts +63 -0
- package/dist/authorization/gates/object-type.d.ts.map +1 -0
- package/dist/authorization/gates/object-type.js +177 -0
- package/dist/authorization/gates/object-type.js.map +1 -0
- package/dist/authorization/gates/tenant.d.ts +50 -0
- package/dist/authorization/gates/tenant.d.ts.map +1 -0
- package/dist/authorization/gates/tenant.js +87 -0
- package/dist/authorization/gates/tenant.js.map +1 -0
- package/dist/authorization/gates/wiring.d.ts +57 -0
- package/dist/authorization/gates/wiring.d.ts.map +1 -0
- package/dist/authorization/gates/wiring.js +56 -0
- package/dist/authorization/gates/wiring.js.map +1 -0
- package/dist/authorization/index.d.ts +136 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +82 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/authorization/ports.d.ts +271 -0
- package/dist/authorization/ports.d.ts.map +1 -0
- package/dist/authorization/ports.js +36 -0
- package/dist/authorization/ports.js.map +1 -0
- package/dist/authorization/reason-codes.d.ts +75 -0
- package/dist/authorization/reason-codes.d.ts.map +1 -0
- package/dist/authorization/reason-codes.js +98 -0
- package/dist/authorization/reason-codes.js.map +1 -0
- package/dist/authorization/record/permit-tier.d.ts +57 -0
- package/dist/authorization/record/permit-tier.d.ts.map +1 -0
- package/dist/authorization/record/permit-tier.js +79 -0
- package/dist/authorization/record/permit-tier.js.map +1 -0
- package/dist/authorization/record/rule-evaluator.d.ts +116 -0
- package/dist/authorization/record/rule-evaluator.d.ts.map +1 -0
- package/dist/authorization/record/rule-evaluator.js +125 -0
- package/dist/authorization/record/rule-evaluator.js.map +1 -0
- package/dist/authorization/record/shares.d.ts +70 -0
- package/dist/authorization/record/shares.d.ts.map +1 -0
- package/dist/authorization/record/shares.js +107 -0
- package/dist/authorization/record/shares.js.map +1 -0
- package/dist/identity/broker.d.ts +59 -0
- package/dist/identity/broker.d.ts.map +1 -0
- package/dist/identity/broker.js +135 -0
- package/dist/identity/broker.js.map +1 -0
- package/dist/identity/claim-mapper.d.ts +84 -0
- package/dist/identity/claim-mapper.d.ts.map +1 -0
- package/dist/identity/claim-mapper.js +48 -0
- package/dist/identity/claim-mapper.js.map +1 -0
- package/dist/identity/index.d.ts +60 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +24 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/internal-adapter.d.ts +54 -0
- package/dist/identity/internal-adapter.d.ts.map +1 -0
- package/dist/identity/internal-adapter.js +88 -0
- package/dist/identity/internal-adapter.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata/completeness.d.ts +136 -0
- package/dist/metadata/completeness.d.ts.map +1 -0
- package/dist/metadata/completeness.js +106 -0
- package/dist/metadata/completeness.js.map +1 -0
- package/dist/metadata/dependencies.d.ts +114 -0
- package/dist/metadata/dependencies.d.ts.map +1 -0
- package/dist/metadata/dependencies.js +105 -0
- package/dist/metadata/dependencies.js.map +1 -0
- package/dist/metadata/index.d.ts +153 -0
- package/dist/metadata/index.d.ts.map +1 -0
- package/dist/metadata/index.js +51 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/metadata/registry.d.ts +23 -0
- package/dist/metadata/registry.d.ts.map +1 -0
- package/dist/metadata/registry.js +204 -0
- package/dist/metadata/registry.js.map +1 -0
- package/dist/risk/evaluator.d.ts +76 -0
- package/dist/risk/evaluator.d.ts.map +1 -0
- package/dist/risk/evaluator.js +59 -0
- package/dist/risk/evaluator.js.map +1 -0
- package/dist/risk/index.d.ts +40 -0
- package/dist/risk/index.d.ts.map +1 -0
- package/dist/risk/index.js +20 -0
- package/dist/risk/index.js.map +1 -0
- package/dist/risk/risk-engine.d.ts +76 -0
- package/dist/risk/risk-engine.d.ts.map +1 -0
- package/dist/risk/risk-engine.js +287 -0
- package/dist/risk/risk-engine.js.map +1 -0
- package/dist/risk/signals.d.ts +60 -0
- package/dist/risk/signals.d.ts.map +1 -0
- package/dist/risk/signals.js +104 -0
- package/dist/risk/signals.js.map +1 -0
- package/dist/risk/thresholds.d.ts +54 -0
- package/dist/risk/thresholds.d.ts.map +1 -0
- package/dist/risk/thresholds.js +60 -0
- package/dist/risk/thresholds.js.map +1 -0
- package/dist/session/index.d.ts +47 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +20 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/lifetimes.d.ts +50 -0
- package/dist/session/lifetimes.d.ts.map +1 -0
- package/dist/session/lifetimes.js +67 -0
- package/dist/session/lifetimes.js.map +1 -0
- package/dist/session/ports.d.ts +266 -0
- package/dist/session/ports.d.ts.map +1 -0
- package/dist/session/ports.js +23 -0
- package/dist/session/ports.js.map +1 -0
- package/dist/session/session-authority.d.ts +97 -0
- package/dist/session/session-authority.d.ts.map +1 -0
- package/dist/session/session-authority.js +393 -0
- package/dist/session/session-authority.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Engine seam: **Authorization** — THE single decision authority.
|
|
3
|
+
*
|
|
4
|
+
* `decide(principal, action, resource, context) → Allow | Deny (+ reason)`
|
|
5
|
+
* (050 AUTHORIZATION_REQUIREMENTS §7.1). Every enforcement point calls this same
|
|
6
|
+
* authority — no divergent logic per feature/resource-level/principal-type.
|
|
7
|
+
*
|
|
8
|
+
* This module defines the decision **seam** (types + the `DecisionAuthority`
|
|
9
|
+
* interface) ONLY. The evaluation logic — hard gates → permit tier, conditions,
|
|
10
|
+
* tenancy, shares, delegation, cross-tenant grants — is built in a MUCH later
|
|
11
|
+
* layer (050). Nothing here evaluates anything.
|
|
12
|
+
*
|
|
13
|
+
* ADR-0003: framework-agnostic.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The default access tier applied when an action carries no explicit tier —
|
|
17
|
+
* `gated` (ADR-0004: unclassified ⇒ Gated, and absent a grant, denied).
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_ACCESS_TIER = 'gated';
|
|
20
|
+
/**
|
|
21
|
+
* The separator between the three key segments of a {@link PermissionKey}.
|
|
22
|
+
* A single-source constant so producers/consumers can't drift.
|
|
23
|
+
*/
|
|
24
|
+
export const PERMISSION_KEY_SEPARATOR = ':';
|
|
25
|
+
/**
|
|
26
|
+
* Derive the stable permission identity `feature:object:action` from a module's
|
|
27
|
+
* `moduleKey`, an object type's `typeKey`, and an action's `actionKey`
|
|
28
|
+
* (ADR-0010, confirmed decision #1). PURE — no I/O, no state, deterministic.
|
|
29
|
+
*
|
|
30
|
+
* 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.
|
|
33
|
+
*
|
|
34
|
+
* @throws if any segment is empty or contains the `:` separator.
|
|
35
|
+
*/
|
|
36
|
+
export function derivePermissionKey(moduleKey, typeKey, actionKey) {
|
|
37
|
+
for (const [name, seg] of [
|
|
38
|
+
['moduleKey', moduleKey],
|
|
39
|
+
['typeKey', typeKey],
|
|
40
|
+
['actionKey', actionKey],
|
|
41
|
+
]) {
|
|
42
|
+
if (seg.length === 0) {
|
|
43
|
+
throw new Error(`derivePermissionKey: ${name} must be non-empty`);
|
|
44
|
+
}
|
|
45
|
+
if (seg.includes(PERMISSION_KEY_SEPARATOR)) {
|
|
46
|
+
throw new Error(`derivePermissionKey: ${name} must not contain "${PERMISSION_KEY_SEPARATOR}" (got "${seg}")`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return `${moduleKey}${PERMISSION_KEY_SEPARATOR}${typeKey}${PERMISSION_KEY_SEPARATOR}${actionKey}`;
|
|
50
|
+
}
|
|
51
|
+
// --- Engine implementation behind the FROZEN seam above (Layer 8) -------------
|
|
52
|
+
// APPEND-ONLY re-exports (mirrors identity/session/metadata barrels). Nothing
|
|
53
|
+
// above this line changes; the engine is added as SIBLING files.
|
|
54
|
+
// - the typed transient signal (ADR-0016):
|
|
55
|
+
export * from './errors.js';
|
|
56
|
+
// - the six evaluation PORTs (adapters ship in @astram/guard — Core stays zero-dep):
|
|
57
|
+
export * from './ports.js';
|
|
58
|
+
// - the Decision reason-code constructors + the strict-`===true` fail-open guard:
|
|
59
|
+
export * from './reason-codes.js';
|
|
60
|
+
// - the decision pipeline engine (gate order + fail-closed terminal) + the
|
|
61
|
+
// `createDecisionAuthority` factory + the gate-fn seam Teams A–D implement:
|
|
62
|
+
export * from './decision-authority.js';
|
|
63
|
+
// - the prelude's deny-by-default gate defaults (teams replace at integration):
|
|
64
|
+
export * from './default-gates.js';
|
|
65
|
+
// - INTEGRATION: the real team gate evaluators + composer + wiring, surfaced on the
|
|
66
|
+
// package barrel (append-only; nothing above this line changed).
|
|
67
|
+
// - TEAM A hard gates (tenant gate 3 + feature/object-type gate 5):
|
|
68
|
+
export * from './gates/tenant.js';
|
|
69
|
+
export * from './gates/object-type.js';
|
|
70
|
+
// - TEAM B: record_permission_rule POLICY evaluator (gate 6 policy half):
|
|
71
|
+
export * from './record/rule-evaluator.js';
|
|
72
|
+
// - TEAM C: per-record shares + cross-tenant grant (share half of gate 6):
|
|
73
|
+
export * from './record/shares.js';
|
|
74
|
+
// - TEAM C: shared cross-tenant grant scope/action-ceiling evaluator (gates 3/5/6):
|
|
75
|
+
export * from './cross-tenant/grant-evaluator.js';
|
|
76
|
+
// - TEAM D: delegation overlay / trusted operation identity (gate 7):
|
|
77
|
+
export * from './delegation/operation-identity.js';
|
|
78
|
+
// - INTEGRATION: the composed gate-6 record permit tier (policy ∪ share, deny-wins):
|
|
79
|
+
export * from './record/permit-tier.js';
|
|
80
|
+
// - INTEGRATION: the production gate-set wiring + fully-wired DecisionAuthority factory:
|
|
81
|
+
export * from './gates/wiring.js';
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,IAAI,KAAK,CACb,wBAAwB,IAAI,sBAAsB,wBAAwB,WAAW,GAAG,IAAI,CAC7F,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,GAAG,SAAS,GAAG,wBAAwB,GAAG,OAAO,GAAG,wBAAwB,GAAG,SAAS,EAAmB,CAAC;AACrH,CAAC;AAoFD,iFAAiF;AACjF,8EAA8E;AAC9E,iEAAiE;AACjE,6CAA6C;AAC7C,cAAc,aAAa,CAAC;AAC5B,uFAAuF;AACvF,cAAc,YAAY,CAAC;AAC3B,oFAAoF;AACpF,cAAc,mBAAmB,CAAC;AAClC,6EAA6E;AAC7E,gFAAgF;AAChF,cAAc,yBAAyB,CAAC;AACxC,kFAAkF;AAClF,cAAc,oBAAoB,CAAC;AACnC,sFAAsF;AACtF,qEAAqE;AACrE,sEAAsE;AACtE,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,4EAA4E;AAC5E,cAAc,4BAA4B,CAAC;AAC3C,6EAA6E;AAC7E,cAAc,oBAAoB,CAAC;AACnC,sFAAsF;AACtF,cAAc,mCAAmC,CAAC;AAClD,wEAAwE;AACxE,cAAc,oCAAoC,CAAC;AACnD,uFAAuF;AACvF,cAAc,yBAAyB,CAAC;AACxC,2FAA2F;AAC3F,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Authorization engine **PORTS** — the framework-agnostic contracts the
|
|
3
|
+
* `DecisionAuthority` engine (`./decision-authority.ts`) uses to reach the facts,
|
|
4
|
+
* rules, shares, cross-tenant grants, and delegated authority it needs to render a
|
|
5
|
+
* decision, WITHOUT the engine ever knowing which DB / cache backs them.
|
|
6
|
+
*
|
|
7
|
+
* ADR-0003 (zero-dep Core): every concrete adapter (MariaDB, Redis, …) is a real
|
|
8
|
+
* runtime dependency and CANNOT live here. The Core defines only these interfaces;
|
|
9
|
+
* `@astram/guard` ships the concretes and INJECTS them into
|
|
10
|
+
* `createDecisionAuthority(...)`. This keeps `@astram/core` at ZERO runtime
|
|
11
|
+
* dependencies while the substrate stays swappable.
|
|
12
|
+
*
|
|
13
|
+
* ⛔ TRANSIENT-vs-DENY (ADR-0016 / KICKOFF §"BINDING ARCHITECT DECISION") — every
|
|
14
|
+
* port method below distinguishes TWO fundamentally different "no" answers,
|
|
15
|
+
* mirroring Session's `found|absent|unavailable` trichotomy:
|
|
16
|
+
*
|
|
17
|
+
* 1. **Normal data-absence** — the store is UP and simply has no matching row
|
|
18
|
+
* (no rule / no share / no grant / facts genuinely empty). This is a legitimate
|
|
19
|
+
* **Deny INPUT**: it contributes to a returned `Decision` (`no_record_permit` /
|
|
20
|
+
* `missing_object_type_grant` / `deny_by_default`). The port returns the empty
|
|
21
|
+
* value (`false` / `null` / empty grants). It MUST NOT throw.
|
|
22
|
+
* 2. **Transient unavailable** — the store genuinely CANNOT answer (down, timeout,
|
|
23
|
+
* outage). The adapter MUST throw {@link AuthorizationUnavailableError} so the
|
|
24
|
+
* engine RE-THROWS it and the request fails closed as 503-retryable. It MUST
|
|
25
|
+
* NOT return an empty value (that would silently downgrade an outage to a Deny
|
|
26
|
+
* and erase the ADR-0016 retryable signal), and it MUST NOT fabricate a permit.
|
|
27
|
+
*
|
|
28
|
+
* ⛔ FAIL-OPEN DISCIPLINE (the Layer-5/6 bug class): a port returning a boolean
|
|
29
|
+
* verdict is gated by the engine on STRICT `=== true` (see `strictTrue` in
|
|
30
|
+
* `./reason-codes.ts`). A truthy non-boolean is NOT a pass. Adapters SHOULD return
|
|
31
|
+
* a genuine `boolean`; the engine defends regardless.
|
|
32
|
+
*
|
|
33
|
+
* ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
|
|
34
|
+
*/
|
|
35
|
+
import type { Principal } from '../identity/index.js';
|
|
36
|
+
import type { Action, Resource } from './index.js';
|
|
37
|
+
/**
|
|
38
|
+
* The coarse feature/object-type grants a principal holds in a tenant — the
|
|
39
|
+
* ADR-0011 "facts" projected at session establish and consumed by gate 5. Kept
|
|
40
|
+
* deliberately minimal + opaque-ish: a set of the stable {@link PermissionKey}
|
|
41
|
+
* strings the principal is granted, tagged with the version they were projected
|
|
42
|
+
* at so the engine can detect staleness against
|
|
43
|
+
* {@link PermissionFactsPort.currentPermissionsVersion}.
|
|
44
|
+
*
|
|
45
|
+
* This is the SAME shape that the Session hot record's `cachedFacts` slot carries
|
|
46
|
+
* (ADR-0011): gate 5 reads `cachedFacts` first and only falls back to
|
|
47
|
+
* {@link PermissionFactsPort.loadCoarseGrants} on a miss/stale-version.
|
|
48
|
+
*/
|
|
49
|
+
export interface CoarseGrants {
|
|
50
|
+
/**
|
|
51
|
+
* The version these grants were projected at (ADR-0011). Compared against the
|
|
52
|
+
* authority's `currentPermissionsVersion`; a lower value ⇒ STALE ⇒ reload.
|
|
53
|
+
*/
|
|
54
|
+
readonly permissionsVersion: number;
|
|
55
|
+
/**
|
|
56
|
+
* The stable permission-key strings this principal is granted at feature /
|
|
57
|
+
* object-type level, in this tenant. Membership is the coarse "does the
|
|
58
|
+
* principal hold ANY grant on this object type/action" fact gate 5 checks.
|
|
59
|
+
* A grant's PRESENCE is the permit; ABSENCE is a normal Deny input.
|
|
60
|
+
*/
|
|
61
|
+
readonly grantedPermissionKeys: readonly string[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Reads ADR-0011 permission facts — the version counter + the coarse grants — for
|
|
65
|
+
* gate 5's feature/object-type check. The engine reads the session's `cachedFacts`
|
|
66
|
+
* FIRST (hot path, no port call); this port fires ONLY on a cached miss or a
|
|
67
|
+
* stale-version reload.
|
|
68
|
+
*
|
|
69
|
+
* Concrete adapter ships in `@astram/guard`.
|
|
70
|
+
*/
|
|
71
|
+
export interface PermissionFactsPort {
|
|
72
|
+
/**
|
|
73
|
+
* The CURRENT authoritative permission version for this principal+tenant
|
|
74
|
+
* (ADR-0011). The engine compares it to the cached facts' version: if the cache
|
|
75
|
+
* is older, the cached grants are STALE and must be reloaded via
|
|
76
|
+
* {@link loadCoarseGrants} (so a revoke takes effect within the version bound).
|
|
77
|
+
*
|
|
78
|
+
* @returns a numeric version (0 or higher).
|
|
79
|
+
* @throws {@link AuthorizationUnavailableError} if the version store genuinely
|
|
80
|
+
* cannot answer (transient). It MUST NOT invent a version to paper over an
|
|
81
|
+
* outage — that would let the engine act on stale facts silently.
|
|
82
|
+
*/
|
|
83
|
+
currentPermissionsVersion(principalId: string, tenantId: string): Promise<number>;
|
|
84
|
+
/**
|
|
85
|
+
* Load (re-project) the coarse feature/object-type grants for this
|
|
86
|
+
* principal+tenant when the cache missed or was stale. A principal with NO
|
|
87
|
+
* grants returns a {@link CoarseGrants} with an EMPTY `grantedPermissionKeys`
|
|
88
|
+
* (a normal Deny input, NOT an error).
|
|
89
|
+
*
|
|
90
|
+
* @throws {@link AuthorizationUnavailableError} if the facts store genuinely
|
|
91
|
+
* cannot answer (transient). It MUST NOT return empty grants to mask an
|
|
92
|
+
* outage — an empty result MUST mean "genuinely no grants", never "couldn't
|
|
93
|
+
* read them".
|
|
94
|
+
*/
|
|
95
|
+
loadCoarseGrants(principalId: string, tenantId: string): Promise<CoarseGrants>;
|
|
96
|
+
}
|
|
97
|
+
/** Input to {@link RecordPermissionRulePort.evaluate} — the record-level question. */
|
|
98
|
+
export interface RulePermitInput {
|
|
99
|
+
readonly principal: Principal;
|
|
100
|
+
readonly action: Action;
|
|
101
|
+
/** The record-level resource (level `record`, with `recordId` + `tenantId`). */
|
|
102
|
+
readonly resource: Resource;
|
|
103
|
+
/** Ambient condition attributes (§7.4) — time/ip/etc. from the decision context. */
|
|
104
|
+
readonly attributes?: Readonly<Record<string, unknown>>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The outcome of evaluating record_permission_rule policy for one record+action
|
|
108
|
+
* (ADR-0005). Deny-wins: `explicitDeny === true` OVERRIDES any `allow` from this
|
|
109
|
+
* or any other permit source (a matching deny rule is final within gate 6).
|
|
110
|
+
*/
|
|
111
|
+
export interface RulePermit {
|
|
112
|
+
/** A policy rule affirmatively permits this record+action. */
|
|
113
|
+
readonly allow: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* A policy rule EXPLICITLY denies this record+action (deny-wins, §7.3.4). When
|
|
116
|
+
* `true`, the decision is `explicit_deny_policy` regardless of any share/grant —
|
|
117
|
+
* deny beats every widening. The engine gates BOTH booleans on strict `=== true`.
|
|
118
|
+
*/
|
|
119
|
+
readonly explicitDeny: boolean;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Evaluates record_permission_rule policy for a single record+action (ADR-0005).
|
|
123
|
+
* Returns a {@link RulePermit} whose two booleans the engine reads with deny-wins
|
|
124
|
+
* precedence.
|
|
125
|
+
*
|
|
126
|
+
* Concrete adapter (rule storage + condition evaluation) ships in `@astram/guard`.
|
|
127
|
+
*/
|
|
128
|
+
export interface RecordPermissionRulePort {
|
|
129
|
+
/**
|
|
130
|
+
* Evaluate the policy for this record+action. NO applicable rule ⇒
|
|
131
|
+
* `{ allow: false, explicitDeny: false }` (a normal Deny input — absence of a
|
|
132
|
+
* permit, NOT an error, NOT a deny). A matching allow ⇒ `allow: true`; a matching
|
|
133
|
+
* deny ⇒ `explicitDeny: true` (deny-wins).
|
|
134
|
+
*
|
|
135
|
+
* @throws {@link AuthorizationUnavailableError} if the rule store genuinely
|
|
136
|
+
* cannot answer (transient). It MUST NOT return `allow:false/explicitDeny:false`
|
|
137
|
+
* to mask an outage — that would silently downgrade an outage to a Deny.
|
|
138
|
+
*/
|
|
139
|
+
evaluate(input: RulePermitInput): Promise<RulePermit>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Resolves per-record shares / ACL entries (ADR-0006). A share is a WIDENING
|
|
143
|
+
* permit source unioned with rule + grant WITHIN gate 6 — it can grant access an
|
|
144
|
+
* absent rule wouldn't, but it can NEVER override an `explicitDeny` (deny-wins).
|
|
145
|
+
*
|
|
146
|
+
* Concrete adapter ships in `@astram/guard`.
|
|
147
|
+
*/
|
|
148
|
+
export interface RecordSharePort {
|
|
149
|
+
/**
|
|
150
|
+
* Whether the principal (by id or any of its roles) has an active share on this
|
|
151
|
+
* record for this action (ADR-0006). NO share ⇒ `false` (a normal Deny input —
|
|
152
|
+
* absence of a permit). The engine gates the result on strict `=== true`.
|
|
153
|
+
*
|
|
154
|
+
* @throws {@link AuthorizationUnavailableError} if the share store genuinely
|
|
155
|
+
* cannot answer (transient). It MUST NOT return `false` to mask an outage.
|
|
156
|
+
*/
|
|
157
|
+
hasShare(principalId: string, roleIds: readonly string[], typeKey: string, recordId: string, action: string): Promise<boolean>;
|
|
158
|
+
}
|
|
159
|
+
/** The two scopes a cross-tenant grant may span (ADR-0009). */
|
|
160
|
+
export type CrossTenantGrantScope = 'object_type' | 'record';
|
|
161
|
+
/** Input to {@link CrossTenantGrantPort.findActiveGrant}. */
|
|
162
|
+
export interface CrossTenantGrantQuery {
|
|
163
|
+
/** The grantee principal id (the caller crossing into another tenant). */
|
|
164
|
+
readonly grantee: string;
|
|
165
|
+
/** The grantee's role ids (a grant may be role-scoped). */
|
|
166
|
+
readonly roleIds: readonly string[];
|
|
167
|
+
/** The tenant that OWNS the resource being reached into. */
|
|
168
|
+
readonly owningTenantId: string;
|
|
169
|
+
/** Stable object-type key the grant must cover. */
|
|
170
|
+
readonly typeKey: string;
|
|
171
|
+
/** The action the caller is attempting — checked against the grant's ceiling. */
|
|
172
|
+
readonly action: string;
|
|
173
|
+
/** For record-scoped grants: the specific record id. */
|
|
174
|
+
readonly recordId?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* An active, consented cross-tenant grant (ADR-0009). It lets the tenant gate
|
|
178
|
+
* PROCEED for a principal whose tenant differs from the resource's — but it is a
|
|
179
|
+
* HARD action-ceiling: it never widens beyond its declared `allowedActions`,
|
|
180
|
+
* never crosses to a wildcard, and expires. The engine treats a grant as a
|
|
181
|
+
* permit source, never as a superuser bypass.
|
|
182
|
+
*/
|
|
183
|
+
export interface CrossTenantGrant {
|
|
184
|
+
/** What the grant spans — a whole object type, or a single record. */
|
|
185
|
+
readonly scope: CrossTenantGrantScope;
|
|
186
|
+
/** The object type the grant covers. */
|
|
187
|
+
readonly typeKey: string;
|
|
188
|
+
/** For a `record`-scoped grant: the covered record id. */
|
|
189
|
+
readonly recordId?: string;
|
|
190
|
+
/**
|
|
191
|
+
* ⛔ The ACTION CEILING (ADR-0009): the exact set of stable action keys this
|
|
192
|
+
* grant permits. NEVER a wildcard; the engine allows an action ONLY if it is a
|
|
193
|
+
* member of this set. An action outside it is denied even though the grant is
|
|
194
|
+
* active — the ceiling is hard.
|
|
195
|
+
*/
|
|
196
|
+
readonly allowedActions: readonly string[];
|
|
197
|
+
/**
|
|
198
|
+
* UTC epoch ms this grant expires (ADR-0009). The engine treats a grant with
|
|
199
|
+
* `expiresAtMs <= now` as INACTIVE (expired ⇒ no proceed). The clock is the
|
|
200
|
+
* engine's; adapters return the stored expiry.
|
|
201
|
+
*/
|
|
202
|
+
readonly expiresAtMs: number;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
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
|
|
208
|
+
* by its action ceiling + expiry.
|
|
209
|
+
*
|
|
210
|
+
* Concrete adapter ships in `@astram/guard`.
|
|
211
|
+
*/
|
|
212
|
+
export interface CrossTenantGrantPort {
|
|
213
|
+
/**
|
|
214
|
+
* Find an ACTIVE (unexpired, unrevoked, consented) grant matching the query, or
|
|
215
|
+
* `null` when none applies. `null` is a normal Deny input (no cross-tenant
|
|
216
|
+
* consent) — it is NOT an error. The engine additionally re-checks the returned
|
|
217
|
+
* grant's `allowedActions` + `expiresAtMs` (defense-in-depth) before honoring it.
|
|
218
|
+
*
|
|
219
|
+
* @throws {@link AuthorizationUnavailableError} if the grant store genuinely
|
|
220
|
+
* cannot answer (transient). It MUST NOT return `null` to mask an outage —
|
|
221
|
+
* `null` MUST mean "genuinely no active grant".
|
|
222
|
+
*/
|
|
223
|
+
findActiveGrant(query: CrossTenantGrantQuery): Promise<CrossTenantGrant | null>;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* A delegated authority a trusted operation declares for one of its steps
|
|
227
|
+
* (ADR-0008). It is a SCOPED, non-wildcard authority under which gates 3–6 are
|
|
228
|
+
* re-evaluated — NOT the caller's grants, and NEVER broader than declared.
|
|
229
|
+
*
|
|
230
|
+
* The tenant gate STILL applies under the operation's scope (delegation never
|
|
231
|
+
* crosses tenants unless a cross-tenant grant also applies); the delegated
|
|
232
|
+
* authority cannot exceed its declared object-type + action set.
|
|
233
|
+
*/
|
|
234
|
+
export interface DelegatedAuthority {
|
|
235
|
+
/**
|
|
236
|
+
* ⛔ The declared object-type key(s) this delegated step may act on. NEVER a
|
|
237
|
+
* wildcard — an operation must name the exact object types it delegates over.
|
|
238
|
+
* A step attempting an object type outside this set gets no delegated authority.
|
|
239
|
+
*/
|
|
240
|
+
readonly objectTypeKeys: readonly string[];
|
|
241
|
+
/**
|
|
242
|
+
* ⛔ The declared action-key ceiling for the delegated step. The delegated
|
|
243
|
+
* evaluation may permit ONLY these actions; anything outside is denied even if
|
|
244
|
+
* the operation is trusted. Never a wildcard.
|
|
245
|
+
*/
|
|
246
|
+
readonly allowedActions: readonly string[];
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Resolves the declared, scoped authority a trusted operation's step carries
|
|
250
|
+
* (ADR-0008). PURE lookup of DECLARED metadata (the operation's own manifest), not
|
|
251
|
+
* the caller's live grants — so this port is intentionally SYNCHRONOUS and is not
|
|
252
|
+
* expected to perform I/O for the declaration (it reads registered operation
|
|
253
|
+
* metadata). `undefined` ⇒ pass-through: NO delegation, evaluate under the caller.
|
|
254
|
+
*
|
|
255
|
+
* Concrete adapter (operation-manifest lookup) ships in `@astram/guard`.
|
|
256
|
+
*/
|
|
257
|
+
export interface OperationAuthorityPort {
|
|
258
|
+
/**
|
|
259
|
+
* Resolve the delegated authority for `operationKey`'s `stepKey`, or `undefined`
|
|
260
|
+
* for pass-through (evaluate under the caller's own identity/grants). `undefined`
|
|
261
|
+
* is the NORMAL, common case — not an error, not a deny. A returned authority is
|
|
262
|
+
* the SCOPED ceiling gates 3–6 re-run under; it can only NARROW, never widen.
|
|
263
|
+
*
|
|
264
|
+
* This resolves DECLARED metadata, so it does not represent a transient store; an
|
|
265
|
+
* implementation that must reach a store MAY throw
|
|
266
|
+
* {@link AuthorizationUnavailableError} on a genuine outage, but the common path
|
|
267
|
+
* is a pure, in-memory declaration lookup returning `undefined` or an authority.
|
|
268
|
+
*/
|
|
269
|
+
resolveDelegatedAuthority(operationKey: string, stepKey: string): DelegatedAuthority | undefined;
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/authorization/ports.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Authorization engine **PORTS** — the framework-agnostic contracts the
|
|
3
|
+
* `DecisionAuthority` engine (`./decision-authority.ts`) uses to reach the facts,
|
|
4
|
+
* rules, shares, cross-tenant grants, and delegated authority it needs to render a
|
|
5
|
+
* decision, WITHOUT the engine ever knowing which DB / cache backs them.
|
|
6
|
+
*
|
|
7
|
+
* ADR-0003 (zero-dep Core): every concrete adapter (MariaDB, Redis, …) is a real
|
|
8
|
+
* runtime dependency and CANNOT live here. The Core defines only these interfaces;
|
|
9
|
+
* `@astram/guard` ships the concretes and INJECTS them into
|
|
10
|
+
* `createDecisionAuthority(...)`. This keeps `@astram/core` at ZERO runtime
|
|
11
|
+
* dependencies while the substrate stays swappable.
|
|
12
|
+
*
|
|
13
|
+
* ⛔ TRANSIENT-vs-DENY (ADR-0016 / KICKOFF §"BINDING ARCHITECT DECISION") — every
|
|
14
|
+
* port method below distinguishes TWO fundamentally different "no" answers,
|
|
15
|
+
* mirroring Session's `found|absent|unavailable` trichotomy:
|
|
16
|
+
*
|
|
17
|
+
* 1. **Normal data-absence** — the store is UP and simply has no matching row
|
|
18
|
+
* (no rule / no share / no grant / facts genuinely empty). This is a legitimate
|
|
19
|
+
* **Deny INPUT**: it contributes to a returned `Decision` (`no_record_permit` /
|
|
20
|
+
* `missing_object_type_grant` / `deny_by_default`). The port returns the empty
|
|
21
|
+
* value (`false` / `null` / empty grants). It MUST NOT throw.
|
|
22
|
+
* 2. **Transient unavailable** — the store genuinely CANNOT answer (down, timeout,
|
|
23
|
+
* outage). The adapter MUST throw {@link AuthorizationUnavailableError} so the
|
|
24
|
+
* engine RE-THROWS it and the request fails closed as 503-retryable. It MUST
|
|
25
|
+
* NOT return an empty value (that would silently downgrade an outage to a Deny
|
|
26
|
+
* and erase the ADR-0016 retryable signal), and it MUST NOT fabricate a permit.
|
|
27
|
+
*
|
|
28
|
+
* ⛔ FAIL-OPEN DISCIPLINE (the Layer-5/6 bug class): a port returning a boolean
|
|
29
|
+
* verdict is gated by the engine on STRICT `=== true` (see `strictTrue` in
|
|
30
|
+
* `./reason-codes.ts`). A truthy non-boolean is NOT a pass. Adapters SHOULD return
|
|
31
|
+
* a genuine `boolean`; the engine defends regardless.
|
|
32
|
+
*
|
|
33
|
+
* ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
|
|
34
|
+
*/
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=ports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/authorization/ports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reason-code MAPPING — the single-source constructors that turn a gate outcome
|
|
3
|
+
* into a frozen {@link Decision} (§7.5). Every gate + the pipeline build their
|
|
4
|
+
* `Decision` HERE, never by hand-rolling a `{ effect, reason }` literal, so the
|
|
5
|
+
* frozen {@link DecisionReasonCode} taxonomy has exactly one producer and cannot
|
|
6
|
+
* drift.
|
|
7
|
+
*
|
|
8
|
+
* ⛔ §7.5 NO-LEAK RULE: a Deny's `reason` names the failing gate for machine use,
|
|
9
|
+
* but must NEVER reveal the existence of a resource the principal may not know
|
|
10
|
+
* about. The optional `detail` is ADMIN-TROUBLESHOOTING ONLY — it is never
|
|
11
|
+
* returned to end users and must never encode resource existence, a UUID, or a
|
|
12
|
+
* grant's contents. Callers that surface a Decision to a user render the reason
|
|
13
|
+
* code (mapped to a generic message), not the detail.
|
|
14
|
+
*
|
|
15
|
+
* ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
|
|
16
|
+
*/
|
|
17
|
+
import type { Decision } from './index.js';
|
|
18
|
+
/**
|
|
19
|
+
* ⛔ THE LOAD-BEARING FAIL-OPEN GUARD (the Layer-5/6 bug class). Returns `true`
|
|
20
|
+
* ONLY for the boolean `true`; a truthy NON-boolean (`"true"`, `1`, `{}`, a
|
|
21
|
+
* hostile port's junk) is NOT a pass. EVERY port-boolean gate (share verdict,
|
|
22
|
+
* rule allow/deny, CAS-style wins, grant-action membership resolved to a boolean)
|
|
23
|
+
* MUST route its verdict through this before treating it as an Allow. This is what
|
|
24
|
+
* stops a misbehaving/hostile adapter from failing the decision OPEN.
|
|
25
|
+
*/
|
|
26
|
+
export declare function strictTrue(x: unknown): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* ALLOW (gate 1 public short-circuit, gate 4 authenticated-global short-circuit,
|
|
29
|
+
* gate 5 object-type grant held, gate 6 record permit held). The single Allow
|
|
30
|
+
* constructor — reason is always `allowed`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function allow(): Decision;
|
|
33
|
+
/**
|
|
34
|
+
* DENY — gate 2 (authentication gate): a non-public action reached by an
|
|
35
|
+
* unauthenticated request. Reason `not_authenticated`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function denyNotAuthenticated(detail?: string): Decision;
|
|
38
|
+
/**
|
|
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
|
|
41
|
+
* `tenant_mismatch`. FINAL — the tenant boundary is never relaxed downstream.
|
|
42
|
+
*/
|
|
43
|
+
export declare function denyTenantMismatch(detail?: string): Decision;
|
|
44
|
+
/**
|
|
45
|
+
* DENY — gate 5 (feature/object-type gate): a gated action with no applicable
|
|
46
|
+
* coarse grant (and no covering cross-tenant grant scope). Reason
|
|
47
|
+
* `missing_object_type_grant`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function denyMissingObjectTypeGrant(detail?: string): Decision;
|
|
50
|
+
/**
|
|
51
|
+
* DENY — gate 6 (record permit tier): no permit from any source (rule ∪ share ∪
|
|
52
|
+
* cross-tenant grant) affirmatively allowed this record+action. Reason
|
|
53
|
+
* `no_record_permit`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function denyNoRecordPermit(detail?: string): Decision;
|
|
56
|
+
/**
|
|
57
|
+
* DENY — gate 6 (record permit tier), DENY-WINS: an explicit record_permission_rule
|
|
58
|
+
* deny matched. Overrides any share/grant widening. Reason `explicit_deny_policy`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function denyExplicitPolicy(detail?: string): Decision;
|
|
61
|
+
/**
|
|
62
|
+
* DENY — gate 0 (resource registration): the resource's object type is not
|
|
63
|
+
* registered with the {@link ModuleRegistry} (unregistered ⇒ Deny, §5.4/5.5).
|
|
64
|
+
* Reason `resource_not_registered`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function denyResourceNotRegistered(detail?: string): Decision;
|
|
67
|
+
/**
|
|
68
|
+
* DENY — gate 8 (fail-closed terminal): any unresolved path, an unclassified
|
|
69
|
+
* operation, or an UNEXPECTED exception caught inside `decide()` (never a typed
|
|
70
|
+
* transient — that RE-THROWS as {@link AuthorizationUnavailableError}). Reason
|
|
71
|
+
* `deny_by_default` (ADR-0002 invariant #1). This is the terminal every Allow must
|
|
72
|
+
* have escaped via an earlier short-circuit.
|
|
73
|
+
*/
|
|
74
|
+
export declare function denyByDefault(detail?: string): Decision;
|
|
75
|
+
//# sourceMappingURL=reason-codes.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reason-code MAPPING — the single-source constructors that turn a gate outcome
|
|
3
|
+
* into a frozen {@link Decision} (§7.5). Every gate + the pipeline build their
|
|
4
|
+
* `Decision` HERE, never by hand-rolling a `{ effect, reason }` literal, so the
|
|
5
|
+
* frozen {@link DecisionReasonCode} taxonomy has exactly one producer and cannot
|
|
6
|
+
* drift.
|
|
7
|
+
*
|
|
8
|
+
* ⛔ §7.5 NO-LEAK RULE: a Deny's `reason` names the failing gate for machine use,
|
|
9
|
+
* but must NEVER reveal the existence of a resource the principal may not know
|
|
10
|
+
* about. The optional `detail` is ADMIN-TROUBLESHOOTING ONLY — it is never
|
|
11
|
+
* returned to end users and must never encode resource existence, a UUID, or a
|
|
12
|
+
* grant's contents. Callers that surface a Decision to a user render the reason
|
|
13
|
+
* code (mapped to a generic message), not the detail.
|
|
14
|
+
*
|
|
15
|
+
* ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* ⛔ THE LOAD-BEARING FAIL-OPEN GUARD (the Layer-5/6 bug class). Returns `true`
|
|
19
|
+
* ONLY for the boolean `true`; a truthy NON-boolean (`"true"`, `1`, `{}`, a
|
|
20
|
+
* hostile port's junk) is NOT a pass. EVERY port-boolean gate (share verdict,
|
|
21
|
+
* rule allow/deny, CAS-style wins, grant-action membership resolved to a boolean)
|
|
22
|
+
* MUST route its verdict through this before treating it as an Allow. This is what
|
|
23
|
+
* stops a misbehaving/hostile adapter from failing the decision OPEN.
|
|
24
|
+
*/
|
|
25
|
+
export function strictTrue(x) {
|
|
26
|
+
return x === true;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* ALLOW (gate 1 public short-circuit, gate 4 authenticated-global short-circuit,
|
|
30
|
+
* gate 5 object-type grant held, gate 6 record permit held). The single Allow
|
|
31
|
+
* constructor — reason is always `allowed`.
|
|
32
|
+
*/
|
|
33
|
+
export function allow() {
|
|
34
|
+
return Object.freeze({ effect: 'allow', reason: 'allowed' });
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* DENY — gate 2 (authentication gate): a non-public action reached by an
|
|
38
|
+
* unauthenticated request. Reason `not_authenticated`.
|
|
39
|
+
*/
|
|
40
|
+
export function denyNotAuthenticated(detail) {
|
|
41
|
+
return freezeDeny('not_authenticated', detail);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
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
|
|
46
|
+
* `tenant_mismatch`. FINAL — the tenant boundary is never relaxed downstream.
|
|
47
|
+
*/
|
|
48
|
+
export function denyTenantMismatch(detail) {
|
|
49
|
+
return freezeDeny('tenant_mismatch', detail);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* DENY — gate 5 (feature/object-type gate): a gated action with no applicable
|
|
53
|
+
* coarse grant (and no covering cross-tenant grant scope). Reason
|
|
54
|
+
* `missing_object_type_grant`.
|
|
55
|
+
*/
|
|
56
|
+
export function denyMissingObjectTypeGrant(detail) {
|
|
57
|
+
return freezeDeny('missing_object_type_grant', detail);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* DENY — gate 6 (record permit tier): no permit from any source (rule ∪ share ∪
|
|
61
|
+
* cross-tenant grant) affirmatively allowed this record+action. Reason
|
|
62
|
+
* `no_record_permit`.
|
|
63
|
+
*/
|
|
64
|
+
export function denyNoRecordPermit(detail) {
|
|
65
|
+
return freezeDeny('no_record_permit', detail);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* DENY — gate 6 (record permit tier), DENY-WINS: an explicit record_permission_rule
|
|
69
|
+
* deny matched. Overrides any share/grant widening. Reason `explicit_deny_policy`.
|
|
70
|
+
*/
|
|
71
|
+
export function denyExplicitPolicy(detail) {
|
|
72
|
+
return freezeDeny('explicit_deny_policy', detail);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* DENY — gate 0 (resource registration): the resource's object type is not
|
|
76
|
+
* registered with the {@link ModuleRegistry} (unregistered ⇒ Deny, §5.4/5.5).
|
|
77
|
+
* Reason `resource_not_registered`.
|
|
78
|
+
*/
|
|
79
|
+
export function denyResourceNotRegistered(detail) {
|
|
80
|
+
return freezeDeny('resource_not_registered', detail);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* DENY — gate 8 (fail-closed terminal): any unresolved path, an unclassified
|
|
84
|
+
* operation, or an UNEXPECTED exception caught inside `decide()` (never a typed
|
|
85
|
+
* transient — that RE-THROWS as {@link AuthorizationUnavailableError}). Reason
|
|
86
|
+
* `deny_by_default` (ADR-0002 invariant #1). This is the terminal every Allow must
|
|
87
|
+
* have escaped via an earlier short-circuit.
|
|
88
|
+
*/
|
|
89
|
+
export function denyByDefault(detail) {
|
|
90
|
+
return freezeDeny('deny_by_default', detail);
|
|
91
|
+
}
|
|
92
|
+
/** Internal: build + freeze a deny Decision, omitting `detail` when absent. */
|
|
93
|
+
function freezeDeny(reason, detail) {
|
|
94
|
+
return detail === undefined
|
|
95
|
+
? Object.freeze({ effect: 'deny', reason })
|
|
96
|
+
: Object.freeze({ effect: 'deny', reason, detail });
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=reason-codes.js.map
|
|
@@ -0,0 +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,CAAC,MAAe;IAChD,OAAO,UAAU,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAe;IAChD,OAAO,UAAU,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAe;IACvD,OAAO,UAAU,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe;IAC3C,OAAO,UAAU,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAC/C,CAAC;AAED,+EAA+E;AAC/E,SAAS,UAAU,CACjB,MAA8C,EAC9C,MAAe;IAEf,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC3C,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate 6 — the FINAL **record permit tier** composer (INTEGRATION owner) — §7.3.4 /
|
|
3
|
+
* §9, ADR-0005 (policy) + ADR-0006 (share) + ADR-0009 (cross-tenant grant).
|
|
4
|
+
*
|
|
5
|
+
* Gate 6 is the ONE record-level permit gate the pipeline calls. It is a UNION of two
|
|
6
|
+
* WIDENING permit sources under a DENY-WINS policy — assembled here from TEAM B's
|
|
7
|
+
* policy half and TEAM C's share/cross-tenant-grant half (neither team's file ships
|
|
8
|
+
* the final gate; each ships only its own slice + a slice-only view for testing):
|
|
9
|
+
*
|
|
10
|
+
* gate6 = (policy allows) OR (share / cross-tenant grant permits) [union widens]
|
|
11
|
+
* — but an EXPLICIT policy deny OVERRIDES everything [deny-wins]
|
|
12
|
+
*
|
|
13
|
+
* ── THE ONE COMPOSER (B's & C's DONE.md snippets were proven equivalent by a
|
|
14
|
+
* reviewer; this is that single agreed composer):
|
|
15
|
+
*
|
|
16
|
+
* 1. Evaluate the POLICY (TEAM B `evaluateRecordPolicy`).
|
|
17
|
+
* 2. `policy.explicitDeny` ⇒ `deny(explicit_deny_policy)` — DENY-WINS, and it
|
|
18
|
+
* SHORT-CIRCUITS *before* the share is ever consulted. A share can NEVER beat
|
|
19
|
+
* an explicit policy deny (that is the load-bearing invariant of this gate).
|
|
20
|
+
* 3. else evaluate the SHARE (TEAM C `evaluateRecordShare` — same-tenant share ∪
|
|
21
|
+
* applicable cross-tenant grant) and union it with the policy allow:
|
|
22
|
+
* `policy.allow || share` ⇒ `allow`.
|
|
23
|
+
* 4. else ⇒ `deny(no_record_permit)` (no permit from ANY source).
|
|
24
|
+
*
|
|
25
|
+
* ── DENY-WINS IS LOAD-BEARING. The explicit-deny check happens BEFORE `evaluateRecordShare`
|
|
26
|
+
* is called, so a share is not merely ignored — it is never even consulted when the
|
|
27
|
+
* policy explicitly denies. (Consulting it would be harmless too, since the deny
|
|
28
|
+
* already short-circuited, but not calling it is the clearest expression of
|
|
29
|
+
* "deny beats every widening" and avoids a needless port round-trip.)
|
|
30
|
+
*
|
|
31
|
+
* ── TRANSIENT-vs-DENY (ADR-0016). This composer NEVER catches. A genuine transient
|
|
32
|
+
* ({@link AuthorizationUnavailableError}) thrown by EITHER evaluator PROPAGATES so
|
|
33
|
+
* the pipeline's top-level catch re-throws it (503-retryable); any OTHER throw also
|
|
34
|
+
* propagates (the pipeline fail-closes it to `deny_by_default`). A transient is
|
|
35
|
+
* NEVER swallowed into a deny/allow. (Because the policy is evaluated first and an
|
|
36
|
+
* explicit deny short-circuits, a transient in the SHARE evaluator is only surfaced
|
|
37
|
+
* on a policy-silent, non-explicit-deny record — exactly the path where the share
|
|
38
|
+
* is legitimately consulted.)
|
|
39
|
+
*
|
|
40
|
+
* ── PURE + zero-dep (ADR-0003). No framework / HTTP / DB / node imports; the only I/O
|
|
41
|
+
* is through the two team evaluators (which reach their ports via `ctx.deps`).
|
|
42
|
+
*/
|
|
43
|
+
import type { RecordPermitFn } from '../decision-authority.js';
|
|
44
|
+
import type { CrossTenantGrantEvalOptions } from '../cross-tenant/grant-evaluator.js';
|
|
45
|
+
/**
|
|
46
|
+
* Build the FINAL gate-6 {@link RecordPermitFn} — the composed policy ∪ share
|
|
47
|
+
* permit tier with deny-wins. This is the ONLY `recordPermit` gate the integration
|
|
48
|
+
* owner injects as `DecisionAuthorityDeps.gates.recordPermit`; do NOT inject either
|
|
49
|
+
* team's slice-only view (`createRecordPolicyGate` ignores shares;
|
|
50
|
+
* `createRecordShareGate` ignores policy).
|
|
51
|
+
*
|
|
52
|
+
* @param options optional injectables threaded into TEAM C's share evaluator (the
|
|
53
|
+
* deterministic `now` clock for cross-tenant-grant expiry); defaults to the
|
|
54
|
+
* helper's own `Date.now`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createRecordPermitGate(options?: CrossTenantGrantEvalOptions): RecordPermitFn;
|
|
57
|
+
//# sourceMappingURL=permit-tier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permit-tier.d.ts","sourceRoot":"","sources":["../../../src/authorization/record/permit-tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAA4B,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAKzF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEtF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,2BAAgC,GACxC,cAAc,CAuBhB"}
|