@astram/guard 0.6.0 → 0.8.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/dist/auth/account.controller.d.ts +3 -1
- package/dist/auth/account.controller.d.ts.map +1 -1
- package/dist/auth/account.controller.js +12 -5
- package/dist/auth/auth.controller.d.ts +130 -21
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +537 -143
- package/dist/auth/auth.module.d.ts +15 -1
- package/dist/auth/auth.module.d.ts.map +1 -1
- package/dist/auth/auth.module.js +241 -30
- package/dist/auth/connections.d.ts +1 -1
- package/dist/auth/connections.d.ts.map +1 -1
- package/dist/auth/connections.js +14 -3
- package/dist/auth/default-session-facts-projector.d.ts +26 -0
- package/dist/auth/default-session-facts-projector.d.ts.map +1 -0
- package/dist/auth/default-session-facts-projector.js +21 -0
- package/dist/auth/mfa-step-up.d.ts +32 -0
- package/dist/auth/mfa-step-up.d.ts.map +1 -0
- package/dist/auth/mfa-step-up.js +109 -0
- package/dist/auth/pending-mfa-store.d.ts +50 -52
- package/dist/auth/pending-mfa-store.d.ts.map +1 -1
- package/dist/auth/pending-mfa-store.js +103 -61
- package/dist/auth/ports/session-facts-projector.d.ts +5 -0
- package/dist/auth/ports/session-facts-projector.d.ts.map +1 -1
- package/dist/auth/rate-limit/canonical-hint.d.ts +24 -0
- package/dist/auth/rate-limit/canonical-hint.d.ts.map +1 -0
- package/dist/auth/rate-limit/canonical-hint.js +63 -0
- package/dist/auth/rate-limit/trust-proxy-check.d.ts +46 -0
- package/dist/auth/rate-limit/trust-proxy-check.d.ts.map +1 -0
- package/dist/auth/rate-limit/trust-proxy-check.js +94 -0
- package/dist/auth/tokens.d.ts +70 -11
- package/dist/auth/tokens.d.ts.map +1 -1
- package/dist/auth/tokens.js +71 -12
- package/dist/authentication/log-email-sender.d.ts +9 -4
- package/dist/authentication/log-email-sender.d.ts.map +1 -1
- package/dist/authentication/mariadb-api-key-store.d.ts +46 -0
- package/dist/authentication/mariadb-api-key-store.d.ts.map +1 -0
- package/dist/authentication/mariadb-api-key-store.js +111 -0
- package/dist/authentication/mariadb-credential-resolver.d.ts +79 -65
- package/dist/authentication/mariadb-credential-resolver.d.ts.map +1 -1
- package/dist/authentication/mariadb-credential-resolver.js +116 -73
- package/dist/authentication/mariadb-credential-writer.d.ts.map +1 -1
- package/dist/authentication/mariadb-or-totp-verifier.d.ts +21 -3
- package/dist/authentication/mariadb-or-totp-verifier.d.ts.map +1 -1
- package/dist/authentication/mariadb-or-totp-verifier.js +37 -6
- package/dist/authentication/mariadb-profile-resolver.d.ts.map +1 -1
- package/dist/authentication/mariadb-profile-writer.d.ts.map +1 -1
- package/dist/authentication/mariadb-session-sweeper.d.ts +14 -1
- package/dist/authentication/mariadb-session-sweeper.d.ts.map +1 -1
- package/dist/authentication/mariadb-session-sweeper.js +29 -11
- package/dist/authentication/noop-email-sender.d.ts +12 -0
- package/dist/authentication/noop-email-sender.d.ts.map +1 -0
- package/dist/authentication/noop-email-sender.js +9 -0
- package/dist/authz/cross-tenant-grant-writer.d.ts.map +1 -1
- package/dist/authz/manifest-operation-authority-adapter.d.ts.map +1 -1
- package/dist/authz/mariadb-cross-tenant-grant-adapter.d.ts.map +1 -1
- package/dist/authz/mariadb-cross-tenant-grant-adapter.js +3 -1
- package/dist/authz/mariadb-policy-store.js +1 -1
- package/dist/authz/mariadb-record-rule-adapter.d.ts.map +1 -1
- package/dist/authz/mariadb-record-rule-adapter.js +1 -4
- package/dist/authz/permission-version-cache.d.ts +38 -0
- package/dist/authz/permission-version-cache.d.ts.map +1 -0
- package/dist/authz/permission-version-cache.js +81 -0
- package/dist/authz/wire-record-authorization.d.ts +25 -1
- package/dist/authz/wire-record-authorization.d.ts.map +1 -1
- package/dist/authz/wire-record-authorization.js +55 -2
- package/dist/completeness/catalog-reconciler.d.ts.map +1 -1
- package/dist/config/app-config.d.ts +52 -0
- package/dist/config/app-config.d.ts.map +1 -1
- package/dist/config/app-config.js +66 -4
- package/dist/encryption/local-kek-crypto.d.ts +15 -0
- package/dist/encryption/local-kek-crypto.d.ts.map +1 -0
- package/dist/encryption/local-kek-crypto.js +79 -0
- package/dist/enforcement/enforcement.module.d.ts.map +1 -1
- package/dist/enforcement/enforcement.module.js +9 -0
- package/dist/enforcement/engine-error.filter.d.ts +57 -0
- package/dist/enforcement/engine-error.filter.d.ts.map +1 -0
- package/dist/enforcement/engine-error.filter.js +118 -0
- package/dist/enforcement/global-enforcement.guard.d.ts +31 -2
- package/dist/enforcement/global-enforcement.guard.d.ts.map +1 -1
- package/dist/enforcement/global-enforcement.guard.js +148 -6
- package/dist/identity/auth-facts.controller.d.ts.map +1 -1
- package/dist/identity/identity-actions.d.ts +9 -0
- package/dist/identity/identity-actions.d.ts.map +1 -1
- package/dist/identity/identity-actions.js +16 -1
- package/dist/identity/permission-facts.adapter.d.ts.map +1 -1
- package/dist/identity/permission-facts.adapter.js +2 -3
- package/dist/index.d.ts +17 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -25
- package/dist/module/shield.module.d.ts +9 -2
- package/dist/module/shield.module.d.ts.map +1 -1
- package/dist/module/shield.module.js +47 -38
- package/dist/request-auth/request-principal.d.ts +11 -3
- package/dist/request-auth/request-principal.d.ts.map +1 -1
- package/dist/request-auth/request-principal.js +58 -2
- package/dist/request-auth/session-facts-als.d.ts +16 -1
- package/dist/request-auth/session-facts-als.d.ts.map +1 -1
- package/dist/request-auth/session-facts-als.js +23 -0
- package/dist/request-auth/session-token-binder.d.ts +166 -10
- package/dist/request-auth/session-token-binder.d.ts.map +1 -1
- package/dist/request-auth/session-token-binder.js +408 -28
- package/dist/request-auth/tokens.d.ts +10 -0
- package/dist/request-auth/tokens.d.ts.map +1 -1
- package/dist/request-auth/tokens.js +11 -1
- package/dist/secrets/encrypted-file-secrets.d.ts +16 -0
- package/dist/secrets/encrypted-file-secrets.d.ts.map +1 -0
- package/dist/secrets/encrypted-file-secrets.js +98 -0
- package/dist/session/hot-revoking-session-record-store.d.ts +46 -0
- package/dist/session/hot-revoking-session-record-store.d.ts.map +1 -0
- package/dist/session/hot-revoking-session-record-store.js +58 -0
- package/dist/session/index.d.ts +3 -1
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +8 -1
- package/dist/session/mariadb-session-record-store.d.ts +6 -0
- package/dist/session/mariadb-session-record-store.d.ts.map +1 -1
- package/dist/session/mariadb-session-record-store.js +16 -1
- package/dist/session/session-lifetimes.d.ts +30 -0
- package/dist/session/session-lifetimes.d.ts.map +1 -0
- package/dist/session/session-lifetimes.js +21 -0
- package/dist/session/session-restriction-store.d.ts +43 -0
- package/dist/session/session-restriction-store.d.ts.map +1 -0
- package/dist/session/session-restriction-store.js +35 -0
- package/migrations/1710000000017-CreateServiceAccountKey.cjs +41 -0
- package/package.json +3 -3
|
@@ -18,9 +18,24 @@ const core_1 = require("@nestjs/core");
|
|
|
18
18
|
const classification_decorator_js_1 = require("./classification.decorator.js");
|
|
19
19
|
const shield_tokens_js_1 = require("../module/shield-tokens.js");
|
|
20
20
|
const tokens_js_1 = require("../request-auth/tokens.js");
|
|
21
|
+
const session_token_binder_js_1 = require("../request-auth/session-token-binder.js");
|
|
21
22
|
const request_principal_js_1 = require("../request-auth/request-principal.js");
|
|
23
|
+
const tokens_js_2 = require("../auth/tokens.js");
|
|
22
24
|
const session_facts_als_js_1 = require("../request-auth/session-facts-als.js");
|
|
23
25
|
const reenroll_allowlist_js_1 = require("./reenroll-allowlist.js");
|
|
26
|
+
/** A subtree re-derive that was due but could not be done (resolver error / empty / junk). */
|
|
27
|
+
const SUBTREE_REDERIVE_FAILED = Symbol('subtree-rederive-failed');
|
|
28
|
+
/**
|
|
29
|
+
* The binding's cached facts as gate 5 may use them (ADR-0035): absent, or at/past their
|
|
30
|
+
* `validUntilMs` time bound ⇒ `null` (gate 5 reloads). Never fabricated.
|
|
31
|
+
*/
|
|
32
|
+
function usableCachedFacts(facts, nowMs) {
|
|
33
|
+
if (facts === undefined)
|
|
34
|
+
return null;
|
|
35
|
+
if (typeof facts.validUntilMs === 'number' && nowMs >= facts.validUntilMs)
|
|
36
|
+
return null;
|
|
37
|
+
return facts;
|
|
38
|
+
}
|
|
24
39
|
/**
|
|
25
40
|
* Global, fail-closed enforcement guard (ADR-0002) — now with REAL request
|
|
26
41
|
* authorization for classified routes.
|
|
@@ -52,10 +67,14 @@ let GlobalEnforcementGuard = class GlobalEnforcementGuard {
|
|
|
52
67
|
reflector;
|
|
53
68
|
decisionAuthority;
|
|
54
69
|
tokenBinder;
|
|
55
|
-
|
|
70
|
+
serviceAuth;
|
|
71
|
+
scopeSubtreeResolver;
|
|
72
|
+
constructor(reflector, decisionAuthority, tokenBinder, serviceAuth, scopeSubtreeResolver) {
|
|
56
73
|
this.reflector = reflector;
|
|
57
74
|
this.decisionAuthority = decisionAuthority;
|
|
58
75
|
this.tokenBinder = tokenBinder;
|
|
76
|
+
this.serviceAuth = serviceAuth;
|
|
77
|
+
this.scopeSubtreeResolver = scopeSubtreeResolver;
|
|
59
78
|
}
|
|
60
79
|
async canActivate(context) {
|
|
61
80
|
// Only HTTP requests are classified here. Non-HTTP contexts (if ever added)
|
|
@@ -90,11 +109,11 @@ let GlobalEnforcementGuard = class GlobalEnforcementGuard {
|
|
|
90
109
|
// Absent → we cannot authenticate the caller → DENY (never allow-through).
|
|
91
110
|
if (this.tokenBinder === undefined || this.decisionAuthority === undefined) {
|
|
92
111
|
throw new common_1.ForbiddenException('Shield enforcement: this route is @Classified but request authentication is not ' +
|
|
93
|
-
|
|
112
|
+
'enabled (ShieldModule.forRoot({ auth: true })). It is denied by default.');
|
|
94
113
|
}
|
|
95
114
|
const req = context.switchToHttp().getRequest();
|
|
96
115
|
const authHeader = req?.headers?.['authorization'];
|
|
97
|
-
const resolved = await (0, request_principal_js_1.resolveRequestAuth)(authHeader, this.tokenBinder);
|
|
116
|
+
const resolved = await (0, request_principal_js_1.resolveRequestAuth)(authHeader, this.tokenBinder, this.serviceAuth);
|
|
98
117
|
if (resolved === null) {
|
|
99
118
|
// No/invalid/expired token → not authenticated. 401 (distinct from a deny).
|
|
100
119
|
throw new common_1.UnauthorizedException('Shield enforcement: missing or invalid access token for a classified route.');
|
|
@@ -136,17 +155,136 @@ let GlobalEnforcementGuard = class GlobalEnforcementGuard {
|
|
|
136
155
|
// FAIL-CLOSED: no projector wired / absent / malformed binding → `claims.cachedFacts`
|
|
137
156
|
// is undefined → the store carries `cachedFacts: null` → gate 5 DB-reloads (today's
|
|
138
157
|
// behavior). The cache is only ever consulted; it never fabricates a permit.
|
|
158
|
+
//
|
|
159
|
+
// RELOAD SIGNAL (security hardening Phase 1C): when gate 5 reloads THIS principal's grants,
|
|
160
|
+
// the framework-built authority reports the reloaded (authoritative) version here.
|
|
161
|
+
//
|
|
162
|
+
// TIME BOUND (ADR-0035): cached facts at or past their `validUntilMs` (the next start or end of
|
|
163
|
+
// a role posting's window — a change no version bump marks) are treated as ABSENT, so gate 5
|
|
164
|
+
// reloads them (and the roles with them, below).
|
|
165
|
+
let reloaded;
|
|
166
|
+
const usableFacts = usableCachedFacts(claims.cachedFacts, Date.now());
|
|
139
167
|
const factsStore = {
|
|
140
|
-
cachedFacts:
|
|
141
|
-
permissionsVersion:
|
|
168
|
+
cachedFacts: usableFacts,
|
|
169
|
+
permissionsVersion: usableFacts?.permissionsVersion ?? 0,
|
|
170
|
+
onReload: (principalId, tenantId, grants) => {
|
|
171
|
+
if (principalId === principal.id && tenantId === principal.tenantId) {
|
|
172
|
+
reloaded = grants;
|
|
173
|
+
}
|
|
174
|
+
},
|
|
142
175
|
};
|
|
143
176
|
const decision = await session_facts_als_js_1.SHIELD_SESSION_FACTS_ALS.run(factsStore, () => this.decisionAuthority.decide(principal, { key: classification.action }, { level: 'object_type', typeKey: classification.typeKey, tenantId: principal.tenantId }, { isAuthenticated: true }));
|
|
177
|
+
// The type-level decision above is on the principal's OWN tenant, which every subtree
|
|
178
|
+
// contains, so it does not depend on the subtree; the handler (engine record checks, the
|
|
179
|
+
// ADR-0034 create wall) is what reads it. Hence: decide first, then hand the handler the
|
|
180
|
+
// re-derived principal.
|
|
181
|
+
//
|
|
182
|
+
// LIVE ROLES (ADR-0035, GAPS #4): the reload also carries the principal's in-effect roles (when
|
|
183
|
+
// the app port reports them). The handler gets them on THIS request (role-keyed record rules,
|
|
184
|
+
// list scope, shares, the engine's record checks all read `req.principal.roleIds`), and the
|
|
185
|
+
// binding is rewritten with the reloaded facts + roles together, so the next requests are
|
|
186
|
+
// served from the cache (GAPS #6) with the same live roles.
|
|
187
|
+
if (reloaded !== undefined) {
|
|
188
|
+
const liveRoles = (0, session_token_binder_js_1.liveRoleIds)(reloaded);
|
|
189
|
+
const current = liveRoles !== undefined ? { ...claims, roleIds: liveRoles } : claims;
|
|
190
|
+
const rederived = await this.rederiveSubtreeOnVersionMove(authHeader, current, reloaded.permissionsVersion);
|
|
191
|
+
// A subtree re-derive that was due but FAILED (resolver error / empty) keeps the facts
|
|
192
|
+
// uncached, so the next request reloads and retries it (the Phase 1C retry guarantee).
|
|
193
|
+
if (rederived !== SUBTREE_REDERIVE_FAILED) {
|
|
194
|
+
await this.rebindReloadedGrants(authHeader, claims, reloaded, liveRoles);
|
|
195
|
+
}
|
|
196
|
+
if (rederived !== null && rederived !== SUBTREE_REDERIVE_FAILED) {
|
|
197
|
+
req.principal = rederived;
|
|
198
|
+
}
|
|
199
|
+
else if (liveRoles !== undefined) {
|
|
200
|
+
const withRoles = (0, request_principal_js_1.principalFromClaims)(current);
|
|
201
|
+
if (withRoles !== null)
|
|
202
|
+
req.principal = withRoles;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
144
205
|
if (decision.effect === 'allow') {
|
|
145
206
|
return true;
|
|
146
207
|
}
|
|
147
208
|
// Deny (or any non-allow) → 403. Do NOT leak the reason detail to the caller.
|
|
148
209
|
throw new common_1.ForbiddenException(`Shield enforcement: access denied for ${classification.action} on ${classification.typeKey}.`);
|
|
149
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Write gate 5's reloaded grants and the live roles onto the session binding (ADR-0035). Session
|
|
213
|
+
* bindings only: a service-account key has no binding (its roles and scope are read live per
|
|
214
|
+
* request by the key store). Best-effort and conditional (same session, same tenant, fresher
|
|
215
|
+
* facts, `XX`): a miss or a Redis error only means the next request reloads again.
|
|
216
|
+
*/
|
|
217
|
+
async rebindReloadedGrants(authHeader, claims, grants, liveRoles) {
|
|
218
|
+
if (this.tokenBinder === undefined)
|
|
219
|
+
return;
|
|
220
|
+
if (claims.sessionId === '' || claims.kind === 'service_account')
|
|
221
|
+
return;
|
|
222
|
+
const token = (0, request_principal_js_1.extractBearerToken)(authHeader);
|
|
223
|
+
if (token === null)
|
|
224
|
+
return;
|
|
225
|
+
try {
|
|
226
|
+
await this.tokenBinder.refreshGrants(token, claims.sessionId, claims.tenantId, grants, liveRoles);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
// Best-effort: the decision and the handler's principal already use the reloaded grants.
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Re-derive the session's scope subtree after gate 5 reloaded facts at `reloadedVersion`
|
|
234
|
+
* (security hardening Phase 1C). Identity bumps a tenant's permission version when a company is
|
|
235
|
+
* created, moved or deleted under it, so a reload at a version newer than the bound subtree's
|
|
236
|
+
* stamp means the subtree may be stale: resolve it again with the SAME resolver login uses,
|
|
237
|
+
* rebind it (token + session entries) and return the principal the handler should see.
|
|
238
|
+
*
|
|
239
|
+
* Off the hot path: runs only for a session binding that carries a subtree, with a resolver
|
|
240
|
+
* wired, and a reload NEWER than its stamp (or no stamp yet — once, then stamped). That is the
|
|
241
|
+
* only DB read added (one closure query), and only on a version change.
|
|
242
|
+
*
|
|
243
|
+
* FAIL-CLOSED, NON-WIDENING: a resolver error, a non-array or an EMPTY result →
|
|
244
|
+
* {@link SUBTREE_REDERIVE_FAILED}: the bound subtree stays (never replaced by a guess, never
|
|
245
|
+
* widened), the stamp is not advanced, the reloaded facts are not cached (ADR-0035), and the next
|
|
246
|
+
* request reloads and retries. `null` = no re-derive was due. A failed Redis rebind still returns the fresh principal for this request
|
|
247
|
+
* (the DB answer is authoritative); the next reload retries the rebind.
|
|
248
|
+
*/
|
|
249
|
+
async rederiveSubtreeOnVersionMove(authHeader, claims, reloadedVersion) {
|
|
250
|
+
const resolver = this.scopeSubtreeResolver;
|
|
251
|
+
if (resolver === undefined || resolver === null || this.tokenBinder === undefined)
|
|
252
|
+
return null;
|
|
253
|
+
// Session bindings only: a service-account key has no binding (its scope is read live per
|
|
254
|
+
// request by the key store) and no session id.
|
|
255
|
+
if (claims.sessionId === '' || claims.kind === 'service_account')
|
|
256
|
+
return null;
|
|
257
|
+
// Only a binding that carries a subtree: an absent one is the self-node fallback (no resolver
|
|
258
|
+
// or a failed login-time resolve) and stays that way until the next login/refresh.
|
|
259
|
+
if (claims.scopeSubtreeNodeIds === undefined || claims.scopeSubtreeNodeIds.length === 0) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
const stamp = claims.scopeSubtreeVersion;
|
|
263
|
+
if (stamp !== undefined && reloadedVersion <= stamp)
|
|
264
|
+
return null;
|
|
265
|
+
let subtree;
|
|
266
|
+
try {
|
|
267
|
+
const resolved = await resolver.resolveSubtree(claims.tenantId);
|
|
268
|
+
if (!Array.isArray(resolved) || resolved.length === 0)
|
|
269
|
+
return SUBTREE_REDERIVE_FAILED;
|
|
270
|
+
if (resolved.some((n) => typeof n !== 'string' || n.length === 0)) {
|
|
271
|
+
return SUBTREE_REDERIVE_FAILED;
|
|
272
|
+
}
|
|
273
|
+
subtree = [...resolved];
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return SUBTREE_REDERIVE_FAILED;
|
|
277
|
+
}
|
|
278
|
+
const token = (0, request_principal_js_1.extractBearerToken)(authHeader);
|
|
279
|
+
if (token !== null) {
|
|
280
|
+
await this.tokenBinder.rederiveScopeSubtree(token, claims.sessionId, claims.tenantId, subtree, reloadedVersion);
|
|
281
|
+
}
|
|
282
|
+
return (0, request_principal_js_1.principalFromClaims)({
|
|
283
|
+
...claims,
|
|
284
|
+
scopeSubtreeNodeIds: subtree,
|
|
285
|
+
scopeSubtreeVersion: reloadedVersion,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
150
288
|
};
|
|
151
289
|
exports.GlobalEnforcementGuard = GlobalEnforcementGuard;
|
|
152
290
|
exports.GlobalEnforcementGuard = GlobalEnforcementGuard = __decorate([
|
|
@@ -155,5 +293,9 @@ exports.GlobalEnforcementGuard = GlobalEnforcementGuard = __decorate([
|
|
|
155
293
|
__param(1, (0, common_1.Inject)(shield_tokens_js_1.SHIELD_DECISION_AUTHORITY)),
|
|
156
294
|
__param(2, (0, common_1.Optional)()),
|
|
157
295
|
__param(2, (0, common_1.Inject)(tokens_js_1.SHIELD_SESSION_TOKEN_BINDER)),
|
|
158
|
-
|
|
296
|
+
__param(3, (0, common_1.Optional)()),
|
|
297
|
+
__param(3, (0, common_1.Inject)(tokens_js_1.SHIELD_SERVICE_AUTHENTICATOR)),
|
|
298
|
+
__param(4, (0, common_1.Optional)()),
|
|
299
|
+
__param(4, (0, common_1.Inject)(tokens_js_2.SHIELD_SCOPE_SUBTREE_RESOLVER)),
|
|
300
|
+
__metadata("design:paramtypes", [core_1.Reflector, Object, Function, Object, Object])
|
|
159
301
|
], GlobalEnforcementGuard);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-facts.controller.d.ts","sourceRoot":"","sources":["../../src/identity/auth-facts.controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"auth-facts.controller.d.ts","sourceRoot":"","sources":["../../src/identity/auth-facts.controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAGlF,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EACnC,MAAM,+BAA+B,CAAC;AAEvC,qBACa,mBAAmB;IAI5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAG5B,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAHL,WAAW,EAAE,kBAAkB,GAAG,SAAS,EAG3C,KAAK,EAAE,6BAA6B,GAAG,SAAS;IAK7D,YAAY,CACU,aAAa,CAAC,EAAE,MAAM,GAC/C,OAAO,CAAC,kBAAkB,CAAC;IAuBxB,qBAAqB,CACC,aAAa,CAAC,EAAE,MAAM,GAC/C,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAsB/B,qFAAqF;YACvE,YAAY;CAU3B"}
|
|
@@ -24,6 +24,15 @@ export type CrossTenantGrantAction = (typeof CROSS_TENANT_GRANT_ACTIONS)[number]
|
|
|
24
24
|
*/
|
|
25
25
|
export declare const RECORD_SHARE_ACTIONS: readonly ["share", "read"];
|
|
26
26
|
export type RecordShareAction = (typeof RECORD_SHARE_ACTIONS)[number];
|
|
27
|
+
/**
|
|
28
|
+
* `service_account`'s action vocabulary (ADR-0033). The CRUD verbs administer the ACCOUNT
|
|
29
|
+
* (`read`/list, `create`, `update` its label/scope/status, `delete`), plus `manage_keys` — the
|
|
30
|
+
* one credential-lifecycle action gating issue/rotate/revoke of the account's `ask_…` API keys
|
|
31
|
+
* (a distinct, more-sensitive capability than editing the account row, so it can be granted
|
|
32
|
+
* separately: an admin may edit an agent's label without holding the power to mint its keys).
|
|
33
|
+
*/
|
|
34
|
+
export declare const SERVICE_ACCOUNT_ACTIONS: readonly ["read", "create", "update", "delete", "manage_keys"];
|
|
35
|
+
export type ServiceAccountAction = (typeof SERVICE_ACCOUNT_ACTIONS)[number];
|
|
27
36
|
/** The action vocabulary for `typeKey` — the per-type override if one exists, else the default. */
|
|
28
37
|
export declare function actionsFor(typeKey: string): readonly string[];
|
|
29
38
|
//# sourceMappingURL=identity-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-actions.d.ts","sourceRoot":"","sources":["../../src/identity/identity-actions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,aAAa,CAAC;AACrC,eAAO,MAAM,gBAAgB,iDAAkD,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,wCAAyC,CAAC;AACjF,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,4BAA6B,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-actions.d.ts","sourceRoot":"","sources":["../../src/identity/identity-actions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,aAAa,CAAC;AACrC,eAAO,MAAM,gBAAgB,iDAAkD,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,wCAAyC,CAAC;AACjF,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,4BAA6B,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,gEAM1B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAY5E,mGAAmG;AACnG,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAE7D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RECORD_SHARE_ACTIONS = exports.CROSS_TENANT_GRANT_ACTIONS = exports.IDENTITY_ACTIONS = exports.MODULE_KEY = void 0;
|
|
3
|
+
exports.SERVICE_ACCOUNT_ACTIONS = exports.RECORD_SHARE_ACTIONS = exports.CROSS_TENANT_GRANT_ACTIONS = exports.IDENTITY_ACTIONS = exports.MODULE_KEY = void 0;
|
|
4
4
|
exports.actionsFor = actionsFor;
|
|
5
5
|
/**
|
|
6
6
|
* The fixed action vocabulary + module key for the framework's @astram/identity objects.
|
|
@@ -25,6 +25,20 @@ exports.CROSS_TENANT_GRANT_ACTIONS = ['share', 'accept', 'revoke'];
|
|
|
25
25
|
* the real wall), `read` gates the list-a-record's-shares route.
|
|
26
26
|
*/
|
|
27
27
|
exports.RECORD_SHARE_ACTIONS = ['share', 'read'];
|
|
28
|
+
/**
|
|
29
|
+
* `service_account`'s action vocabulary (ADR-0033). The CRUD verbs administer the ACCOUNT
|
|
30
|
+
* (`read`/list, `create`, `update` its label/scope/status, `delete`), plus `manage_keys` — the
|
|
31
|
+
* one credential-lifecycle action gating issue/rotate/revoke of the account's `ask_…` API keys
|
|
32
|
+
* (a distinct, more-sensitive capability than editing the account row, so it can be granted
|
|
33
|
+
* separately: an admin may edit an agent's label without holding the power to mint its keys).
|
|
34
|
+
*/
|
|
35
|
+
exports.SERVICE_ACCOUNT_ACTIONS = [
|
|
36
|
+
'read',
|
|
37
|
+
'create',
|
|
38
|
+
'update',
|
|
39
|
+
'delete',
|
|
40
|
+
'manage_keys',
|
|
41
|
+
];
|
|
28
42
|
/**
|
|
29
43
|
* Per-type action-vocabulary override. Every type not listed here defaults to
|
|
30
44
|
* {@link IDENTITY_ACTIONS} (the CRUD verbs).
|
|
@@ -32,6 +46,7 @@ exports.RECORD_SHARE_ACTIONS = ['share', 'read'];
|
|
|
32
46
|
const ACTIONS_BY_TYPE = {
|
|
33
47
|
cross_tenant_grant: exports.CROSS_TENANT_GRANT_ACTIONS,
|
|
34
48
|
record_share: exports.RECORD_SHARE_ACTIONS,
|
|
49
|
+
service_account: exports.SERVICE_ACCOUNT_ACTIONS,
|
|
35
50
|
};
|
|
36
51
|
/** The action vocabulary for `typeKey` — the per-type override if one exists, else the default. */
|
|
37
52
|
function actionsFor(typeKey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permission-facts.adapter.d.ts","sourceRoot":"","sources":["../../src/identity/permission-facts.adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AACD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,yFAAyF;AACzF,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,OAAO,SAA8B;CAIlD;
|
|
1
|
+
{"version":3,"file":"permission-facts.adapter.d.ts","sourceRoot":"","sources":["../../src/identity/permission-facts.adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE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Id);
|
|
35
35
|
const granted = roleIds.length > 0 ? await this.readGrantKeys(roleIds) : [];
|
|
36
36
|
const expanded = this.expandGrantKeys(granted);
|
|
37
|
-
const keys = isRoot
|
|
38
|
-
? [...new Set([...expanded, ...this.controlPlaneKeys])]
|
|
39
|
-
: expanded;
|
|
37
|
+
const keys = isRoot ? [...new Set([...expanded, ...this.controlPlaneKeys])] : expanded;
|
|
40
38
|
const permissionsVersion = await this.readVersion(tenantId);
|
|
41
39
|
return {
|
|
42
40
|
principalId,
|
|
@@ -65,6 +63,7 @@ class MariaDbPermissionFactsAdapter {
|
|
|
65
63
|
const nowMs = this.now();
|
|
66
64
|
const rows = (await this.pool.query(`SELECT DISTINCT mp.mp_role_uuid AS role_uuid
|
|
67
65
|
FROM \`shield_app\`.\`company_membership\` cm
|
|
66
|
+
JOIN \`shield_app\`.\`users\` u ON u.u_uuid = cm.cm_user_uuid AND u.u_status = 'active'
|
|
68
67
|
JOIN \`shield_app\`.\`membership_posting\` mp ON mp.mp_membership_uuid = cm.cm_uuid
|
|
69
68
|
WHERE cm.cm_user_uuid = ? AND cm.cm_company_uuid = ? AND cm.cm_is_active = 1
|
|
70
69
|
AND (mp.mp_effective_from_ms IS NULL OR mp.mp_effective_from_ms <= ?)
|
package/dist/index.d.ts
CHANGED
|
@@ -23,15 +23,18 @@ export type { Classification } from './enforcement/classification.decorator.js';
|
|
|
23
23
|
export { OperationInventoryScanner } from './completeness/operation-inventory-scanner.js';
|
|
24
24
|
export { CatalogReconciler, CatalogGatabilityError } from './completeness/catalog-reconciler.js';
|
|
25
25
|
export type { CatalogStore, CatalogPermissionRow, ReconcileReport, } from './completeness/ports/catalog-store.js';
|
|
26
|
-
export { SHIELD_SESSION_TOKEN_BINDER } from './request-auth/tokens.js';
|
|
26
|
+
export { SHIELD_SESSION_TOKEN_BINDER, SHIELD_SERVICE_AUTHENTICATOR, } from './request-auth/tokens.js';
|
|
27
27
|
export { SessionTokenBinder } from './request-auth/session-token-binder.js';
|
|
28
|
-
export type { BoundPrincipalClaims } from './request-auth/session-token-binder.js';
|
|
29
|
-
export { resolveRequestPrincipal, principalFromClaims, extractBearerToken, } from './request-auth/request-principal.js';
|
|
28
|
+
export type { BoundPrincipalClaims, SessionTokenBinderOptions, } from './request-auth/session-token-binder.js';
|
|
29
|
+
export { resolveRequestPrincipal, resolveRequestAuth, principalFromClaims, extractBearerToken, isApiKey, } from './request-auth/request-principal.js';
|
|
30
|
+
export { MariaDbApiKeyStore } from './authentication/mariadb-api-key-store.js';
|
|
30
31
|
export { SHIELD_SESSION_FACTS_ALS, NO_SESSION_FACTS, type SessionFactsStore, } from './request-auth/session-facts-als.js';
|
|
31
32
|
export { GlobalEnforcementGuard } from './enforcement/global-enforcement.guard.js';
|
|
32
33
|
export { stubDecisionAuthority, type Effect, type CoreDecisionAuthority, type CoreDecision, type Principal, } from './enforcement/core-seam.js';
|
|
33
34
|
export { Argon2idPasswordHasher, argon2idHasherProvider, SHIELD_PASSWORD_HASHER, type Argon2idParams, } from './authentication/argon2id-password-hasher.js';
|
|
34
|
-
export {
|
|
35
|
+
export { LocalKekCrypto } from './encryption/local-kek-crypto.js';
|
|
36
|
+
export { EncryptedFileSecretsProvider } from './secrets/encrypted-file-secrets.js';
|
|
37
|
+
export { MariaDbSessionRecordStore, SHIELD_SESSION_RECORD_STORE, RedisHotSessionStore, SHIELD_HOT_SESSION_STORE, CryptoTokenGenerator, Sha256RefreshTokenHasher, SystemClock, cryptoTokenGeneratorProvider, refreshHasherProvider, systemClockProvider, SHIELD_TOKEN_GENERATOR, SHIELD_REFRESH_HASHER, SHIELD_CLOCK, HotRevokingSessionRecordStore, type SessionHotRevoker, type LineageSessionLookup, SHIELD_SESSION_LIFETIMES, ROTATE_GRACE_MS, accessBindingTtlMs, } from './session/index.js';
|
|
35
38
|
export { MariaDbRecordPermissionRuleAdapter, SHIELD_RECORD_RULE_PORT, type RuleQueryable, } from './authz/mariadb-record-rule-adapter.js';
|
|
36
39
|
export { MariaDbPolicyStore, SHIELD_POLICY_STORE, type RuleQueryable as PolicyStoreQueryable, } from './authz/mariadb-policy-store.js';
|
|
37
40
|
export { MariaDbListScopeAdapter, SHIELD_LIST_SCOPE_PORT, type ListScopeQueryable, } from './authz/mariadb-list-scope-adapter.js';
|
|
@@ -43,17 +46,22 @@ export { MariaDbCrossTenantGrantAdapter, SHIELD_CROSS_TENANT_GRANT_PORT, type Gr
|
|
|
43
46
|
export { CrossTenantGrantWriter, SHIELD_CROSS_TENANT_GRANT_WRITER, GrantNotPermittedError, InvalidGrantError, GrantStoreUnavailableError, type GrantAuthorizeFn, type GrantAuditEvent, type GrantAuditSink, type GrantGranteeKind, type GrantScope, type OfferGrantInput, type AcceptGrantInput, type RevokeGrantInput, } from './authz/cross-tenant-grant-writer.js';
|
|
44
47
|
export { ManifestOperationAuthorityAdapter, SHIELD_OPERATION_AUTHORITY_PORT, type OperationManifestEntry, } from './authz/manifest-operation-authority-adapter.js';
|
|
45
48
|
export { buildRecordAuthorization } from './authz/wire-record-authorization.js';
|
|
49
|
+
export { withRedisPermissionVersion, type BuildRecordAuthorizationOptions, } from './authz/wire-record-authorization.js';
|
|
50
|
+
export { RedisPermissionVersionCache, PERMISSION_VERSION_KEY_PREFIX, DEFAULT_PERMISSION_VERSION_TTL_MS, type PermissionVersionReader, type PermissionVersionPublisher, type RedisPermissionVersionCacheOptions, } from './authz/permission-version-cache.js';
|
|
51
|
+
export { SHIELD_PERMISSION_VERSION_CACHE } from './auth/tokens.js';
|
|
52
|
+
export { SHIELD_SESSION_RESTRICTIONS } from './auth/tokens.js';
|
|
53
|
+
export { MariaDbSessionRestrictionStore, type SessionRestrictionStore, type SessionRebuildFacts, } from './session/session-restriction-store.js';
|
|
46
54
|
export { buildListScopeFn, type ListScopeFn } from './authz/wire-record-authorization.js';
|
|
47
55
|
export { BootSequence, assertPoolBudget } from './boot/boot-sequence.js';
|
|
48
56
|
export { APP_CONFIG } from './config/config.module.js';
|
|
49
|
-
export { loadAppConfig, loadPoolBudget, evaluatePoolBudget, DEFAULT_POOL_BUDGET, SCHEMA_SVC_POOL_HARD_CAP, type AppConfig, type PoolBudgetConfig, type PoolBudgetEvaluation, type RuntimeAccountPools, loadDbConfig, loadRedisConfig, loadSessionLifetimes, loadRefreshHmacKey, assertRefreshHmacKey, DEFAULT_DB_CONFIG, DEFAULT_REDIS_URL, type DbConfig, type RedisConfig, type SessionLifetimeOverrides, } from './config/app-config.js';
|
|
57
|
+
export { loadAppConfig, loadPoolBudget, evaluatePoolBudget, DEFAULT_POOL_BUDGET, SCHEMA_SVC_POOL_HARD_CAP, type AppConfig, type PoolBudgetConfig, type PoolBudgetEvaluation, type RuntimeAccountPools, loadDbConfig, loadRedisConfig, loadSessionLifetimes, loadRefreshHmacKey, assertRefreshHmacKey, DEFAULT_DB_CONFIG, DEFAULT_REDIS_URL, type DbConfig, type RedisConfig, type SessionLifetimeOverrides, loadLoginIpLimit, DEFAULT_LOGIN_IP_LIMIT, isDevOrTestNodeEnv, type LoginIpLimitConfig, } from './config/app-config.js';
|
|
50
58
|
export { SHIELD_DB_POOL, SHIELD_REDIS, SHIELD_CREDENTIAL_RESOLVER, SHIELD_PROFILE_RESOLVER, SHIELD_AUTHENTICATOR, SHIELD_SESSION_AUTHORITY, SHIELD_CREDENTIAL_WRITER, SHIELD_RESET_TOKEN_STORE, SHIELD_EMAIL_SENDER, SHIELD_RECOVERY_CODE_STORE, SHIELD_PROFILE_WRITER, SHIELD_SESSION_SWEEPER, SHIELD_AUDIT_SINK, SHIELD_MFA_DEVICE_STORE, SHIELD_TOTP_VERIFIER_OVERRIDE, } from './auth/tokens.js';
|
|
51
59
|
export { MariaDbCredentialResolver } from './authentication/mariadb-credential-resolver.js';
|
|
52
60
|
export type { SessionView, SessionTokensView, SessionSuccess, LoginRequest, MfaChallengeResponse, LoginResponse, MfaRequest, MfaResponse, RefreshRequest, RefreshResponse, LogoutRequest, LogoutAck, } from './auth/dto.js';
|
|
53
61
|
export { PersistenceModule } from './auth/persistence.module.js';
|
|
54
62
|
export { AuthModule, type AuthModuleOptions } from './auth/auth.module.js';
|
|
55
63
|
export { makeDefaultTotpVerifier, resolveTotpVerifier, hmacSha1 } from './auth/auth.module.js';
|
|
56
|
-
export type { CredentialResolver, ResolvedCredential, RequiredFactor
|
|
64
|
+
export type { CredentialResolver, ResolvedCredential, RequiredFactor } from '@astram/core';
|
|
57
65
|
export type { FactorVerifier, FactorVerdict, Credential } from '@astram/core';
|
|
58
66
|
export type { ProfileResolver, CurrentUserProfile, ProfileRole, ProfileTenant, } from './auth/profile-resolver.js';
|
|
59
67
|
export type { CredentialWriter } from './auth/ports/credential-writer.js';
|
|
@@ -69,7 +77,9 @@ export { SHIELD_SESSION_FACTS_PROJECTOR } from './auth/tokens.js';
|
|
|
69
77
|
export type { ScopeSubtreeResolver } from './auth/ports/scope-subtree-resolver.js';
|
|
70
78
|
export { SHIELD_SCOPE_SUBTREE_RESOLVER } from './auth/tokens.js';
|
|
71
79
|
export { AuthController } from './auth/auth.controller.js';
|
|
72
|
-
export { PendingMfaStore } from './auth/pending-mfa-store.js';
|
|
80
|
+
export { PendingMfaStore, RedisPendingMfaStore, type PendingMfaChallenge, } from './auth/pending-mfa-store.js';
|
|
81
|
+
export { CredentialMfaStepUp, credentialFingerprint, challengeMatches, type MfaStepUp, type MfaStepUpResult, } from './auth/mfa-step-up.js';
|
|
82
|
+
export { SHIELD_MFA_LIMITER, SHIELD_MFA_STEP_UP, SHIELD_LOGIN_TOTP_VERIFIER, } from './auth/tokens.js';
|
|
73
83
|
export { generateTotpSecret, buildOtpauthUri, generateRecoveryCodes, } from './auth/totp-enrollment.js';
|
|
74
84
|
export { AccountController } from './auth/account.controller.js';
|
|
75
85
|
export { buildClosureRows, ScopeCycleError, ScopeDepthError, ScopeUnknownParentError, type ScopeEdge, type ClosureRow, } from './scope/closure-builder.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AASzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG1F,OAAO,EACL,YAAY,EACZ,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAI7B,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,MAAM,EACN,UAAU,EACV,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,2CAA2C,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAKhF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACjG,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,eAAe,GAChB,MAAM,uCAAuC,CAAC;AAM/C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AASzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAG1F,OAAO,EACL,YAAY,EACZ,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAI7B,KAAK,yBAAyB,GAC/B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,MAAM,EACN,UAAU,EACV,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,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AAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClF,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAK5E,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAMlE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAOjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,KAAK,mBAAmB,GACzB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAQjE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* `@nestjs/core`, `reflect-metadata`, `rxjs` so the host owns one copy of each.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.ScopeUnknownParentError = exports.ScopeDepthError = exports.ScopeCycleError = exports.buildClosureRows = exports.AccountController = exports.generateRecoveryCodes = exports.buildOtpauthUri = exports.generateTotpSecret = exports.PendingMfaStore = exports.AuthController = exports.SHIELD_SCOPE_SUBTREE_RESOLVER = exports.SHIELD_SESSION_FACTS_PROJECTOR = exports.hmacSha1 = exports.resolveTotpVerifier = void 0;
|
|
19
|
+
exports.accessBindingTtlMs = exports.ROTATE_GRACE_MS = exports.SHIELD_SESSION_LIFETIMES = exports.HotRevokingSessionRecordStore = exports.SHIELD_CLOCK = exports.SHIELD_REFRESH_HASHER = exports.SHIELD_TOKEN_GENERATOR = exports.systemClockProvider = exports.refreshHasherProvider = exports.cryptoTokenGeneratorProvider = exports.SystemClock = exports.Sha256RefreshTokenHasher = exports.CryptoTokenGenerator = exports.SHIELD_HOT_SESSION_STORE = exports.RedisHotSessionStore = exports.SHIELD_SESSION_RECORD_STORE = exports.MariaDbSessionRecordStore = exports.EncryptedFileSecretsProvider = exports.LocalKekCrypto = exports.SHIELD_PASSWORD_HASHER = exports.argon2idHasherProvider = exports.Argon2idPasswordHasher = exports.stubDecisionAuthority = exports.GlobalEnforcementGuard = exports.NO_SESSION_FACTS = exports.SHIELD_SESSION_FACTS_ALS = exports.MariaDbApiKeyStore = exports.isApiKey = exports.extractBearerToken = exports.principalFromClaims = exports.resolveRequestAuth = exports.resolveRequestPrincipal = exports.SessionTokenBinder = exports.SHIELD_SERVICE_AUTHENTICATOR = exports.SHIELD_SESSION_TOKEN_BINDER = exports.CatalogGatabilityError = exports.CatalogReconciler = exports.OperationInventoryScanner = exports.normalizeClassification = exports.DEFAULT_CLASSIFIED_ACTION = exports.CLASSIFICATION_METADATA = exports.Classified = exports.Public = exports.SHIELD_DECISION_AUTHORITY = exports.ShieldModule = exports.actionsFor = exports.IDENTITY_ACTIONS = exports.MODULE_KEY = exports.buildIdentityModuleRegistry = exports.guardMigrationsDir = void 0;
|
|
20
|
+
exports.DEFAULT_LOGIN_IP_LIMIT = exports.loadLoginIpLimit = exports.DEFAULT_REDIS_URL = exports.DEFAULT_DB_CONFIG = exports.assertRefreshHmacKey = exports.loadRefreshHmacKey = exports.loadSessionLifetimes = exports.loadRedisConfig = exports.loadDbConfig = exports.SCHEMA_SVC_POOL_HARD_CAP = exports.DEFAULT_POOL_BUDGET = exports.evaluatePoolBudget = exports.loadPoolBudget = exports.loadAppConfig = exports.APP_CONFIG = exports.assertPoolBudget = exports.BootSequence = exports.buildListScopeFn = exports.MariaDbSessionRestrictionStore = exports.SHIELD_SESSION_RESTRICTIONS = exports.SHIELD_PERMISSION_VERSION_CACHE = exports.DEFAULT_PERMISSION_VERSION_TTL_MS = exports.PERMISSION_VERSION_KEY_PREFIX = exports.RedisPermissionVersionCache = exports.withRedisPermissionVersion = exports.buildRecordAuthorization = exports.SHIELD_OPERATION_AUTHORITY_PORT = exports.ManifestOperationAuthorityAdapter = exports.GrantStoreUnavailableError = exports.InvalidGrantError = exports.GrantNotPermittedError = exports.SHIELD_CROSS_TENANT_GRANT_WRITER = exports.CrossTenantGrantWriter = exports.SHIELD_CROSS_TENANT_GRANT_PORT = exports.MariaDbCrossTenantGrantAdapter = exports.makeShareDeleteCascade = exports.ShareStoreUnavailableError = exports.ShareNotPermittedError = exports.SHIELD_RECORD_SHARE_WRITER = exports.RecordShareWriter = exports.SHIELD_RECORD_SHARE_PORT = exports.MariaDbRecordShareAdapter = exports.UnknownScopeFieldError = exports.translateListScope = exports.SHIELD_LIST_SCOPE_PORT = exports.MariaDbListScopeAdapter = exports.SHIELD_POLICY_STORE = exports.MariaDbPolicyStore = exports.SHIELD_RECORD_RULE_PORT = exports.MariaDbRecordPermissionRuleAdapter = void 0;
|
|
21
|
+
exports.ScopeUnknownParentError = exports.ScopeDepthError = exports.ScopeCycleError = exports.buildClosureRows = exports.AccountController = exports.generateRecoveryCodes = exports.buildOtpauthUri = exports.generateTotpSecret = exports.SHIELD_LOGIN_TOTP_VERIFIER = exports.SHIELD_MFA_STEP_UP = exports.SHIELD_MFA_LIMITER = exports.challengeMatches = exports.credentialFingerprint = exports.CredentialMfaStepUp = exports.RedisPendingMfaStore = exports.PendingMfaStore = exports.AuthController = exports.SHIELD_SCOPE_SUBTREE_RESOLVER = exports.SHIELD_SESSION_FACTS_PROJECTOR = exports.hmacSha1 = exports.resolveTotpVerifier = exports.makeDefaultTotpVerifier = exports.AuthModule = exports.PersistenceModule = exports.MariaDbCredentialResolver = exports.SHIELD_TOTP_VERIFIER_OVERRIDE = exports.SHIELD_MFA_DEVICE_STORE = exports.SHIELD_AUDIT_SINK = exports.SHIELD_SESSION_SWEEPER = exports.SHIELD_PROFILE_WRITER = exports.SHIELD_RECOVERY_CODE_STORE = exports.SHIELD_EMAIL_SENDER = exports.SHIELD_RESET_TOKEN_STORE = exports.SHIELD_CREDENTIAL_WRITER = exports.SHIELD_SESSION_AUTHORITY = exports.SHIELD_AUTHENTICATOR = exports.SHIELD_PROFILE_RESOLVER = exports.SHIELD_CREDENTIAL_RESOLVER = exports.SHIELD_REDIS = exports.SHIELD_DB_POOL = exports.isDevOrTestNodeEnv = void 0;
|
|
22
22
|
// Framework authz migrations (shield_authz DDL — permission / role_permission /
|
|
23
23
|
// authz_permission_version). Absolute path a consumer's `@astram/migrate` setup merges in.
|
|
24
24
|
var migrations_dir_js_1 = require("./migrations-dir.js");
|
|
@@ -61,12 +61,19 @@ Object.defineProperty(exports, "CatalogGatabilityError", { enumerable: true, get
|
|
|
61
61
|
// internally — a consumer does NOT hand-wire request auth.
|
|
62
62
|
var tokens_js_1 = require("./request-auth/tokens.js");
|
|
63
63
|
Object.defineProperty(exports, "SHIELD_SESSION_TOKEN_BINDER", { enumerable: true, get: function () { return tokens_js_1.SHIELD_SESSION_TOKEN_BINDER; } });
|
|
64
|
+
Object.defineProperty(exports, "SHIELD_SERVICE_AUTHENTICATOR", { enumerable: true, get: function () { return tokens_js_1.SHIELD_SERVICE_AUTHENTICATOR; } });
|
|
64
65
|
var session_token_binder_js_1 = require("./request-auth/session-token-binder.js");
|
|
65
66
|
Object.defineProperty(exports, "SessionTokenBinder", { enumerable: true, get: function () { return session_token_binder_js_1.SessionTokenBinder; } });
|
|
66
67
|
var request_principal_js_1 = require("./request-auth/request-principal.js");
|
|
67
68
|
Object.defineProperty(exports, "resolveRequestPrincipal", { enumerable: true, get: function () { return request_principal_js_1.resolveRequestPrincipal; } });
|
|
69
|
+
Object.defineProperty(exports, "resolveRequestAuth", { enumerable: true, get: function () { return request_principal_js_1.resolveRequestAuth; } });
|
|
68
70
|
Object.defineProperty(exports, "principalFromClaims", { enumerable: true, get: function () { return request_principal_js_1.principalFromClaims; } });
|
|
69
71
|
Object.defineProperty(exports, "extractBearerToken", { enumerable: true, get: function () { return request_principal_js_1.extractBearerToken; } });
|
|
72
|
+
Object.defineProperty(exports, "isApiKey", { enumerable: true, get: function () { return request_principal_js_1.isApiKey; } });
|
|
73
|
+
// Machine/agent auth (ADR-0033): the MariaDB ApiKeyStore adapter (hash-only) — a consumer wires it
|
|
74
|
+
// + a ServiceAuthenticator to enable `Authorization: Bearer ask_…` service-account access.
|
|
75
|
+
var mariadb_api_key_store_js_1 = require("./authentication/mariadb-api-key-store.js");
|
|
76
|
+
Object.defineProperty(exports, "MariaDbApiKeyStore", { enumerable: true, get: function () { return mariadb_api_key_store_js_1.MariaDbApiKeyStore; } });
|
|
70
77
|
// The per-request session-facts hot path (ADR-0011): the SINGLE shared
|
|
71
78
|
// `AsyncLocalStorage` the enforcement guard ENTERS around decide() and the consumer's
|
|
72
79
|
// app-owned `SessionFactsReader` READS. The consumer imports THIS exact singleton to
|
|
@@ -100,6 +107,16 @@ var argon2id_password_hasher_js_1 = require("./authentication/argon2id-password-
|
|
|
100
107
|
Object.defineProperty(exports, "Argon2idPasswordHasher", { enumerable: true, get: function () { return argon2id_password_hasher_js_1.Argon2idPasswordHasher; } });
|
|
101
108
|
Object.defineProperty(exports, "argon2idHasherProvider", { enumerable: true, get: function () { return argon2id_password_hasher_js_1.argon2idHasherProvider; } });
|
|
102
109
|
Object.defineProperty(exports, "SHIELD_PASSWORD_HASHER", { enumerable: true, get: function () { return argon2id_password_hasher_js_1.SHIELD_PASSWORD_HASHER; } });
|
|
110
|
+
// The reference `CryptoPort` adapter (ADR-0031 envelope encryption): real AES-256-GCM AEAD +
|
|
111
|
+
// local-KEK DEK-wrapping, injected into `@astram/core`'s `createEncryptionService({ crypto })`.
|
|
112
|
+
// Core stays zero-dep; the KMS-backed adapters (AWS/GCP/Vault) implement the same port.
|
|
113
|
+
var local_kek_crypto_js_1 = require("./encryption/local-kek-crypto.js");
|
|
114
|
+
Object.defineProperty(exports, "LocalKekCrypto", { enumerable: true, get: function () { return local_kek_crypto_js_1.LocalKekCrypto; } });
|
|
115
|
+
// The reference `SecretsProvider` adapter (ADR-0032 secrets management): an ENCRYPTED on-box store
|
|
116
|
+
// (secrets AES-GCM-encrypted at rest under the box KEK) so env holds `secret-ref:` pointers and the
|
|
117
|
+
// real values are resolved at boot. Vault / AWS SM / GCP SM implement the same port.
|
|
118
|
+
var encrypted_file_secrets_js_1 = require("./secrets/encrypted-file-secrets.js");
|
|
119
|
+
Object.defineProperty(exports, "EncryptedFileSecretsProvider", { enumerable: true, get: function () { return encrypted_file_secrets_js_1.EncryptedFileSecretsProvider; } });
|
|
103
120
|
// The Session storage/crypto adapters (ADR-0003 / ADR-0013): the concrete durable
|
|
104
121
|
// (MariaDB) + hot (Redis) stores, the node:crypto token generator, the keyed HMAC
|
|
105
122
|
// refresh hasher, and the system clock — all implementing `@astram/core`'s Session
|
|
@@ -119,6 +136,12 @@ Object.defineProperty(exports, "systemClockProvider", { enumerable: true, get: f
|
|
|
119
136
|
Object.defineProperty(exports, "SHIELD_TOKEN_GENERATOR", { enumerable: true, get: function () { return index_js_1.SHIELD_TOKEN_GENERATOR; } });
|
|
120
137
|
Object.defineProperty(exports, "SHIELD_REFRESH_HASHER", { enumerable: true, get: function () { return index_js_1.SHIELD_REFRESH_HASHER; } });
|
|
121
138
|
Object.defineProperty(exports, "SHIELD_CLOCK", { enumerable: true, get: function () { return index_js_1.SHIELD_CLOCK; } });
|
|
139
|
+
// Security hardening M-A: durable revoke → Redis unbind decorator.
|
|
140
|
+
Object.defineProperty(exports, "HotRevokingSessionRecordStore", { enumerable: true, get: function () { return index_js_1.HotRevokingSessionRecordStore; } });
|
|
141
|
+
// Security hardening #8: the resolved lifetimes token + the access-binding TTL rule.
|
|
142
|
+
Object.defineProperty(exports, "SHIELD_SESSION_LIFETIMES", { enumerable: true, get: function () { return index_js_1.SHIELD_SESSION_LIFETIMES; } });
|
|
143
|
+
Object.defineProperty(exports, "ROTATE_GRACE_MS", { enumerable: true, get: function () { return index_js_1.ROTATE_GRACE_MS; } });
|
|
144
|
+
Object.defineProperty(exports, "accessBindingTtlMs", { enumerable: true, get: function () { return index_js_1.accessBindingTtlMs; } });
|
|
122
145
|
// The record-permit ADMIN-rule adapter (ADR-0003 / design §5.1): the concrete
|
|
123
146
|
// `RecordPermissionRulePort` over the `record_permission_rule` table. Reads ADMIN
|
|
124
147
|
// rules only; the framework-owned OWNER baseline is core's job (not a row here). An
|
|
@@ -220,13 +243,31 @@ Object.defineProperty(exports, "SHIELD_OPERATION_AUTHORITY_PORT", { enumerable:
|
|
|
220
243
|
// enforcement-only path core-free.
|
|
221
244
|
var wire_record_authorization_js_1 = require("./authz/wire-record-authorization.js");
|
|
222
245
|
Object.defineProperty(exports, "buildRecordAuthorization", { enumerable: true, get: function () { return wire_record_authorization_js_1.buildRecordAuthorization; } });
|
|
246
|
+
var wire_record_authorization_js_2 = require("./authz/wire-record-authorization.js");
|
|
247
|
+
Object.defineProperty(exports, "withRedisPermissionVersion", { enumerable: true, get: function () { return wire_record_authorization_js_2.withRedisPermissionVersion; } });
|
|
248
|
+
// The Redis-held permission version (ADR-0035, GAPS #6): gate 5 reads `shield:permver:<tenant>`
|
|
249
|
+
// instead of MariaDB; `@astram/identity`'s bumper publishes to it after commit (injecting
|
|
250
|
+
// `SHIELD_PERMISSION_VERSION_CACHE`, provided by the auth surface under `auth: true`). Monotonic
|
|
251
|
+
// writes, TTL-bounded; a Redis error on the read fails closed.
|
|
252
|
+
var permission_version_cache_js_1 = require("./authz/permission-version-cache.js");
|
|
253
|
+
Object.defineProperty(exports, "RedisPermissionVersionCache", { enumerable: true, get: function () { return permission_version_cache_js_1.RedisPermissionVersionCache; } });
|
|
254
|
+
Object.defineProperty(exports, "PERMISSION_VERSION_KEY_PREFIX", { enumerable: true, get: function () { return permission_version_cache_js_1.PERMISSION_VERSION_KEY_PREFIX; } });
|
|
255
|
+
Object.defineProperty(exports, "DEFAULT_PERMISSION_VERSION_TTL_MS", { enumerable: true, get: function () { return permission_version_cache_js_1.DEFAULT_PERMISSION_VERSION_TTL_MS; } });
|
|
256
|
+
var tokens_js_2 = require("./auth/tokens.js");
|
|
257
|
+
Object.defineProperty(exports, "SHIELD_PERMISSION_VERSION_CACHE", { enumerable: true, get: function () { return tokens_js_2.SHIELD_PERMISSION_VERSION_CACHE; } });
|
|
258
|
+
// Durable session restrictions (Phase 3B review P1): the recovery-login re-enroll marker on the
|
|
259
|
+
// durable session + the account status the refresh-time rebuild checks.
|
|
260
|
+
var tokens_js_3 = require("./auth/tokens.js");
|
|
261
|
+
Object.defineProperty(exports, "SHIELD_SESSION_RESTRICTIONS", { enumerable: true, get: function () { return tokens_js_3.SHIELD_SESSION_RESTRICTIONS; } });
|
|
262
|
+
var session_restriction_store_js_1 = require("./session/session-restriction-store.js");
|
|
263
|
+
Object.defineProperty(exports, "MariaDbSessionRestrictionStore", { enumerable: true, get: function () { return session_restriction_store_js_1.MariaDbSessionRestrictionStore; } });
|
|
223
264
|
// The LIST-FORM sibling (Task 2.2): the engine-facing `ListScopeFn` the module wiring hands
|
|
224
265
|
// to the engine's `list()` (Task 3.1). `buildListScopeFn` is a SEPARATE factory (Option A)
|
|
225
266
|
// that takes the SAME `RecordAuthorizationInputs` and constructs its `MariaDbListScopeAdapter`
|
|
226
267
|
// over the SAME un-overridable `inputs.pool` — the adapter is NOT a field of the inputs, so a
|
|
227
268
|
// consumer cannot inject a fail-open scope port. Fail-closed: a transient throw PROPAGATES.
|
|
228
|
-
var
|
|
229
|
-
Object.defineProperty(exports, "buildListScopeFn", { enumerable: true, get: function () { return
|
|
269
|
+
var wire_record_authorization_js_3 = require("./authz/wire-record-authorization.js");
|
|
270
|
+
Object.defineProperty(exports, "buildListScopeFn", { enumerable: true, get: function () { return wire_record_authorization_js_3.buildListScopeFn; } });
|
|
230
271
|
// Boot infrastructure (ADR-0018 connection-pool budget assertion). `BootModule`
|
|
231
272
|
// itself is NOT exported — it is composed internally by `ShieldModule.forRoot()`.
|
|
232
273
|
var boot_sequence_js_1 = require("./boot/boot-sequence.js");
|
|
@@ -254,6 +295,11 @@ Object.defineProperty(exports, "loadRefreshHmacKey", { enumerable: true, get: fu
|
|
|
254
295
|
Object.defineProperty(exports, "assertRefreshHmacKey", { enumerable: true, get: function () { return app_config_js_1.assertRefreshHmacKey; } });
|
|
255
296
|
Object.defineProperty(exports, "DEFAULT_DB_CONFIG", { enumerable: true, get: function () { return app_config_js_1.DEFAULT_DB_CONFIG; } });
|
|
256
297
|
Object.defineProperty(exports, "DEFAULT_REDIS_URL", { enumerable: true, get: function () { return app_config_js_1.DEFAULT_REDIS_URL; } });
|
|
298
|
+
// Security hardening #5/#6 (additive): the per-IP login failure limit (D3) and the
|
|
299
|
+
// raw-NODE_ENV dev/test predicate that gates the dev email logger.
|
|
300
|
+
Object.defineProperty(exports, "loadLoginIpLimit", { enumerable: true, get: function () { return app_config_js_1.loadLoginIpLimit; } });
|
|
301
|
+
Object.defineProperty(exports, "DEFAULT_LOGIN_IP_LIMIT", { enumerable: true, get: function () { return app_config_js_1.DEFAULT_LOGIN_IP_LIMIT; } });
|
|
302
|
+
Object.defineProperty(exports, "isDevOrTestNodeEnv", { enumerable: true, get: function () { return app_config_js_1.isDevOrTestNodeEnv; } });
|
|
257
303
|
// ---------------------------------------------------------------------------
|
|
258
304
|
// Phase 0b Auth surface (framework-owned login → session, spec §2/§3/§4).
|
|
259
305
|
//
|
|
@@ -265,28 +311,28 @@ Object.defineProperty(exports, "DEFAULT_REDIS_URL", { enumerable: true, get: fun
|
|
|
265
311
|
// ---------------------------------------------------------------------------
|
|
266
312
|
// Shared DI provider tokens (the seams the teams bind/consume — see tokens.ts for
|
|
267
313
|
// who provides/consumes each).
|
|
268
|
-
var
|
|
269
|
-
Object.defineProperty(exports, "SHIELD_DB_POOL", { enumerable: true, get: function () { return
|
|
270
|
-
Object.defineProperty(exports, "SHIELD_REDIS", { enumerable: true, get: function () { return
|
|
271
|
-
Object.defineProperty(exports, "SHIELD_CREDENTIAL_RESOLVER", { enumerable: true, get: function () { return
|
|
272
|
-
Object.defineProperty(exports, "SHIELD_PROFILE_RESOLVER", { enumerable: true, get: function () { return
|
|
273
|
-
Object.defineProperty(exports, "SHIELD_AUTHENTICATOR", { enumerable: true, get: function () { return
|
|
274
|
-
Object.defineProperty(exports, "SHIELD_SESSION_AUTHORITY", { enumerable: true, get: function () { return
|
|
314
|
+
var tokens_js_4 = require("./auth/tokens.js");
|
|
315
|
+
Object.defineProperty(exports, "SHIELD_DB_POOL", { enumerable: true, get: function () { return tokens_js_4.SHIELD_DB_POOL; } });
|
|
316
|
+
Object.defineProperty(exports, "SHIELD_REDIS", { enumerable: true, get: function () { return tokens_js_4.SHIELD_REDIS; } });
|
|
317
|
+
Object.defineProperty(exports, "SHIELD_CREDENTIAL_RESOLVER", { enumerable: true, get: function () { return tokens_js_4.SHIELD_CREDENTIAL_RESOLVER; } });
|
|
318
|
+
Object.defineProperty(exports, "SHIELD_PROFILE_RESOLVER", { enumerable: true, get: function () { return tokens_js_4.SHIELD_PROFILE_RESOLVER; } });
|
|
319
|
+
Object.defineProperty(exports, "SHIELD_AUTHENTICATOR", { enumerable: true, get: function () { return tokens_js_4.SHIELD_AUTHENTICATOR; } });
|
|
320
|
+
Object.defineProperty(exports, "SHIELD_SESSION_AUTHORITY", { enumerable: true, get: function () { return tokens_js_4.SHIELD_SESSION_AUTHORITY; } });
|
|
275
321
|
// Account & credential-surface seams (forgot/reset, change-password, MFA
|
|
276
322
|
// enrollment, profile edit) — all OPTIONAL, consumer-plugged through
|
|
277
323
|
// ShieldModule.forRoot. See tokens.ts for who provides/consumes each.
|
|
278
|
-
Object.defineProperty(exports, "SHIELD_CREDENTIAL_WRITER", { enumerable: true, get: function () { return
|
|
279
|
-
Object.defineProperty(exports, "SHIELD_RESET_TOKEN_STORE", { enumerable: true, get: function () { return
|
|
280
|
-
Object.defineProperty(exports, "SHIELD_EMAIL_SENDER", { enumerable: true, get: function () { return
|
|
281
|
-
Object.defineProperty(exports, "SHIELD_RECOVERY_CODE_STORE", { enumerable: true, get: function () { return
|
|
282
|
-
Object.defineProperty(exports, "SHIELD_PROFILE_WRITER", { enumerable: true, get: function () { return
|
|
283
|
-
Object.defineProperty(exports, "SHIELD_SESSION_SWEEPER", { enumerable: true, get: function () { return
|
|
324
|
+
Object.defineProperty(exports, "SHIELD_CREDENTIAL_WRITER", { enumerable: true, get: function () { return tokens_js_4.SHIELD_CREDENTIAL_WRITER; } });
|
|
325
|
+
Object.defineProperty(exports, "SHIELD_RESET_TOKEN_STORE", { enumerable: true, get: function () { return tokens_js_4.SHIELD_RESET_TOKEN_STORE; } });
|
|
326
|
+
Object.defineProperty(exports, "SHIELD_EMAIL_SENDER", { enumerable: true, get: function () { return tokens_js_4.SHIELD_EMAIL_SENDER; } });
|
|
327
|
+
Object.defineProperty(exports, "SHIELD_RECOVERY_CODE_STORE", { enumerable: true, get: function () { return tokens_js_4.SHIELD_RECOVERY_CODE_STORE; } });
|
|
328
|
+
Object.defineProperty(exports, "SHIELD_PROFILE_WRITER", { enumerable: true, get: function () { return tokens_js_4.SHIELD_PROFILE_WRITER; } });
|
|
329
|
+
Object.defineProperty(exports, "SHIELD_SESSION_SWEEPER", { enumerable: true, get: function () { return tokens_js_4.SHIELD_SESSION_SWEEPER; } });
|
|
284
330
|
// The auth-surface audit sink seam (the first auth audit event — recovery login).
|
|
285
|
-
Object.defineProperty(exports, "SHIELD_AUDIT_SINK", { enumerable: true, get: function () { return
|
|
331
|
+
Object.defineProperty(exports, "SHIELD_AUDIT_SINK", { enumerable: true, get: function () { return tokens_js_4.SHIELD_AUDIT_SINK; } });
|
|
286
332
|
// The multi-device MFA store seam (multiple independent authenticator devices).
|
|
287
|
-
Object.defineProperty(exports, "SHIELD_MFA_DEVICE_STORE", { enumerable: true, get: function () { return
|
|
333
|
+
Object.defineProperty(exports, "SHIELD_MFA_DEVICE_STORE", { enumerable: true, get: function () { return tokens_js_4.SHIELD_MFA_DEVICE_STORE; } });
|
|
288
334
|
// The login totp-verifier OVERRIDE seam (Phase 2 — plug an OR-matching verifier).
|
|
289
|
-
Object.defineProperty(exports, "SHIELD_TOTP_VERIFIER_OVERRIDE", { enumerable: true, get: function () { return
|
|
335
|
+
Object.defineProperty(exports, "SHIELD_TOTP_VERIFIER_OVERRIDE", { enumerable: true, get: function () { return tokens_js_4.SHIELD_TOTP_VERIFIER_OVERRIDE; } });
|
|
290
336
|
// The credential-store contract (skeleton — Team A implements the SELECT).
|
|
291
337
|
var mariadb_credential_resolver_js_1 = require("./authentication/mariadb-credential-resolver.js");
|
|
292
338
|
Object.defineProperty(exports, "MariaDbCredentialResolver", { enumerable: true, get: function () { return mariadb_credential_resolver_js_1.MariaDbCredentialResolver; } });
|
|
@@ -308,10 +354,10 @@ var auth_module_js_2 = require("./auth/auth.module.js");
|
|
|
308
354
|
Object.defineProperty(exports, "makeDefaultTotpVerifier", { enumerable: true, get: function () { return auth_module_js_2.makeDefaultTotpVerifier; } });
|
|
309
355
|
Object.defineProperty(exports, "resolveTotpVerifier", { enumerable: true, get: function () { return auth_module_js_2.resolveTotpVerifier; } });
|
|
310
356
|
Object.defineProperty(exports, "hmacSha1", { enumerable: true, get: function () { return auth_module_js_2.hmacSha1; } });
|
|
311
|
-
var
|
|
312
|
-
Object.defineProperty(exports, "SHIELD_SESSION_FACTS_PROJECTOR", { enumerable: true, get: function () { return
|
|
313
|
-
var
|
|
314
|
-
Object.defineProperty(exports, "SHIELD_SCOPE_SUBTREE_RESOLVER", { enumerable: true, get: function () { return
|
|
357
|
+
var tokens_js_5 = require("./auth/tokens.js");
|
|
358
|
+
Object.defineProperty(exports, "SHIELD_SESSION_FACTS_PROJECTOR", { enumerable: true, get: function () { return tokens_js_5.SHIELD_SESSION_FACTS_PROJECTOR; } });
|
|
359
|
+
var tokens_js_6 = require("./auth/tokens.js");
|
|
360
|
+
Object.defineProperty(exports, "SHIELD_SCOPE_SUBTREE_RESOLVER", { enumerable: true, get: function () { return tokens_js_6.SHIELD_SCOPE_SUBTREE_RESOLVER; } });
|
|
315
361
|
// The framework-owned `/auth/*` HTTP controller (Team C) + its pending-MFA store.
|
|
316
362
|
// The controller CONSUMES SHIELD_AUTHENTICATOR / SHIELD_SESSION_AUTHORITY and the
|
|
317
363
|
// PendingMfaStore. It is EXPORTED so AuthModule (Team B) / the integration owner
|
|
@@ -321,6 +367,17 @@ var auth_controller_js_1 = require("./auth/auth.controller.js");
|
|
|
321
367
|
Object.defineProperty(exports, "AuthController", { enumerable: true, get: function () { return auth_controller_js_1.AuthController; } });
|
|
322
368
|
var pending_mfa_store_js_1 = require("./auth/pending-mfa-store.js");
|
|
323
369
|
Object.defineProperty(exports, "PendingMfaStore", { enumerable: true, get: function () { return pending_mfa_store_js_1.PendingMfaStore; } });
|
|
370
|
+
Object.defineProperty(exports, "RedisPendingMfaStore", { enumerable: true, get: function () { return pending_mfa_store_js_1.RedisPendingMfaStore; } });
|
|
371
|
+
// The MFA step-up (security hardening M6): `/auth/mfa` verifies only the second factor for
|
|
372
|
+
// the principal the password step recorded (no password held between the two requests).
|
|
373
|
+
var mfa_step_up_js_1 = require("./auth/mfa-step-up.js");
|
|
374
|
+
Object.defineProperty(exports, "CredentialMfaStepUp", { enumerable: true, get: function () { return mfa_step_up_js_1.CredentialMfaStepUp; } });
|
|
375
|
+
Object.defineProperty(exports, "credentialFingerprint", { enumerable: true, get: function () { return mfa_step_up_js_1.credentialFingerprint; } });
|
|
376
|
+
Object.defineProperty(exports, "challengeMatches", { enumerable: true, get: function () { return mfa_step_up_js_1.challengeMatches; } });
|
|
377
|
+
var tokens_js_7 = require("./auth/tokens.js");
|
|
378
|
+
Object.defineProperty(exports, "SHIELD_MFA_LIMITER", { enumerable: true, get: function () { return tokens_js_7.SHIELD_MFA_LIMITER; } });
|
|
379
|
+
Object.defineProperty(exports, "SHIELD_MFA_STEP_UP", { enumerable: true, get: function () { return tokens_js_7.SHIELD_MFA_STEP_UP; } });
|
|
380
|
+
Object.defineProperty(exports, "SHIELD_LOGIN_TOTP_VERIFIER", { enumerable: true, get: function () { return tokens_js_7.SHIELD_LOGIN_TOTP_VERIFIER; } });
|
|
324
381
|
// The pure TOTP-enrollment helpers (Phase 4 MFA). Re-exported for consumers/tests
|
|
325
382
|
// that need them; the multi-device MFA routes (Phase 3) reuse them to mint a device
|
|
326
383
|
// secret + provisioning URI + recovery codes. (The old in-memory
|