@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,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate 5 — the **FEATURE / OBJECT-TYPE permission gate** (TEAM A, Hard Gates) —
|
|
3
|
+
* §7.3.3 / ADR-0011.
|
|
4
|
+
*
|
|
5
|
+
* Runs ONLY for GATED resources (public + authenticated_global already
|
|
6
|
+
* short-circuited to Allow upstream; unauthenticated + cross-tenant-without-grant
|
|
7
|
+
* already denied). It answers the coarse question: *does this principal hold a
|
|
8
|
+
* feature/object-type grant for the action's stable permission key?* — the
|
|
9
|
+
* ADR-0011 hot path.
|
|
10
|
+
*
|
|
11
|
+
* ── Permission identity: the required grant key is the action's STABLE
|
|
12
|
+
* permission key (ADR-0010) — `moduleKey:typeKey:actionKey`. The pipeline
|
|
13
|
+
* resolved the {@link RegisteredAction} at gate 1 but does NOT stash it on the
|
|
14
|
+
* read-only {@link GateContext}, so this gate re-resolves it over the FROZEN
|
|
15
|
+
* registry surface (`listActions()` matched by `typeKey + actionKey`), exactly
|
|
16
|
+
* as the pipeline does, and reads its `permissionKey`. An action not registered
|
|
17
|
+
* for this type has no derivable grant → `deny(missing_object_type_grant)`.
|
|
18
|
+
*
|
|
19
|
+
* ── Coarse-grants source (ADR-0011, hot path, in order):
|
|
20
|
+
* 1. Read THIS request's session facts (`deps.sessionFacts`): compare the cached
|
|
21
|
+
* `permissionsVersion` against {@link PermissionFactsPort.currentPermissionsVersion}.
|
|
22
|
+
* - versions MATCH and `cachedFacts` present ⇒ use `cachedFacts` (NO reload) —
|
|
23
|
+
* a revoke takes effect within the version bound.
|
|
24
|
+
* - versions DIFFER (stale) OR `cachedFacts` null/unusable ⇒ RELOAD via
|
|
25
|
+
* {@link PermissionFactsPort.loadCoarseGrants}.
|
|
26
|
+
* 2. `cachedFacts` is the opaque ADR-0011 slot; this gate interprets it as
|
|
27
|
+
* {@link CoarseGrants} (`{ permissionsVersion, grantedPermissionKeys }`) — the
|
|
28
|
+
* exact shape `ports.ts` defines. (Assumption documented in DONE.md: the
|
|
29
|
+
* prelude left the slot typed `unknown`; we read it through a minimal typed
|
|
30
|
+
* view here and never mutate the frozen slot.)
|
|
31
|
+
*
|
|
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
|
|
34
|
+
* cross-tenant grant covers it — and that grant's scope + action-ceiling SERVES
|
|
35
|
+
* AS the object-type grant. Coarse facts are the WRONG-tenant facts, so this
|
|
36
|
+
* gate does NOT consult them; it RE-RESOLVES the grant via
|
|
37
|
+
* {@link CrossTenantGrantPort} (gate 3 is pure and stashed nothing) and, if the
|
|
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
|
|
40
|
+
* grant-backed; it takes the normal coarse-grants path below.
|
|
41
|
+
*
|
|
42
|
+
* ── Decision:
|
|
43
|
+
* - grant held for this action (STRICT membership) →
|
|
44
|
+
* `record` level ⇒ `continue` (gate 6 record-permit runs next);
|
|
45
|
+
* feature/object_type level ⇒ `allow` (terminates here).
|
|
46
|
+
* - no applicable grant ⇒ `deny(missing_object_type_grant)`.
|
|
47
|
+
* - {@link PermissionFactsPort} / {@link CrossTenantGrantPort} throws
|
|
48
|
+
* {@link AuthorizationUnavailableError} (transient) ⇒ PROPAGATES (pipeline
|
|
49
|
+
* re-throws → 503). Any OTHER throw also propagates (pipeline fail-closes to
|
|
50
|
+
* `deny_by_default`). This gate NEVER swallows a throw into a `deny`.
|
|
51
|
+
*
|
|
52
|
+
* ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
|
|
53
|
+
*/
|
|
54
|
+
import { gateAllow, gateContinue, gateDeny, } from '../decision-authority.js';
|
|
55
|
+
import { denyMissingObjectTypeGrant, strictTrue } from '../reason-codes.js';
|
|
56
|
+
import { isCrossTenantGrantApplicable } from '../cross-tenant/grant-evaluator.js';
|
|
57
|
+
/**
|
|
58
|
+
* A minimal, defensive typed VIEW of the opaque `cachedFacts` slot (ADR-0011). We
|
|
59
|
+
* do NOT trust the slot to already be a well-formed {@link CoarseGrants}; we probe
|
|
60
|
+
* it structurally so a `null`/junk cache falls back to a reload rather than
|
|
61
|
+
* failing open. Returns the parsed facts, or `null` when the slot is unusable.
|
|
62
|
+
*/
|
|
63
|
+
function asCoarseGrants(slot) {
|
|
64
|
+
if (slot === null || typeof slot !== 'object') {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const candidate = slot;
|
|
68
|
+
if (typeof candidate.permissionsVersion !== 'number') {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
if (!Array.isArray(candidate.grantedPermissionKeys)) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
// Every entry must be a genuine string — a hostile non-string must not sneak in.
|
|
75
|
+
for (const key of candidate.grantedPermissionKeys) {
|
|
76
|
+
if (typeof key !== 'string') {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
permissionsVersion: candidate.permissionsVersion,
|
|
82
|
+
grantedPermissionKeys: candidate.grantedPermissionKeys,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* STRICT membership: whether `grantedPermissionKeys` contains the required key.
|
|
87
|
+
* Routed through {@link strictTrue} so a truthy-non-boolean from `.includes` (there
|
|
88
|
+
* shouldn't be one, but defence-in-depth) is NOT a pass.
|
|
89
|
+
*/
|
|
90
|
+
function grantsHoldKey(grants, permissionKey) {
|
|
91
|
+
return strictTrue(grants.grantedPermissionKeys.includes(permissionKey));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Build the feature/object-type gate (gate 5). No injected deps of its own — it
|
|
95
|
+
* reaches the registry, session facts, {@link PermissionFactsPort}, and
|
|
96
|
+
* {@link CrossTenantGrantPort} through {@link GateContext.deps}. Returns an
|
|
97
|
+
* {@link ObjectTypeGateFn} the integration owner injects as
|
|
98
|
+
* `DecisionAuthorityDeps.gates.objectTypeGate`.
|
|
99
|
+
*/
|
|
100
|
+
export function createObjectTypeGate() {
|
|
101
|
+
return async function objectTypeGate(ctx) {
|
|
102
|
+
const { principal, action, resource, deps } = ctx;
|
|
103
|
+
const isRecordLevel = resource.level === 'record';
|
|
104
|
+
// ── Cross-tenant grant path (§7.3.3): a non-superuser reaching a foreign
|
|
105
|
+
// tenant proceeded past gate 3 ONLY via a cross-tenant grant, whose scope +
|
|
106
|
+
// 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
|
+
// it falls through to the coarse-grants path.
|
|
109
|
+
const crossesTenant = resource.tenantId !== undefined &&
|
|
110
|
+
principal.tenantId !== resource.tenantId &&
|
|
111
|
+
!strictTrue(principal.isPlatformSuperuser);
|
|
112
|
+
if (crossesTenant) {
|
|
113
|
+
// Re-resolve the grant through the SINGLE-SOURCE cross-tenant helper (TEAM C)
|
|
114
|
+
// so gates 3/5/6 share ONE ceiling+scope+expiry implementation (RULING 1 /
|
|
115
|
+
// AC-13 defense-in-depth). The grant SERVES AS the object-type grant ONLY when
|
|
116
|
+
// its action ceiling INCLUDES this action AND its scope COVERS this resource
|
|
117
|
+
// AND it is UNEXPIRED — an expired or record-scope-mismatched grant is REJECTED
|
|
118
|
+
// here, not honored. A transient/any throw PROPAGATES (the helper never catches).
|
|
119
|
+
const { applicable } = await isCrossTenantGrantApplicable(deps.crossTenantGrant, {
|
|
120
|
+
principal,
|
|
121
|
+
action,
|
|
122
|
+
resource,
|
|
123
|
+
});
|
|
124
|
+
if (applicable) {
|
|
125
|
+
// In-scope cross-tenant grant: record level ⇒ record-permit still runs;
|
|
126
|
+
// feature/object-type level ⇒ the grant IS the object-type grant → allow.
|
|
127
|
+
return isRecordLevel ? gateContinue() : gateAllow();
|
|
128
|
+
}
|
|
129
|
+
// No covering grant on the foreign tenant ⇒ no object-type grant applies.
|
|
130
|
+
return gateDeny(denyMissingObjectTypeGrant());
|
|
131
|
+
}
|
|
132
|
+
// ── Same-tenant (or superuser) path — coarse feature/object-type grants
|
|
133
|
+
// (ADR-0011). Derive the required stable permission key by re-resolving the
|
|
134
|
+
// registered action over the frozen registry surface.
|
|
135
|
+
const registered = deps.registry
|
|
136
|
+
.listActions()
|
|
137
|
+
.find((a) => a.action.typeKey === resource.typeKey && a.action.actionKey === action.key);
|
|
138
|
+
if (registered === undefined) {
|
|
139
|
+
// Unregistered action for this type ⇒ no permission key to grant against.
|
|
140
|
+
return gateDeny(denyMissingObjectTypeGrant());
|
|
141
|
+
}
|
|
142
|
+
const requiredKey = registered.permissionKey;
|
|
143
|
+
// Hot path: prefer the request's cached facts when they are FRESH; reload on a
|
|
144
|
+
// stale version or an unusable cache.
|
|
145
|
+
const grants = await resolveCoarseGrants(ctx, requiredKey);
|
|
146
|
+
if (!grantsHoldKey(grants, requiredKey)) {
|
|
147
|
+
return gateDeny(denyMissingObjectTypeGrant());
|
|
148
|
+
}
|
|
149
|
+
// Grant held: a record-level resource proceeds to the record permit tier;
|
|
150
|
+
// a feature/object-type-level resource terminates here as Allow.
|
|
151
|
+
return isRecordLevel ? gateContinue() : gateAllow();
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Resolve the coarse grants to decide on (ADR-0011 version-freshness rule). Uses
|
|
156
|
+
* the request's `cachedFacts` when its version MATCHES the authority's current
|
|
157
|
+
* version; otherwise reloads via {@link PermissionFactsPort.loadCoarseGrants}. A
|
|
158
|
+
* transient throw from either port propagates (never swallowed).
|
|
159
|
+
*
|
|
160
|
+
* `_requiredKey` is unused in resolution (the freshness decision is version-based,
|
|
161
|
+
* not key-based) but kept in the signature for clarity of intent at the call site.
|
|
162
|
+
*/
|
|
163
|
+
async function resolveCoarseGrants(ctx, _requiredKey) {
|
|
164
|
+
const { principal, deps } = ctx;
|
|
165
|
+
const cached = asCoarseGrants(deps.sessionFacts.cachedFacts);
|
|
166
|
+
if (cached !== null) {
|
|
167
|
+
const currentVersion = await deps.permissionFacts.currentPermissionsVersion(principal.id, principal.tenantId);
|
|
168
|
+
// Fresh iff the cached facts were projected at (or after) the current version.
|
|
169
|
+
// A LOWER cached version ⇒ STALE ⇒ reload (so a revoke lands within the bound).
|
|
170
|
+
if (cached.permissionsVersion >= currentVersion) {
|
|
171
|
+
return cached;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Cache miss / unusable / stale ⇒ reload the authoritative grants.
|
|
175
|
+
return deps.permissionFacts.loadCoarseGrants(principal.id, principal.tenantId);
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=object-type.js.map
|
|
@@ -0,0 +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,S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AAM,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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate 3 — the **TENANT gate** (TEAM A, Hard Gates) — §7.3.2 / ADR-0009.
|
|
3
|
+
*
|
|
4
|
+
* The tenant boundary is the platform's DEFAULT authorization boundary (§7.3): a
|
|
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
|
|
7
|
+
* (ADR-0009) lets evaluation PROCEED. This gate can ONLY block (`deny`) or let
|
|
8
|
+
* evaluation continue (`continue`) — it NEVER returns `allow`. An `allow` from
|
|
9
|
+
* the tenant gate would be a fail-open (the pipeline treats an unexpected `allow`
|
|
10
|
+
* here as fail-closed `deny_by_default`), so this gate never produces one; a
|
|
11
|
+
* cross-tenant grant is a hard action-CEILING that only permits proceeding, and
|
|
12
|
+
* the object-type/record gates downstream still run.
|
|
13
|
+
*
|
|
14
|
+
* ── The order (deny wins; every ambiguity resolves to the deny/continue path,
|
|
15
|
+
* never to a bypass):
|
|
16
|
+
*
|
|
17
|
+
* 1. SAME TENANT (`principal.tenantId === resource.tenantId`, OR the resource
|
|
18
|
+
* carries no instance tenant) ⇒ `continue`. A feature/object-type-level
|
|
19
|
+
* resource with no `tenantId` is same-tenant BY CONSTRUCTION — there is no
|
|
20
|
+
* foreign instance to cross into, so it is the principal's own tenant.
|
|
21
|
+
* 2. MISMATCH + platform superuser (STRICT `=== true`) ⇒ `continue` (break-glass,
|
|
22
|
+
* audited by a later layer — not this gate's concern).
|
|
23
|
+
* 3. MISMATCH + not superuser ⇒ consult {@link CrossTenantGrantPort}:
|
|
24
|
+
* - an ACTIVE grant whose action-ceiling INCLUDES this action (STRICT
|
|
25
|
+
* membership) ⇒ `continue` (proceed only; it confers no object-type/record
|
|
26
|
+
* permission — those gates still run);
|
|
27
|
+
* - `null` (a normal data-absence: no consent) ⇒ `deny(tenant_mismatch)`;
|
|
28
|
+
* - the port THROWS {@link AuthorizationUnavailableError} (transient) ⇒ it
|
|
29
|
+
* PROPAGATES (the pipeline re-throws → 503-retryable). ANY OTHER throw
|
|
30
|
+
* also propagates (the pipeline's top-level catch fail-closes it to
|
|
31
|
+
* `deny_by_default`). This gate NEVER swallows a throw into a `deny`.
|
|
32
|
+
*
|
|
33
|
+
* ── Cross-tenant re-resolution note (for gates 5/6): this gate is PURE over the
|
|
34
|
+
* ports and cannot mutate the shared read-only {@link GateContext}. It therefore
|
|
35
|
+
* does NOT stash "we proceeded under a grant" anywhere. When the tenant differs,
|
|
36
|
+
* gate 5 (and gate 6) MUST independently RE-RESOLVE the grant via the same
|
|
37
|
+
* {@link CrossTenantGrantPort} to learn the grant's scope/ceiling. This keeps
|
|
38
|
+
* every gate stateless and avoids a shared-mutable-state channel.
|
|
39
|
+
*
|
|
40
|
+
* ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
|
|
41
|
+
*/
|
|
42
|
+
import { type TenantGateFn } from '../decision-authority.js';
|
|
43
|
+
/**
|
|
44
|
+
* Build the tenant gate (gate 3). No injected deps of its own — it reaches the
|
|
45
|
+
* {@link CrossTenantGrantPort} through {@link GateContext.deps.crossTenantGrant}
|
|
46
|
+
* (the pipeline owns the wiring). Returns a {@link TenantGateFn} the integration
|
|
47
|
+
* owner injects as `DecisionAuthorityDeps.gates.tenantGate`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createTenantGate(): TenantGateFn;
|
|
50
|
+
//# sourceMappingURL=tenant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant.d.ts","sourceRoot":"","sources":["../../../src/authorization/gates/tenant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAIlC;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,YAAY,CAwC/C"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate 3 — the **TENANT gate** (TEAM A, Hard Gates) — §7.3.2 / ADR-0009.
|
|
3
|
+
*
|
|
4
|
+
* The tenant boundary is the platform's DEFAULT authorization boundary (§7.3): a
|
|
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
|
|
7
|
+
* (ADR-0009) lets evaluation PROCEED. This gate can ONLY block (`deny`) or let
|
|
8
|
+
* evaluation continue (`continue`) — it NEVER returns `allow`. An `allow` from
|
|
9
|
+
* the tenant gate would be a fail-open (the pipeline treats an unexpected `allow`
|
|
10
|
+
* here as fail-closed `deny_by_default`), so this gate never produces one; a
|
|
11
|
+
* cross-tenant grant is a hard action-CEILING that only permits proceeding, and
|
|
12
|
+
* the object-type/record gates downstream still run.
|
|
13
|
+
*
|
|
14
|
+
* ── The order (deny wins; every ambiguity resolves to the deny/continue path,
|
|
15
|
+
* never to a bypass):
|
|
16
|
+
*
|
|
17
|
+
* 1. SAME TENANT (`principal.tenantId === resource.tenantId`, OR the resource
|
|
18
|
+
* carries no instance tenant) ⇒ `continue`. A feature/object-type-level
|
|
19
|
+
* resource with no `tenantId` is same-tenant BY CONSTRUCTION — there is no
|
|
20
|
+
* foreign instance to cross into, so it is the principal's own tenant.
|
|
21
|
+
* 2. MISMATCH + platform superuser (STRICT `=== true`) ⇒ `continue` (break-glass,
|
|
22
|
+
* audited by a later layer — not this gate's concern).
|
|
23
|
+
* 3. MISMATCH + not superuser ⇒ consult {@link CrossTenantGrantPort}:
|
|
24
|
+
* - an ACTIVE grant whose action-ceiling INCLUDES this action (STRICT
|
|
25
|
+
* membership) ⇒ `continue` (proceed only; it confers no object-type/record
|
|
26
|
+
* permission — those gates still run);
|
|
27
|
+
* - `null` (a normal data-absence: no consent) ⇒ `deny(tenant_mismatch)`;
|
|
28
|
+
* - the port THROWS {@link AuthorizationUnavailableError} (transient) ⇒ it
|
|
29
|
+
* PROPAGATES (the pipeline re-throws → 503-retryable). ANY OTHER throw
|
|
30
|
+
* also propagates (the pipeline's top-level catch fail-closes it to
|
|
31
|
+
* `deny_by_default`). This gate NEVER swallows a throw into a `deny`.
|
|
32
|
+
*
|
|
33
|
+
* ── Cross-tenant re-resolution note (for gates 5/6): this gate is PURE over the
|
|
34
|
+
* ports and cannot mutate the shared read-only {@link GateContext}. It therefore
|
|
35
|
+
* does NOT stash "we proceeded under a grant" anywhere. When the tenant differs,
|
|
36
|
+
* gate 5 (and gate 6) MUST independently RE-RESOLVE the grant via the same
|
|
37
|
+
* {@link CrossTenantGrantPort} to learn the grant's scope/ceiling. This keeps
|
|
38
|
+
* every gate stateless and avoids a shared-mutable-state channel.
|
|
39
|
+
*
|
|
40
|
+
* ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports.
|
|
41
|
+
*/
|
|
42
|
+
import { gateContinue, gateDeny, } from '../decision-authority.js';
|
|
43
|
+
import { denyTenantMismatch, strictTrue } from '../reason-codes.js';
|
|
44
|
+
import { isCrossTenantGrantApplicable } from '../cross-tenant/grant-evaluator.js';
|
|
45
|
+
/**
|
|
46
|
+
* Build the tenant gate (gate 3). No injected deps of its own — it reaches the
|
|
47
|
+
* {@link CrossTenantGrantPort} through {@link GateContext.deps.crossTenantGrant}
|
|
48
|
+
* (the pipeline owns the wiring). Returns a {@link TenantGateFn} the integration
|
|
49
|
+
* owner injects as `DecisionAuthorityDeps.gates.tenantGate`.
|
|
50
|
+
*/
|
|
51
|
+
export function createTenantGate() {
|
|
52
|
+
return async function tenantGate(ctx) {
|
|
53
|
+
const { principal, action, resource, deps } = ctx;
|
|
54
|
+
// 1. Same tenant — including a feature/object-type resource with no instance
|
|
55
|
+
// tenant (same-tenant by construction: no foreign instance to cross into).
|
|
56
|
+
if (resource.tenantId === undefined || principal.tenantId === resource.tenantId) {
|
|
57
|
+
return gateContinue();
|
|
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)) {
|
|
62
|
+
return gateContinue();
|
|
63
|
+
}
|
|
64
|
+
// 3. Mismatch + not superuser — the ONLY sanctioned crossing is an active,
|
|
65
|
+
// consented cross-tenant grant (ADR-0009). Resolve applicability through the
|
|
66
|
+
// SINGLE-SOURCE cross-tenant helper (TEAM C) so gates 3/5/6 share ONE
|
|
67
|
+
// ceiling+scope+expiry implementation (RULING 1 / AC-13 defense-in-depth): a
|
|
68
|
+
// grant proceeds ONLY when its action ceiling INCLUDES this action AND its
|
|
69
|
+
// scope COVERS this resource AND it is UNEXPIRED. A racy/misbehaving adapter
|
|
70
|
+
// returning an expired or record-scope-mismatched grant is REJECTED here, not
|
|
71
|
+
// honored. Let a transient/any throw PROPAGATE (the helper never catches).
|
|
72
|
+
const { applicable } = await isCrossTenantGrantApplicable(deps.crossTenantGrant, {
|
|
73
|
+
principal,
|
|
74
|
+
action,
|
|
75
|
+
resource,
|
|
76
|
+
});
|
|
77
|
+
if (applicable) {
|
|
78
|
+
// The grant lets evaluation PROCEED — it is a hard action-ceiling, not an
|
|
79
|
+
// allow. Object-type/record gates still run (they re-resolve this grant).
|
|
80
|
+
return gateContinue();
|
|
81
|
+
}
|
|
82
|
+
// `null` (no consent) OR a grant that fails the ceiling / scope / expiry checks
|
|
83
|
+
// ⇒ the tenant boundary holds. FINAL — never relaxed downstream.
|
|
84
|
+
return gateDeny(denyTenantMismatch());
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=tenant.js.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INTEGRATION WIRING — assembles the four REAL team-supplied gate functions into the
|
|
3
|
+
* `GateFunctions` set the frozen pipeline (`decision-authority.ts`) calls at gates
|
|
4
|
+
* 3/5/6/7, and offers a convenience factory that returns a fully-wired
|
|
5
|
+
* {@link DecisionAuthority} from just the ports + registry + per-request session facts.
|
|
6
|
+
*
|
|
7
|
+
* This is the ONE place the disjoint team slices come together into the single
|
|
8
|
+
* decision path (the "one decision path" invariant): every gate is the production
|
|
9
|
+
* evaluator, no deny-by-default placeholder survives.
|
|
10
|
+
*
|
|
11
|
+
* gate 3 (tenant) → TEAM A `createTenantGate()`
|
|
12
|
+
* gate 5 (object-type) → TEAM A `createObjectTypeGate()`
|
|
13
|
+
* gate 6 (record permit) → the COMPOSED `createRecordPermitGate()` (TEAM B policy
|
|
14
|
+
* ∪ TEAM C share/grant, deny-wins) — the integration
|
|
15
|
+
* owner's composer, NOT either team's slice-only view.
|
|
16
|
+
* gate 7 (delegation) → TEAM D `createDelegationOverlay()`
|
|
17
|
+
*
|
|
18
|
+
* ⛔ The prelude's `DEFAULT_DENY_BY_DEFAULT_GATES` (`default-gates.ts`) STAYS as-is —
|
|
19
|
+
* it is the fail-closed fallback a not-yet-wired authority uses. This file is the
|
|
20
|
+
* PRODUCTION gate set that replaces it; `default-gates.ts` is untouched.
|
|
21
|
+
*
|
|
22
|
+
* ── ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports; zero-dep.
|
|
23
|
+
*/
|
|
24
|
+
import { type DecisionAuthorityDeps, type GateFunctions } from '../decision-authority.js';
|
|
25
|
+
import type { DecisionAuthority } from '../index.js';
|
|
26
|
+
import type { CrossTenantGrantEvalOptions } from '../cross-tenant/grant-evaluator.js';
|
|
27
|
+
/** Optional injectables for the production gate set (threaded to the record-permit composer). */
|
|
28
|
+
export interface CreateProductionGatesOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Deterministic clock threaded into the cross-tenant-grant expiry re-check inside
|
|
31
|
+
* gate 6's share evaluator (TEAM C). Defaults to the helper's own `Date.now`.
|
|
32
|
+
* Note: gates 3 and 5 use the helper's default clock (they take no injectable).
|
|
33
|
+
*/
|
|
34
|
+
readonly now?: CrossTenantGrantEvalOptions['now'];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the PRODUCTION {@link GateFunctions} — the four real evaluators wired into
|
|
38
|
+
* the pipeline's gate seam. Inject this as `DecisionAuthorityDeps.gates` to run the
|
|
39
|
+
* real decision path (in place of the prelude's `DEFAULT_DENY_BY_DEFAULT_GATES`).
|
|
40
|
+
*/
|
|
41
|
+
export declare function createProductionGates(options?: CreateProductionGatesOptions): GateFunctions;
|
|
42
|
+
/**
|
|
43
|
+
* The deps a consumer supplies to {@link createWiredDecisionAuthority}: everything
|
|
44
|
+
* {@link DecisionAuthorityDeps} needs EXCEPT `gates` (which this wiring supplies from
|
|
45
|
+
* the real team evaluators). The enforcement adapter (`@astram/guard`) provides the
|
|
46
|
+
* six ports + registry + per-request session facts; the gate assembly is Core's.
|
|
47
|
+
*/
|
|
48
|
+
export type WiredDecisionAuthorityDeps = Omit<DecisionAuthorityDeps, 'gates'>;
|
|
49
|
+
/**
|
|
50
|
+
* Convenience: build a fully-wired {@link DecisionAuthority} from just the ports +
|
|
51
|
+
* registry + per-request session facts. The four production gates are assembled
|
|
52
|
+
* internally via {@link createProductionGates}. This is the entry point a consumer
|
|
53
|
+
* (the enforcement adapter) uses to get the ONE, real decision authority — no
|
|
54
|
+
* deny-by-default placeholder anywhere in the path.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createWiredDecisionAuthority(deps: WiredDecisionAuthorityDeps, options?: CreateProductionGatesOptions): DecisionAuthority;
|
|
57
|
+
//# sourceMappingURL=wiring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiring.d.ts","sourceRoot":"","sources":["../../../src/authorization/gates/wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAMtF,iGAAiG;AACjG,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,2BAA2B,CAAC,KAAK,CAAC,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,4BAAiC,GACzC,aAAa,CASf;AAED;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;AAE9E;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,0BAA0B,EAChC,OAAO,GAAE,4BAAiC,GACzC,iBAAiB,CAKnB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* INTEGRATION WIRING — assembles the four REAL team-supplied gate functions into the
|
|
3
|
+
* `GateFunctions` set the frozen pipeline (`decision-authority.ts`) calls at gates
|
|
4
|
+
* 3/5/6/7, and offers a convenience factory that returns a fully-wired
|
|
5
|
+
* {@link DecisionAuthority} from just the ports + registry + per-request session facts.
|
|
6
|
+
*
|
|
7
|
+
* This is the ONE place the disjoint team slices come together into the single
|
|
8
|
+
* decision path (the "one decision path" invariant): every gate is the production
|
|
9
|
+
* evaluator, no deny-by-default placeholder survives.
|
|
10
|
+
*
|
|
11
|
+
* gate 3 (tenant) → TEAM A `createTenantGate()`
|
|
12
|
+
* gate 5 (object-type) → TEAM A `createObjectTypeGate()`
|
|
13
|
+
* gate 6 (record permit) → the COMPOSED `createRecordPermitGate()` (TEAM B policy
|
|
14
|
+
* ∪ TEAM C share/grant, deny-wins) — the integration
|
|
15
|
+
* owner's composer, NOT either team's slice-only view.
|
|
16
|
+
* gate 7 (delegation) → TEAM D `createDelegationOverlay()`
|
|
17
|
+
*
|
|
18
|
+
* ⛔ The prelude's `DEFAULT_DENY_BY_DEFAULT_GATES` (`default-gates.ts`) STAYS as-is —
|
|
19
|
+
* it is the fail-closed fallback a not-yet-wired authority uses. This file is the
|
|
20
|
+
* PRODUCTION gate set that replaces it; `default-gates.ts` is untouched.
|
|
21
|
+
*
|
|
22
|
+
* ── ADR-0003: framework-agnostic — no framework / HTTP / DB / node imports; zero-dep.
|
|
23
|
+
*/
|
|
24
|
+
import { createDecisionAuthority, } from '../decision-authority.js';
|
|
25
|
+
import { createTenantGate } from './tenant.js';
|
|
26
|
+
import { createObjectTypeGate } from './object-type.js';
|
|
27
|
+
import { createDelegationOverlay } from '../delegation/operation-identity.js';
|
|
28
|
+
import { createRecordPermitGate } from '../record/permit-tier.js';
|
|
29
|
+
/**
|
|
30
|
+
* Build the PRODUCTION {@link GateFunctions} — the four real evaluators wired into
|
|
31
|
+
* the pipeline's gate seam. Inject this as `DecisionAuthorityDeps.gates` to run the
|
|
32
|
+
* real decision path (in place of the prelude's `DEFAULT_DENY_BY_DEFAULT_GATES`).
|
|
33
|
+
*/
|
|
34
|
+
export function createProductionGates(options = {}) {
|
|
35
|
+
const recordPermitOptions = options.now === undefined ? {} : { now: options.now };
|
|
36
|
+
return {
|
|
37
|
+
tenantGate: createTenantGate(),
|
|
38
|
+
objectTypeGate: createObjectTypeGate(),
|
|
39
|
+
recordPermit: createRecordPermitGate(recordPermitOptions),
|
|
40
|
+
delegationOverlay: createDelegationOverlay(),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Convenience: build a fully-wired {@link DecisionAuthority} from just the ports +
|
|
45
|
+
* registry + per-request session facts. The four production gates are assembled
|
|
46
|
+
* internally via {@link createProductionGates}. This is the entry point a consumer
|
|
47
|
+
* (the enforcement adapter) uses to get the ONE, real decision authority — no
|
|
48
|
+
* deny-by-default placeholder anywhere in the path.
|
|
49
|
+
*/
|
|
50
|
+
export function createWiredDecisionAuthority(deps, options = {}) {
|
|
51
|
+
return createDecisionAuthority({
|
|
52
|
+
...deps,
|
|
53
|
+
gates: createProductionGates(options),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=wiring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiring.js","sourceRoot":"","sources":["../../../src/authorization/gates/wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,uBAAuB,GAGxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAYlE;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAwC,EAAE;IAE1C,MAAM,mBAAmB,GACvB,OAAO,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IACxD,OAAO;QACL,UAAU,EAAE,gBAAgB,EAAE;QAC9B,cAAc,EAAE,oBAAoB,EAAE;QACtC,YAAY,EAAE,sBAAsB,CAAC,mBAAmB,CAAC;QACzD,iBAAiB,EAAE,uBAAuB,EAAE;KAC7C,CAAC;AACJ,CAAC;AAUD;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAgC,EAChC,UAAwC,EAAE;IAE1C,OAAO,uBAAuB,CAAC;QAC7B,GAAG,IAAI;QACP,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
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
|
+
import type { Principal } from '../identity/index.js';
|
|
16
|
+
/**
|
|
17
|
+
* The three resource levels the decision spans (§7 / 010_Architecture):
|
|
18
|
+
* feature, object-type, and record.
|
|
19
|
+
*/
|
|
20
|
+
export type ResourceLevel = 'feature' | 'object_type' | 'record';
|
|
21
|
+
/**
|
|
22
|
+
* Access tiers — baseline reachability (§6). Exactly one per governable resource;
|
|
23
|
+
* absence is treated as `gated` (default) by the evaluator.
|
|
24
|
+
*/
|
|
25
|
+
export type AccessTier = 'public' | 'authenticated_global' | 'gated';
|
|
26
|
+
/**
|
|
27
|
+
* The default access tier applied when an action carries no explicit tier —
|
|
28
|
+
* `gated` (ADR-0004: unclassified ⇒ Gated, and absent a grant, denied).
|
|
29
|
+
*/
|
|
30
|
+
export declare const DEFAULT_ACCESS_TIER: AccessTier;
|
|
31
|
+
/**
|
|
32
|
+
* The **stable permission identity** a grant binds to (ADR-0010). It is derived
|
|
33
|
+
* from the module/type/action *keys* — business-meaningful identifiers that
|
|
34
|
+
* travel with the code — and therefore SURVIVES route renames and handler
|
|
35
|
+
* relocations. Never a route/path string.
|
|
36
|
+
*
|
|
37
|
+
* Canonical form: `feature:object:action` (see {@link derivePermissionKey}).
|
|
38
|
+
* Modelled as a branded string so a raw string can't be passed where a derived
|
|
39
|
+
* permission key is required — the only way to mint one is the pure helper.
|
|
40
|
+
*/
|
|
41
|
+
export type PermissionKey = string & {
|
|
42
|
+
readonly __brand: 'ShieldPermissionKey';
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The separator between the three key segments of a {@link PermissionKey}.
|
|
46
|
+
* A single-source constant so producers/consumers can't drift.
|
|
47
|
+
*/
|
|
48
|
+
export declare const PERMISSION_KEY_SEPARATOR: ":";
|
|
49
|
+
/**
|
|
50
|
+
* Derive the stable permission identity `feature:object:action` from a module's
|
|
51
|
+
* `moduleKey`, an object type's `typeKey`, and an action's `actionKey`
|
|
52
|
+
* (ADR-0010, confirmed decision #1). PURE — no I/O, no state, deterministic.
|
|
53
|
+
*
|
|
54
|
+
* 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.
|
|
57
|
+
*
|
|
58
|
+
* @throws if any segment is empty or contains the `:` separator.
|
|
59
|
+
*/
|
|
60
|
+
export declare function derivePermissionKey(moduleKey: string, typeKey: string, actionKey: string): PermissionKey;
|
|
61
|
+
/**
|
|
62
|
+
* An action is a business-meaningful verb bound to a **stable permission
|
|
63
|
+
* identity**, never a mutable route/path (§5.1–§5.2). The string is the stable
|
|
64
|
+
* action key (e.g. `create`, `read`, `update`, `delete`, or a custom verb).
|
|
65
|
+
*/
|
|
66
|
+
export interface Action {
|
|
67
|
+
/** Stable action key — travels with the code, survives refactors (§5.2). */
|
|
68
|
+
readonly key: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The resource a decision is about — identified by its level and stable
|
|
72
|
+
* resource key (feature/object-type key or a record's object-type + id).
|
|
73
|
+
*/
|
|
74
|
+
export interface Resource {
|
|
75
|
+
readonly level: ResourceLevel;
|
|
76
|
+
/** Stable key of the feature or object-type (never a route string) (§5.2). */
|
|
77
|
+
readonly typeKey: string;
|
|
78
|
+
/** For `record`-level resources: the record's id + its owning tenant. */
|
|
79
|
+
readonly recordId?: string;
|
|
80
|
+
/** Owning tenant of this resource instance (drives the tenant gate, §7.3). */
|
|
81
|
+
readonly tenantId?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Ambient decision context — attributes used by conditions (§7.4) and by the
|
|
85
|
+
* layered gates (auth state, request environment). Deliberately open-ended: the
|
|
86
|
+
* evaluator (later layer) interprets these; the seam only carries them.
|
|
87
|
+
*/
|
|
88
|
+
export interface DecisionContext {
|
|
89
|
+
/** Whether authentication has been proven for this request (auth gate, §7.3). */
|
|
90
|
+
readonly isAuthenticated: boolean;
|
|
91
|
+
/** Environment/attribute bag for condition evaluation (time, ip, etc.). */
|
|
92
|
+
readonly attributes?: Readonly<Record<string, unknown>>;
|
|
93
|
+
}
|
|
94
|
+
/** A decision is binary (§7.1); every Deny carries a reason (§7.5). */
|
|
95
|
+
export type DecisionEffect = 'allow' | 'deny';
|
|
96
|
+
/**
|
|
97
|
+
* A machine-usable reason code accompanying a decision. Deny reasons name the
|
|
98
|
+
* failing gate/absent grant for troubleshooting, WITHOUT leaking the existence
|
|
99
|
+
* of resources the principal may not know about (§7.5 / §13 privacy).
|
|
100
|
+
*/
|
|
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';
|
|
102
|
+
/** The output of the single decision function (§7.1, §7.5). */
|
|
103
|
+
export interface Decision {
|
|
104
|
+
readonly effect: DecisionEffect;
|
|
105
|
+
readonly reason: DecisionReasonCode;
|
|
106
|
+
/** Optional non-leaking detail for admin troubleshooting only. */
|
|
107
|
+
readonly detail?: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The single decision authority (§7.1). One logical implementation answers every
|
|
111
|
+
* enforcement point's question; there MUST NOT be divergent per-feature logic.
|
|
112
|
+
*
|
|
113
|
+
* SEAM ONLY — the body (deny-by-default, hard gates, permit tier, conditions,
|
|
114
|
+
* determinism) is the Authorization layer's job, not the Scaffold's.
|
|
115
|
+
*/
|
|
116
|
+
export interface DecisionAuthority {
|
|
117
|
+
/**
|
|
118
|
+
* Answer `decide(principal, action, resource, context) → Allow | Deny (+reason)`.
|
|
119
|
+
* Deterministic for identical inputs (§7.5); deny by default (§7.2).
|
|
120
|
+
*/
|
|
121
|
+
decide(principal: Principal, action: Action, resource: Resource, context: DecisionContext): Promise<Decision>;
|
|
122
|
+
}
|
|
123
|
+
export * from './errors.js';
|
|
124
|
+
export * from './ports.js';
|
|
125
|
+
export * from './reason-codes.js';
|
|
126
|
+
export * from './decision-authority.js';
|
|
127
|
+
export * from './default-gates.js';
|
|
128
|
+
export * from './gates/tenant.js';
|
|
129
|
+
export * from './gates/object-type.js';
|
|
130
|
+
export * from './record/rule-evaluator.js';
|
|
131
|
+
export * from './record/shares.js';
|
|
132
|
+
export * from './cross-tenant/grant-evaluator.js';
|
|
133
|
+
export * from './delegation/operation-identity.js';
|
|
134
|
+
export * from './record/permit-tier.js';
|
|
135
|
+
export * from './gates/wiring.js';
|
|
136
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","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