@astram/guard 0.21.0 → 0.22.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/audit/audit-chain-sealer.d.ts +1 -1
- package/dist/audit/audit-chain-sealer.d.ts.map +1 -1
- package/dist/audit/audit-sealer.service.d.ts +9 -2
- package/dist/audit/audit-sealer.service.d.ts.map +1 -1
- package/dist/audit/audit-sealer.service.js +20 -3
- package/dist/auth/connections.d.ts +66 -8
- package/dist/auth/connections.d.ts.map +1 -1
- package/dist/auth/connections.js +100 -18
- package/dist/auth/persistence.module.d.ts +11 -6
- package/dist/auth/persistence.module.d.ts.map +1 -1
- package/dist/auth/persistence.module.js +34 -11
- package/dist/auth/tokens.d.ts +6 -0
- package/dist/auth/tokens.d.ts.map +1 -1
- package/dist/auth/tokens.js +8 -2
- package/dist/authentication/mariadb-email-address-changer.d.ts +2 -1
- package/dist/authentication/mariadb-email-address-changer.d.ts.map +1 -1
- package/dist/authentication/mariadb-email-address-changer.js +3 -3
- package/dist/boot/boot-sequence.d.ts +7 -2
- package/dist/boot/boot-sequence.d.ts.map +1 -1
- package/dist/boot/boot-sequence.js +21 -4
- package/dist/config/app-config.d.ts +45 -3
- package/dist/config/app-config.d.ts.map +1 -1
- package/dist/config/app-config.js +52 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/internal.d.ts +6 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +22 -15
- package/package.json +5 -5
|
@@ -16,7 +16,7 @@ export declare const AUDIT_SEAL_STUCK = 200;
|
|
|
16
16
|
/** The logger surface the sealer uses (Nest `Logger` shape). */
|
|
17
17
|
export type AuditSealerLogger = Pick<LoggerService, 'log' | 'warn' | 'error'>;
|
|
18
18
|
export interface AuditChainSealerOptions {
|
|
19
|
-
/** `
|
|
19
|
+
/** `SHIELD_AUDIT_SEALER_POOL` (G-026). Only `getConnection()` is used: every statement runs on the lock's session. */
|
|
20
20
|
readonly pool: Pool;
|
|
21
21
|
/** Resolved framework database names (`FRAMEWORK_SCHEMAS`). */
|
|
22
22
|
readonly schemas: FrameworkSchemas;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-chain-sealer.d.ts","sourceRoot":"","sources":["../../src/audit/audit-chain-sealer.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,SAAS,CAAC;AACpD,OAAO,EASL,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAEtB,oDAAoD;AACpD,eAAO,MAAM,sBAAsB,QAAc,CAAC;AAClD,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,QAAc,CAAC;AAC/C,iDAAiD;AACjD,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,wCAAwC;AACxC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAOpC,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAE9E,MAAM,WAAW,uBAAuB;IACtC,
|
|
1
|
+
{"version":3,"file":"audit-chain-sealer.d.ts","sourceRoot":"","sources":["../../src/audit/audit-chain-sealer.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,SAAS,CAAC;AACpD,OAAO,EASL,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAEtB,oDAAoD;AACp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CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC,8FAA8F;IAC9F,OAAO,CAAC,aAAa,CAAqB;IAC1C,2DAA2D;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,yDAAyD;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,oDAAoD;IACpD,OAAO,CAAC,cAAc,CAAS;IAC/B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAA6B;gBAE/B,OAAO,EAAE,uBAAuB;IAa5C;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgD3B,OAAO,CAAC,gBAAgB;YAQV,QAAQ;IAwCtB,4FAA4F;IAC5F,OAAO,CAAC,gBAAgB;IAWxB,2FAA2F;YAC7E,eAAe;IAa7B;;;;;OAKG;YACW,cAAc;IA0H5B,wFAAwF;YAC1E,SAAS;IAyDvB,2FAA2F;YAC7E,UAAU;IAmExB,2FAA2F;IAC3F,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,OAAO;CAMhB"}
|
|
@@ -13,8 +13,12 @@
|
|
|
13
13
|
* probe repeats every sweep period (1 h) and starts or stops the ticks. Never throws.
|
|
14
14
|
* - Ticks never overlap: the next one is scheduled only after the previous settled. A
|
|
15
15
|
* rejected tick is logged by error class only and the loop continues.
|
|
16
|
-
* -
|
|
17
|
-
* `
|
|
16
|
+
* - Pool (G-026 spec 5.D, 5.E): the service owns its pool, the one-connection
|
|
17
|
+
* `SHIELD_AUDIT_SEALER_POOL` (never `SHIELD_DB_POOL`), and ends it in `stop()`.
|
|
18
|
+
* - Shutdown (`onModuleDestroy`, Nest `close()` step 1, while the HTTP server still serves, and
|
|
19
|
+
* `onApplicationShutdown`): stops the timers, waits for the in-flight probe and tick, then ends
|
|
20
|
+
* its own pool exactly once (best-effort, never throws). Idempotent: both hooks share one stop.
|
|
21
|
+
* `SHIELD_DB_POOL` is closed later by `ConnectionLifecycle` (`onApplicationShutdown`).
|
|
18
22
|
* - Every timer is `unref()`'d: the sealer never keeps a process alive. Nothing here touches
|
|
19
23
|
* the request path (Shield #12).
|
|
20
24
|
*/
|
|
@@ -46,11 +50,14 @@ export declare class AuditSealerService implements OnApplicationBootstrap, OnMod
|
|
|
46
50
|
private probeTimer;
|
|
47
51
|
private inFlightTick;
|
|
48
52
|
private inFlightProbe;
|
|
53
|
+
private stopping;
|
|
49
54
|
constructor(pool: Pool, schemas: FrameworkSchemas, options?: AuditSealerServiceOptions);
|
|
50
55
|
onApplicationBootstrap(): Promise<void>;
|
|
51
56
|
onModuleDestroy(): Promise<void>;
|
|
52
57
|
onApplicationShutdown(): Promise<void>;
|
|
58
|
+
/** One stop for both hooks: the pool is ended once, after the last probe and tick settled. */
|
|
53
59
|
private stop;
|
|
60
|
+
private drainAndEnd;
|
|
54
61
|
/** Probe once (never overlapping, never throwing) and start or stop the ticks. */
|
|
55
62
|
private runProbe;
|
|
56
63
|
private probe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-sealer.service.d.ts","sourceRoot":"","sources":["../../src/audit/audit-sealer.service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"audit-sealer.service.d.ts","sourceRoot":"","sources":["../../src/audit/audit-sealer.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EA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4FAA4F;IAC5F,OAAO,CAAC,MAAM;IAsBd,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,OAAO;CAehB"}
|
|
@@ -25,8 +25,12 @@ exports.AuditSealerService = void 0;
|
|
|
25
25
|
* probe repeats every sweep period (1 h) and starts or stops the ticks. Never throws.
|
|
26
26
|
* - Ticks never overlap: the next one is scheduled only after the previous settled. A
|
|
27
27
|
* rejected tick is logged by error class only and the loop continues.
|
|
28
|
-
* -
|
|
29
|
-
* `
|
|
28
|
+
* - Pool (G-026 spec 5.D, 5.E): the service owns its pool, the one-connection
|
|
29
|
+
* `SHIELD_AUDIT_SEALER_POOL` (never `SHIELD_DB_POOL`), and ends it in `stop()`.
|
|
30
|
+
* - Shutdown (`onModuleDestroy`, Nest `close()` step 1, while the HTTP server still serves, and
|
|
31
|
+
* `onApplicationShutdown`): stops the timers, waits for the in-flight probe and tick, then ends
|
|
32
|
+
* its own pool exactly once (best-effort, never throws). Idempotent: both hooks share one stop.
|
|
33
|
+
* `SHIELD_DB_POOL` is closed later by `ConnectionLifecycle` (`onApplicationShutdown`).
|
|
30
34
|
* - Every timer is `unref()`'d: the sealer never keeps a process alive. Nothing here touches
|
|
31
35
|
* the request path (Shield #12).
|
|
32
36
|
*/
|
|
@@ -49,6 +53,7 @@ let AuditSealerService = class AuditSealerService {
|
|
|
49
53
|
probeTimer;
|
|
50
54
|
inFlightTick;
|
|
51
55
|
inFlightProbe;
|
|
56
|
+
stopping;
|
|
52
57
|
constructor(pool, schemas, options = {}) {
|
|
53
58
|
this.pool = pool;
|
|
54
59
|
this.schemas = schemas;
|
|
@@ -79,7 +84,12 @@ let AuditSealerService = class AuditSealerService {
|
|
|
79
84
|
async onApplicationShutdown() {
|
|
80
85
|
await this.stop();
|
|
81
86
|
}
|
|
82
|
-
|
|
87
|
+
/** One stop for both hooks: the pool is ended once, after the last probe and tick settled. */
|
|
88
|
+
stop() {
|
|
89
|
+
this.stopping ??= this.drainAndEnd();
|
|
90
|
+
return this.stopping;
|
|
91
|
+
}
|
|
92
|
+
async drainAndEnd() {
|
|
83
93
|
this.stopped = true;
|
|
84
94
|
this.active = false;
|
|
85
95
|
if (this.tickTimer !== undefined)
|
|
@@ -88,8 +98,15 @@ let AuditSealerService = class AuditSealerService {
|
|
|
88
98
|
clearInterval(this.probeTimer);
|
|
89
99
|
this.tickTimer = undefined;
|
|
90
100
|
this.probeTimer = undefined;
|
|
101
|
+
// Neither rejects (both catch internally); no new probe or tick starts once `stopped` is set.
|
|
91
102
|
await this.inFlightProbe;
|
|
92
103
|
await this.inFlightTick;
|
|
104
|
+
try {
|
|
105
|
+
await this.pool.end();
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// best-effort — a pool already ending (or a stub without end()) never fails shutdown.
|
|
109
|
+
}
|
|
93
110
|
}
|
|
94
111
|
/** Probe once (never overlapping, never throwing) and start or stop the ticks. */
|
|
95
112
|
runProbe() {
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
* credentials, hot state) flows through the two connections created here.
|
|
6
6
|
*
|
|
7
7
|
* WHY a separate helper (not inline in the provider factory): a Nest `useFactory`
|
|
8
|
-
* value provider is NOT itself lifecycle-aware —
|
|
8
|
+
* value provider is NOT itself lifecycle-aware — lifecycle hooks only fire on
|
|
9
9
|
* PROVIDER CLASSES with that method. So the pool/redis are created by the pure
|
|
10
10
|
* factories below, and a tiny {@link ConnectionLifecycle} provider (a class Nest
|
|
11
|
-
* WILL call `
|
|
11
|
+
* WILL call `onApplicationShutdown` on) holds their handles and closes them on
|
|
12
|
+
* shutdown, after the HTTP server has closed (G-026 spec 5.O). The audit sealer's
|
|
13
|
+
* own pool ({@link createAuditSealerPool}) is ended by the sealer itself.
|
|
12
14
|
* This keeps `SHIELD_DB_POOL` / `SHIELD_REDIS` as the raw driver objects the
|
|
13
15
|
* adapters expect (`new MariaDbSessionRecordStore(pool)` etc.) while still getting
|
|
14
16
|
* graceful teardown.
|
|
@@ -21,11 +23,46 @@
|
|
|
21
23
|
* ADR-0018: the pool cap is taken from the connection-pool budget
|
|
22
24
|
* (`config.pool.perAccountMax.shield_core`), NOT a duplicate knob.
|
|
23
25
|
*/
|
|
24
|
-
import { type
|
|
25
|
-
import { type Pool } from 'mariadb';
|
|
26
|
+
import { type OnApplicationShutdown } from '@nestjs/common';
|
|
27
|
+
import { type Pool, type PoolConfig } from 'mariadb';
|
|
26
28
|
import Redis from 'ioredis';
|
|
27
|
-
import { type AppConfig, type DbTlsConfig } from '../config/app-config.js';
|
|
29
|
+
import { type AppConfig, type DbTlsConfig, type PoolTuning } from '../config/app-config.js';
|
|
28
30
|
import { isLoopbackHost } from '../config/loopback-host.js';
|
|
31
|
+
/** The `mariadb` driver pool options {@link mariadbPoolTuningOptions} returns (G-026 spec 5.B). */
|
|
32
|
+
export interface MariadbPoolTuningOptions {
|
|
33
|
+
/** Idle connections kept (capped at the pool's `connectionLimit` when one is given). */
|
|
34
|
+
readonly minimumIdle: number;
|
|
35
|
+
/** Seconds (the driver's unit). */
|
|
36
|
+
readonly idleTimeout: number;
|
|
37
|
+
/** Ms; session `max_statement_time`, set once per connection. Omitted when off. */
|
|
38
|
+
readonly queryTimeout?: number;
|
|
39
|
+
/** Ms; the driver logs a connection held longer. Omitted when off. */
|
|
40
|
+
readonly leakDetectionTimeout?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface MariadbPoolTuningOptionsOpts {
|
|
43
|
+
/** The pool's cap: `minimumIdle` is capped at it (the driver applies the same `Math.min`). */
|
|
44
|
+
readonly connectionLimit?: number;
|
|
45
|
+
/** Default true. `false` omits `queryTimeout` (the audit sealer pool, spec 5.D). */
|
|
46
|
+
readonly queryTimeout?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Map {@link PoolTuning} to `mariadb` pool options (G-026 spec 5.B). Every framework pool spreads
|
|
50
|
+
* it (guard core, the audit sealer, identity's engine and authz pools), the same way they spread
|
|
51
|
+
* {@link mariadbSslOption}. Options that are off are omitted, so the driver default stays.
|
|
52
|
+
*
|
|
53
|
+
* Never sets `resetAfterUse`: a reset on release would drop the session `max_statement_time`
|
|
54
|
+
* the query timeout relies on (the driver default is off, and the framework sets it nowhere).
|
|
55
|
+
*/
|
|
56
|
+
export declare function mariadbPoolTuningOptions(tuning: PoolTuning, opts?: MariadbPoolTuningOptionsOpts): MariadbPoolTuningOptions;
|
|
57
|
+
/**
|
|
58
|
+
* Run one fixed framework statement with no statement time limit (G-026 spec 5.L): returns
|
|
59
|
+
* `SET STATEMENT max_statement_time=0 FOR <sql>`, so `APP_DB_QUERY_TIMEOUT_MS` never cuts a
|
|
60
|
+
* framework `GET_LOCK` wait (each keeps its own lock timeout).
|
|
61
|
+
*
|
|
62
|
+
* ⛔ For fixed framework SQL literals only, never for SQL built from input. Values still travel
|
|
63
|
+
* as `?` parameters of the wrapped statement.
|
|
64
|
+
*/
|
|
65
|
+
export declare function withoutStatementTimeout(sql: string): string;
|
|
29
66
|
/**
|
|
30
67
|
* Create the ONE live `mariadb` {@link Pool} for the `shield_core` account from
|
|
31
68
|
* {@link AppConfig}. The `connectionLimit` comes from the ADR-0018 budget
|
|
@@ -36,8 +73,24 @@ import { isLoopbackHost } from '../config/loopback-host.js';
|
|
|
36
73
|
* a wrong/blank password fails LOUD at connect time, which is the correct place
|
|
37
74
|
* for a runtime credential error. The host/port/user/database always have
|
|
38
75
|
* documented defaults, so the descriptor is always well-formed.
|
|
76
|
+
*
|
|
77
|
+
* G-026 (spec 5.C): idle and timeout settings from `config.poolTuning`
|
|
78
|
+
* ({@link mariadbPoolTuningOptions}).
|
|
39
79
|
*/
|
|
40
80
|
export declare function createDbPool(config: AppConfig): Pool;
|
|
81
|
+
/** The options {@link createDbPool} passes to `mariadb.createPool` (exported for tests). */
|
|
82
|
+
export declare function dbPoolOptions(config: AppConfig): PoolConfig;
|
|
83
|
+
/**
|
|
84
|
+
* The audit sealer's own pool (G-026 spec 5.D): same account, database, TLS and idle settings as
|
|
85
|
+
* {@link createDbPool}, capped at one connection (the sealer holds one per tick). A sealer that
|
|
86
|
+
* borrowed from the core pool every interval would keep the core pool's FIFO idle queue from ever
|
|
87
|
+
* reaching the idle timeout. No `queryTimeout`: `APP_DB_QUERY_TIMEOUT_MS` never cuts a sealer
|
|
88
|
+
* statement (Shield #6). Leak detection applies (it only logs). Internal: provided under
|
|
89
|
+
* `SHIELD_AUDIT_SEALER_POOL` and ended by `AuditSealerService.stop()`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function createAuditSealerPool(config: AppConfig): Pool;
|
|
92
|
+
/** The options {@link createAuditSealerPool} passes to `mariadb.createPool` (exported for tests). */
|
|
93
|
+
export declare function auditSealerPoolOptions(config: AppConfig): PoolConfig;
|
|
41
94
|
export { isLoopbackHost };
|
|
42
95
|
/**
|
|
43
96
|
* The boot warning for a production pool to a remote MariaDB without TLS (Phase 16), or
|
|
@@ -66,14 +119,19 @@ export declare function createRedisClient(config: AppConfig): Redis;
|
|
|
66
119
|
/**
|
|
67
120
|
* Lifecycle-aware holder that owns the pool + redis handles and closes them on
|
|
68
121
|
* app shutdown. Provided ALONGSIDE the two raw-connection providers so Nest calls
|
|
69
|
-
* `
|
|
122
|
+
* `onApplicationShutdown` here (value providers get no lifecycle callback). The teardown
|
|
70
123
|
* is best-effort + idempotent: a close error is swallowed so shutdown never hangs
|
|
71
124
|
* or throws, and both connections are always attempted.
|
|
125
|
+
*
|
|
126
|
+
* G-026 spec 5.O: the close runs in `onApplicationShutdown` (Nest `close()` step 4), after every
|
|
127
|
+
* `onModuleDestroy` and after the HTTP server closed and its in-flight requests finished, so a
|
|
128
|
+
* request still being served while the jobs drain (step 1) never meets a closed pool or Redis.
|
|
129
|
+
* Nothing happens in `onModuleDestroy`.
|
|
72
130
|
*/
|
|
73
|
-
export declare class ConnectionLifecycle implements
|
|
131
|
+
export declare class ConnectionLifecycle implements OnApplicationShutdown {
|
|
74
132
|
private readonly pool;
|
|
75
133
|
private readonly redis;
|
|
76
134
|
constructor(pool: Pool, redis: Redis);
|
|
77
|
-
|
|
135
|
+
onApplicationShutdown(): Promise<void>;
|
|
78
136
|
}
|
|
79
137
|
//# sourceMappingURL=connections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/auth/connections.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/auth/connections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAgB,EAAE,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,mGAAmG;AACnG,MAAM,WAAW,wBAAwB;IACvC,wFAAwF;IACxF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mCAAmC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mFAAmF;IACnF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AAED,MAAM,WAAW,4BAA4B;IAC3C,8FAA8F;IAC9F,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,oFAAoF;IACpF,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,EAClB,IAAI,GAAE,4BAAiC,GACtC,wBAAwB,CAgB1B;AAED;;;;;;;GA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WHY a separate helper (not inline in the provider factory): a Nest `useFactory`
|
|
9
|
-
* value provider is NOT itself lifecycle-aware —
|
|
9
|
+
* value provider is NOT itself lifecycle-aware — lifecycle hooks only fire on
|
|
10
10
|
* PROVIDER CLASSES with that method. So the pool/redis are created by the pure
|
|
11
11
|
* factories below, and a tiny {@link ConnectionLifecycle} provider (a class Nest
|
|
12
|
-
* WILL call `
|
|
12
|
+
* WILL call `onApplicationShutdown` on) holds their handles and closes them on
|
|
13
|
+
* shutdown, after the HTTP server has closed (G-026 spec 5.O). The audit sealer's
|
|
14
|
+
* own pool ({@link createAuditSealerPool}) is ended by the sealer itself.
|
|
13
15
|
* This keeps `SHIELD_DB_POOL` / `SHIELD_REDIS` as the raw driver objects the
|
|
14
16
|
* adapters expect (`new MariaDbSessionRecordStore(pool)` etc.) while still getting
|
|
15
17
|
* graceful teardown.
|
|
@@ -36,7 +38,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
38
|
};
|
|
37
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
40
|
exports.ConnectionLifecycle = exports.isLoopbackHost = void 0;
|
|
41
|
+
exports.mariadbPoolTuningOptions = mariadbPoolTuningOptions;
|
|
42
|
+
exports.withoutStatementTimeout = withoutStatementTimeout;
|
|
39
43
|
exports.createDbPool = createDbPool;
|
|
44
|
+
exports.dbPoolOptions = dbPoolOptions;
|
|
45
|
+
exports.createAuditSealerPool = createAuditSealerPool;
|
|
46
|
+
exports.auditSealerPoolOptions = auditSealerPoolOptions;
|
|
40
47
|
exports.dbTlsBootWarning = dbTlsBootWarning;
|
|
41
48
|
exports.mariadbSslOption = mariadbSslOption;
|
|
42
49
|
exports.createRedisClient = createRedisClient;
|
|
@@ -47,6 +54,57 @@ const ioredis_1 = __importDefault(require("ioredis"));
|
|
|
47
54
|
const app_config_js_1 = require("../config/app-config.js");
|
|
48
55
|
const loopback_host_js_1 = require("../config/loopback-host.js");
|
|
49
56
|
Object.defineProperty(exports, "isLoopbackHost", { enumerable: true, get: function () { return loopback_host_js_1.isLoopbackHost; } });
|
|
57
|
+
/**
|
|
58
|
+
* Map {@link PoolTuning} to `mariadb` pool options (G-026 spec 5.B). Every framework pool spreads
|
|
59
|
+
* it (guard core, the audit sealer, identity's engine and authz pools), the same way they spread
|
|
60
|
+
* {@link mariadbSslOption}. Options that are off are omitted, so the driver default stays.
|
|
61
|
+
*
|
|
62
|
+
* Never sets `resetAfterUse`: a reset on release would drop the session `max_statement_time`
|
|
63
|
+
* the query timeout relies on (the driver default is off, and the framework sets it nowhere).
|
|
64
|
+
*/
|
|
65
|
+
function mariadbPoolTuningOptions(tuning, opts = {}) {
|
|
66
|
+
const minimumIdle = opts.connectionLimit === undefined
|
|
67
|
+
? tuning.minimumIdle
|
|
68
|
+
: Math.min(tuning.minimumIdle, opts.connectionLimit);
|
|
69
|
+
const withQueryTimeout = opts.queryTimeout !== false;
|
|
70
|
+
return {
|
|
71
|
+
minimumIdle,
|
|
72
|
+
idleTimeout: tuning.idleTimeoutS,
|
|
73
|
+
...(withQueryTimeout && tuning.queryTimeoutMs !== undefined
|
|
74
|
+
? { queryTimeout: tuning.queryTimeoutMs }
|
|
75
|
+
: {}),
|
|
76
|
+
...(tuning.leakDetectionMs !== undefined
|
|
77
|
+
? { leakDetectionTimeout: tuning.leakDetectionMs }
|
|
78
|
+
: {}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Run one fixed framework statement with no statement time limit (G-026 spec 5.L): returns
|
|
83
|
+
* `SET STATEMENT max_statement_time=0 FOR <sql>`, so `APP_DB_QUERY_TIMEOUT_MS` never cuts a
|
|
84
|
+
* framework `GET_LOCK` wait (each keeps its own lock timeout).
|
|
85
|
+
*
|
|
86
|
+
* ⛔ For fixed framework SQL literals only, never for SQL built from input. Values still travel
|
|
87
|
+
* as `?` parameters of the wrapped statement.
|
|
88
|
+
*/
|
|
89
|
+
function withoutStatementTimeout(sql) {
|
|
90
|
+
return `SET STATEMENT max_statement_time=0 FOR ${sql}`;
|
|
91
|
+
}
|
|
92
|
+
/** The account, database, connect and TLS options every guard pool shares. */
|
|
93
|
+
function basePoolOptions(config) {
|
|
94
|
+
const { db } = config;
|
|
95
|
+
return {
|
|
96
|
+
host: db.host,
|
|
97
|
+
port: db.port,
|
|
98
|
+
user: db.user,
|
|
99
|
+
password: db.password,
|
|
100
|
+
database: db.database,
|
|
101
|
+
// Fail fast on an unreachable DB rather than hanging the boot indefinitely.
|
|
102
|
+
connectTimeout: 10_000,
|
|
103
|
+
// All platform timestamps are UTC (parity with the session adapters).
|
|
104
|
+
timezone: 'Z',
|
|
105
|
+
...withSsl(mariadbSslOption(db.tls)),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
50
108
|
/**
|
|
51
109
|
* Create the ONE live `mariadb` {@link Pool} for the `shield_core` account from
|
|
52
110
|
* {@link AppConfig}. The `connectionLimit` comes from the ADR-0018 budget
|
|
@@ -57,25 +115,44 @@ Object.defineProperty(exports, "isLoopbackHost", { enumerable: true, get: functi
|
|
|
57
115
|
* a wrong/blank password fails LOUD at connect time, which is the correct place
|
|
58
116
|
* for a runtime credential error. The host/port/user/database always have
|
|
59
117
|
* documented defaults, so the descriptor is always well-formed.
|
|
118
|
+
*
|
|
119
|
+
* G-026 (spec 5.C): idle and timeout settings from `config.poolTuning`
|
|
120
|
+
* ({@link mariadbPoolTuningOptions}).
|
|
60
121
|
*/
|
|
61
122
|
function createDbPool(config) {
|
|
62
|
-
const { db, pool } = config;
|
|
63
123
|
const tlsWarning = dbTlsBootWarning(config);
|
|
64
124
|
if (tlsWarning !== undefined)
|
|
65
125
|
dbBootLogger.warn(tlsWarning);
|
|
66
|
-
return mariadb_1.default.createPool(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
126
|
+
return mariadb_1.default.createPool(dbPoolOptions(config));
|
|
127
|
+
}
|
|
128
|
+
/** The options {@link createDbPool} passes to `mariadb.createPool` (exported for tests). */
|
|
129
|
+
function dbPoolOptions(config) {
|
|
130
|
+
const connectionLimit = config.pool.perAccountMax.shield_core;
|
|
131
|
+
return {
|
|
132
|
+
...basePoolOptions(config),
|
|
133
|
+
connectionLimit,
|
|
134
|
+
...mariadbPoolTuningOptions((0, app_config_js_1.poolTuningOf)(config), { connectionLimit }),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The audit sealer's own pool (G-026 spec 5.D): same account, database, TLS and idle settings as
|
|
139
|
+
* {@link createDbPool}, capped at one connection (the sealer holds one per tick). A sealer that
|
|
140
|
+
* borrowed from the core pool every interval would keep the core pool's FIFO idle queue from ever
|
|
141
|
+
* reaching the idle timeout. No `queryTimeout`: `APP_DB_QUERY_TIMEOUT_MS` never cuts a sealer
|
|
142
|
+
* statement (Shield #6). Leak detection applies (it only logs). Internal: provided under
|
|
143
|
+
* `SHIELD_AUDIT_SEALER_POOL` and ended by `AuditSealerService.stop()`.
|
|
144
|
+
*/
|
|
145
|
+
function createAuditSealerPool(config) {
|
|
146
|
+
return mariadb_1.default.createPool(auditSealerPoolOptions(config));
|
|
147
|
+
}
|
|
148
|
+
/** The options {@link createAuditSealerPool} passes to `mariadb.createPool` (exported for tests). */
|
|
149
|
+
function auditSealerPoolOptions(config) {
|
|
150
|
+
const connectionLimit = app_config_js_1.AUDIT_SEALER_POOL_CONNECTIONS;
|
|
151
|
+
return {
|
|
152
|
+
...basePoolOptions(config),
|
|
153
|
+
connectionLimit,
|
|
154
|
+
...mariadbPoolTuningOptions((0, app_config_js_1.poolTuningOf)(config), { connectionLimit, queryTimeout: false }),
|
|
155
|
+
};
|
|
79
156
|
}
|
|
80
157
|
const dbBootLogger = new common_1.Logger('ShieldAuth');
|
|
81
158
|
/**
|
|
@@ -138,9 +215,14 @@ function createRedisClient(config) {
|
|
|
138
215
|
/**
|
|
139
216
|
* Lifecycle-aware holder that owns the pool + redis handles and closes them on
|
|
140
217
|
* app shutdown. Provided ALONGSIDE the two raw-connection providers so Nest calls
|
|
141
|
-
* `
|
|
218
|
+
* `onApplicationShutdown` here (value providers get no lifecycle callback). The teardown
|
|
142
219
|
* is best-effort + idempotent: a close error is swallowed so shutdown never hangs
|
|
143
220
|
* or throws, and both connections are always attempted.
|
|
221
|
+
*
|
|
222
|
+
* G-026 spec 5.O: the close runs in `onApplicationShutdown` (Nest `close()` step 4), after every
|
|
223
|
+
* `onModuleDestroy` and after the HTTP server closed and its in-flight requests finished, so a
|
|
224
|
+
* request still being served while the jobs drain (step 1) never meets a closed pool or Redis.
|
|
225
|
+
* Nothing happens in `onModuleDestroy`.
|
|
144
226
|
*/
|
|
145
227
|
let ConnectionLifecycle = class ConnectionLifecycle {
|
|
146
228
|
pool;
|
|
@@ -149,7 +231,7 @@ let ConnectionLifecycle = class ConnectionLifecycle {
|
|
|
149
231
|
this.pool = pool;
|
|
150
232
|
this.redis = redis;
|
|
151
233
|
}
|
|
152
|
-
async
|
|
234
|
+
async onApplicationShutdown() {
|
|
153
235
|
// Close both; never let one failure prevent the other, never throw.
|
|
154
236
|
try {
|
|
155
237
|
await this.pool.end();
|
|
@@ -8,10 +8,15 @@
|
|
|
8
8
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
9
9
|
* Team B (connection + composition) OWNS this file. The two factories create the
|
|
10
10
|
* real driver objects; the {@link ConnectionLifecycle} provider (a class Nest
|
|
11
|
-
* invokes `
|
|
12
|
-
* itself lifecycle-aware, so the
|
|
13
|
-
* `connections.ts`). Both connections are exported
|
|
14
|
-
* pool (credential resolver + session record store) and
|
|
11
|
+
* invokes `onApplicationShutdown` on, after the HTTP server has closed; G-026 spec 5.O)
|
|
12
|
+
* closes them on shutdown — a value provider is not itself lifecycle-aware, so the
|
|
13
|
+
* teardown lives in that holder (see `connections.ts`). Both connections are exported
|
|
14
|
+
* so AuthModule can inject the pool (credential resolver + session record store) and
|
|
15
|
+
* the redis (hot store).
|
|
16
|
+
*
|
|
17
|
+
* SHIELD_AUDIT_SEALER_POOL — {@link createAuditSealerPool}: the audit sealer's own
|
|
18
|
+
* one-connection pool (G-026 spec 5.D), NOT exported; only the sealer injects it and
|
|
19
|
+
* its `stop()` ends it.
|
|
15
20
|
*
|
|
16
21
|
* SHIELD_DB_POOL — {@link createDbPool}: `mariadb.createPool` for the
|
|
17
22
|
* `shield_core` account from `config.db`, `connectionLimit` from the ADR-0018
|
|
@@ -33,8 +38,8 @@
|
|
|
33
38
|
import { type DynamicModule } from '@nestjs/common';
|
|
34
39
|
/**
|
|
35
40
|
* The persistence module. `forRoot()` returns the two connection providers (both
|
|
36
|
-
* exported so AuthModule can inject them), the shutdown holder
|
|
37
|
-
* Opt-in: only imported when auth is wired.
|
|
41
|
+
* exported so AuthModule can inject them), the shutdown holder, the audit sealer and its
|
|
42
|
+
* own pool (not exported). Opt-in: only imported when auth is wired.
|
|
38
43
|
*/
|
|
39
44
|
export declare class PersistenceModule {
|
|
40
45
|
static forRoot(): DynamicModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.module.d.ts","sourceRoot":"","sources":["../../src/auth/persistence.module.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"persistence.module.d.ts","sourceRoot":"","sources":["../../src/auth/persistence.module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAU,KAAK,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AA6E3E;;;;GAIG;AACH,qBACa,iBAAiB;IAC5B,MAAM,CAAC,OAAO,IAAI,aAAa;CAahC"}
|
|
@@ -9,10 +9,15 @@
|
|
|
9
9
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
10
10
|
* Team B (connection + composition) OWNS this file. The two factories create the
|
|
11
11
|
* real driver objects; the {@link ConnectionLifecycle} provider (a class Nest
|
|
12
|
-
* invokes `
|
|
13
|
-
* itself lifecycle-aware, so the
|
|
14
|
-
* `connections.ts`). Both connections are exported
|
|
15
|
-
* pool (credential resolver + session record store) and
|
|
12
|
+
* invokes `onApplicationShutdown` on, after the HTTP server has closed; G-026 spec 5.O)
|
|
13
|
+
* closes them on shutdown — a value provider is not itself lifecycle-aware, so the
|
|
14
|
+
* teardown lives in that holder (see `connections.ts`). Both connections are exported
|
|
15
|
+
* so AuthModule can inject the pool (credential resolver + session record store) and
|
|
16
|
+
* the redis (hot store).
|
|
17
|
+
*
|
|
18
|
+
* SHIELD_AUDIT_SEALER_POOL — {@link createAuditSealerPool}: the audit sealer's own
|
|
19
|
+
* one-connection pool (G-026 spec 5.D), NOT exported; only the sealer injects it and
|
|
20
|
+
* its `stop()` ends it.
|
|
16
21
|
*
|
|
17
22
|
* SHIELD_DB_POOL — {@link createDbPool}: `mariadb.createPool` for the
|
|
18
23
|
* `shield_core` account from `config.db`, `connectionLimit` from the ADR-0018
|
|
@@ -69,37 +74,55 @@ const redisProvider = {
|
|
|
69
74
|
};
|
|
70
75
|
/**
|
|
71
76
|
* The lifecycle holder — injects the two connections and closes them on shutdown
|
|
72
|
-
* (`
|
|
73
|
-
* this class is where
|
|
77
|
+
* (`onApplicationShutdown`, after the HTTP server has closed; G-026 spec 5.O). A
|
|
78
|
+
* value-provider connection gets no lifecycle callback, so this class is where
|
|
79
|
+
* graceful teardown happens.
|
|
74
80
|
*/
|
|
75
81
|
const lifecycleProvider = {
|
|
76
82
|
provide: connections_js_1.ConnectionLifecycle,
|
|
77
83
|
useFactory: (pool, redis) => new connections_js_1.ConnectionLifecycle(pool, redis),
|
|
78
84
|
inject: [tokens_js_1.SHIELD_DB_POOL, tokens_js_1.SHIELD_REDIS],
|
|
79
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* The audit sealer's own pool (G-026 spec 5.D): one connection, no query timeout. Registered
|
|
88
|
+
* beside the sealer, so it exists exactly when the sealer does (this module, `auth: true`).
|
|
89
|
+
* Not exported. Ended by the sealer's `stop()` after its last tick settled.
|
|
90
|
+
*/
|
|
91
|
+
const auditSealerPoolProvider = {
|
|
92
|
+
provide: tokens_js_1.SHIELD_AUDIT_SEALER_POOL,
|
|
93
|
+
useFactory: (config) => (0, connections_js_1.createAuditSealerPool)(config),
|
|
94
|
+
inject: [config_module_js_1.APP_CONFIG],
|
|
95
|
+
};
|
|
80
96
|
/**
|
|
81
97
|
* The deferred audit sealer (audit-chain-store SPEC §5.H): registered here so it exists
|
|
82
98
|
* exactly when {@link SHIELD_DB_POOL} does. `AUDIT_SEAL_*` is read now, so an invalid value
|
|
83
99
|
* fails the boot (SPEC §13). It ticks only once its table probe finds `audit_log` and
|
|
84
|
-
* `audit_chain`; a stub or unreachable pool leaves it idle (never a boot failure).
|
|
100
|
+
* `audit_chain`; a stub or unreachable pool leaves it idle (never a boot failure). It runs on
|
|
101
|
+
* its own pool ({@link SHIELD_AUDIT_SEALER_POOL}), never on {@link SHIELD_DB_POOL} (G-026).
|
|
85
102
|
*/
|
|
86
103
|
const auditSealerProvider = {
|
|
87
104
|
provide: audit_sealer_service_js_1.AuditSealerService,
|
|
88
105
|
useFactory: (pool, config) => new audit_sealer_service_js_1.AuditSealerService(pool, (0, app_config_js_1.frameworkSchemasOf)(config), {
|
|
89
106
|
config: (0, audit_seal_config_js_1.loadAuditSealConfig)(process.env),
|
|
90
107
|
}),
|
|
91
|
-
inject: [tokens_js_1.
|
|
108
|
+
inject: [tokens_js_1.SHIELD_AUDIT_SEALER_POOL, config_module_js_1.APP_CONFIG],
|
|
92
109
|
};
|
|
93
110
|
/**
|
|
94
111
|
* The persistence module. `forRoot()` returns the two connection providers (both
|
|
95
|
-
* exported so AuthModule can inject them), the shutdown holder
|
|
96
|
-
* Opt-in: only imported when auth is wired.
|
|
112
|
+
* exported so AuthModule can inject them), the shutdown holder, the audit sealer and its
|
|
113
|
+
* own pool (not exported). Opt-in: only imported when auth is wired.
|
|
97
114
|
*/
|
|
98
115
|
let PersistenceModule = PersistenceModule_1 = class PersistenceModule {
|
|
99
116
|
static forRoot() {
|
|
100
117
|
return {
|
|
101
118
|
module: PersistenceModule_1,
|
|
102
|
-
providers: [
|
|
119
|
+
providers: [
|
|
120
|
+
dbPoolProvider,
|
|
121
|
+
redisProvider,
|
|
122
|
+
lifecycleProvider,
|
|
123
|
+
auditSealerPoolProvider,
|
|
124
|
+
auditSealerProvider,
|
|
125
|
+
],
|
|
103
126
|
exports: [tokens_js_1.SHIELD_DB_POOL, tokens_js_1.SHIELD_REDIS],
|
|
104
127
|
};
|
|
105
128
|
}
|
package/dist/auth/tokens.d.ts
CHANGED
|
@@ -30,6 +30,12 @@ export { SHIELD_PASSWORD_HASHER } from '../authentication/argon2id-password-hash
|
|
|
30
30
|
* {@link SHIELD_SESSION_RECORD_STORE} factory. Disposed on app shutdown.
|
|
31
31
|
*/
|
|
32
32
|
export declare const SHIELD_DB_POOL: unique symbol;
|
|
33
|
+
/**
|
|
34
|
+
* Internal (G-026 spec 5.D): the audit sealer's own one-connection `mariadb` `Pool`, same account
|
|
35
|
+
* and database as {@link SHIELD_DB_POOL}, no query timeout. Provided by `PersistenceModule` (not
|
|
36
|
+
* exported from it); only `AuditSealerService` injects it, and its `stop()` ends it.
|
|
37
|
+
*/
|
|
38
|
+
export declare const SHIELD_AUDIT_SEALER_POOL: unique symbol;
|
|
33
39
|
/**
|
|
34
40
|
* The ONE live `ioredis` client (the hot session tier, ADR-0013). **Provided by
|
|
35
41
|
* Team B** (the persistence factory). **Consumed by** the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/auth/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD;;;;GAIG;AACH,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8 +23,8 @@
|
|
|
23
23
|
* ADR-0003: no framework/DB/crypto imports here — just Symbols (+ one re-export).
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.SHIELD_CAPTCHA_GATE = exports.SHIELD_CAPTCHA_VERIFIER = exports.SHIELD_CAPTCHA_CONFIG = void 0;
|
|
26
|
+
exports.SHIELD_ACCOUNT_UNLOCKER = exports.SHIELD_ADMIN_STEP_UP = exports.SHIELD_MFA_REQUIREMENT = exports.SHIELD_MFA_REQUIREMENT_SOURCE = exports.SHIELD_SIGN_IN_WITH = exports.SHIELD_SESSION_RESTRICTIONS = exports.SHIELD_PERMISSION_VERSION_CACHE = exports.SHIELD_PERMISSION_FACTS = exports.SHIELD_RESET_LIMITER = exports.SHIELD_FORGOT_HINT_LIMITER = exports.SHIELD_FORGOT_LIMITER = exports.SHIELD_LOGIN_TOTP_VERIFIER = exports.SHIELD_MFA_STEP_UP = exports.SHIELD_MFA_LIMITER = exports.SHIELD_RECOVERY_LIMITER = exports.SHIELD_LOGIN_IP_LIMITER = exports.SHIELD_LOGIN_LIMITER = exports.SHIELD_MEMBERSHIP_CHECKER = exports.SHIELD_SCOPE_SUBTREE_RESOLVER = exports.SHIELD_SESSION_FACTS_PROJECTOR = exports.SHIELD_ROOT_IDS = exports.SHIELD_TOTP_VERIFIER_OVERRIDE = exports.SHIELD_TOTP_VERIFIER = exports.SHIELD_RESET_LINK_BASE_URL = exports.SHIELD_SESSION_SWEEPER = exports.SHIELD_MFA_DEVICE_STORE = exports.SHIELD_DEFAULT_AUTH_AUDIT_SINK = exports.SHIELD_AUDIT_SINK = exports.SHIELD_PROFILE_WRITER = exports.SHIELD_RECOVERY_CODE_STORE = exports.SHIELD_EMAIL_DELIVERY = exports.SHIELD_ATTEMPT_LIMITER_FACTORY = exports.SHIELD_MESSAGE_DISPATCHER = exports.SHIELD_EMAIL_SENDER = exports.SHIELD_CONFIRM_EMAIL_LIMITER = exports.SHIELD_EMAIL_CHANGE_LIMITER = exports.SHIELD_EMAIL_CHANGE_LINK_BASE_URL = exports.SHIELD_EMAIL_ADDRESS_CHANGER = exports.SHIELD_EMAIL_CHANGE_TOKEN_STORE = exports.SHIELD_RESET_TOKEN_STORE = exports.SHIELD_CREDENTIAL_WRITER = exports.SHIELD_RECENT_ROTATION_STORE = exports.SHIELD_SESSION_AUTHORITY = exports.SHIELD_AUTHENTICATOR = exports.SHIELD_PROFILE_RESOLVER = exports.SHIELD_CREDENTIAL_RESOLVER = exports.SHIELD_REDIS = exports.SHIELD_AUDIT_SEALER_POOL = exports.SHIELD_DB_POOL = exports.SHIELD_PASSWORD_HASHER = void 0;
|
|
27
|
+
exports.SHIELD_CAPTCHA_GATE = exports.SHIELD_CAPTCHA_VERIFIER = exports.SHIELD_CAPTCHA_CONFIG = exports.SHIELD_MFA_POLICY_FEATURE = void 0;
|
|
28
28
|
var argon2id_password_hasher_js_1 = require("../authentication/argon2id-password-hasher.js");
|
|
29
29
|
Object.defineProperty(exports, "SHIELD_PASSWORD_HASHER", { enumerable: true, get: function () { return argon2id_password_hasher_js_1.SHIELD_PASSWORD_HASHER; } });
|
|
30
30
|
/**
|
|
@@ -35,6 +35,12 @@ Object.defineProperty(exports, "SHIELD_PASSWORD_HASHER", { enumerable: true, get
|
|
|
35
35
|
* {@link SHIELD_SESSION_RECORD_STORE} factory. Disposed on app shutdown.
|
|
36
36
|
*/
|
|
37
37
|
exports.SHIELD_DB_POOL = Symbol('SHIELD_DB_POOL');
|
|
38
|
+
/**
|
|
39
|
+
* Internal (G-026 spec 5.D): the audit sealer's own one-connection `mariadb` `Pool`, same account
|
|
40
|
+
* and database as {@link SHIELD_DB_POOL}, no query timeout. Provided by `PersistenceModule` (not
|
|
41
|
+
* exported from it); only `AuditSealerService` injects it, and its `stop()` ends it.
|
|
42
|
+
*/
|
|
43
|
+
exports.SHIELD_AUDIT_SEALER_POOL = Symbol('SHIELD_AUDIT_SEALER_POOL');
|
|
38
44
|
/**
|
|
39
45
|
* The ONE live `ioredis` client (the hot session tier, ADR-0013). **Provided by
|
|
40
46
|
* Team B** (the persistence factory). **Consumed by** the
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* paths share one collision rule and one login-hint rule.
|
|
7
7
|
*
|
|
8
8
|
* `change` (one MariaDB transaction, lock-then-recheck):
|
|
9
|
-
* 0. `GET_LOCK('shield_email_change')` — serialises email changes
|
|
9
|
+
* 0. `GET_LOCK('shield_email_change')` — serialises email changes (run via
|
|
10
|
+
* `withoutStatementTimeout`, so only its own 10 s timeout ends the wait). The locked collision reads
|
|
10
11
|
* below look up a value that is normally ABSENT; under REPEATABLE READ that takes a gap lock
|
|
11
12
|
* on `uq_users_email` (migration 021, KI #87) and on the `ic_identity_hint` PK. Gap locks do
|
|
12
13
|
* not conflict with each other but block the other side's insert into the gap, so two
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mariadb-email-address-changer.d.ts","sourceRoot":"","sources":["../../src/authentication/mariadb-email-address-changer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mariadb-email-address-changer.d.ts","sourceRoot":"","sources":["../../src/authentication/mariadb-email-address-changer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,qCAAqC,CAAC;AAqB7C,qBAAa,0BAA2B,YAAW,mBAAmB;IASlE,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IATtB,uBAAuB;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,0CAA0C;IAC1C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAGjB,IAAI,EAAE,IAAI,EACV,GAAG,GAAE,MAAM,MAAiB;IAC7C,yFAAyF;IACzF,OAAO,CAAC,EAAE,oBAAoB;IAQ1B,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAejF,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YA+BxD,YAAY;CAqE3B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MariaDbEmailAddressChanger = void 0;
|
|
4
|
+
const connections_js_1 = require("../auth/connections.js");
|
|
4
5
|
const framework_schema_names_js_1 = require("../config/framework-schema-names.js");
|
|
5
6
|
/** Seconds to wait for the email-change named lock before giving up (caller → 503). */
|
|
6
7
|
const LOCK_TIMEOUT_S = 10;
|
|
@@ -48,9 +49,8 @@ class MariaDbEmailAddressChanger {
|
|
|
48
49
|
const conn = await this.pool.getConnection();
|
|
49
50
|
let locked = false;
|
|
50
51
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
]));
|
|
52
|
+
// G-026 spec 5.L: the wait ends only by its own LOCK_TIMEOUT_S, never by APP_DB_QUERY_TIMEOUT_MS.
|
|
53
|
+
const got = (await conn.query((0, connections_js_1.withoutStatementTimeout)("SELECT GET_LOCK('shield_email_change', ?) AS got"), [LOCK_TIMEOUT_S]));
|
|
54
54
|
if (Number(got[0]?.got ?? 0) !== 1)
|
|
55
55
|
throw new Error('email change lock unavailable');
|
|
56
56
|
locked = true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type OnApplicationBootstrap } from '@nestjs/common';
|
|
2
2
|
import type { FrameworkSchemas } from '@astram/core';
|
|
3
|
-
import { type AppConfig, type PoolBudgetConfig } from '../config/app-config.js';
|
|
3
|
+
import { type AppConfig, type PoolBudgetConfig, type PoolTuning } from '../config/app-config.js';
|
|
4
4
|
/**
|
|
5
5
|
* Boot sequence extension point (Infrastructure layer — ADR-0018).
|
|
6
6
|
*
|
|
@@ -11,7 +11,7 @@ import { type AppConfig, type PoolBudgetConfig } from '../config/app-config.js';
|
|
|
11
11
|
* ───────────────────────────────────────────────────────────────────────────
|
|
12
12
|
* ADR-0018 connection-pool assertion (FILLED).
|
|
13
13
|
* {@link assertConnectionPoolReady} computes the connection budget
|
|
14
|
-
* workers × Σ(per-account runtime pool max) + headroom ≤ maxConnections
|
|
14
|
+
* workers × (Σ(per-account runtime pool max) + 1 audit sealer) + headroom ≤ maxConnections
|
|
15
15
|
* and THROWS (fail-closed, abort boot) on violation, so a pool config that
|
|
16
16
|
* would exceed MariaDB's `max_connections` is caught at boot, never under load.
|
|
17
17
|
* ───────────────────────────────────────────────────────────────────────────
|
|
@@ -35,6 +35,11 @@ export declare class BootSequence implements OnApplicationBootstrap {
|
|
|
35
35
|
}
|
|
36
36
|
/** The boot log line naming the resolved framework databases (names only, spec 5.E). */
|
|
37
37
|
export declare function frameworkDatabasesLogLine(s: FrameworkSchemas): string;
|
|
38
|
+
/**
|
|
39
|
+
* The boot log line with the effective pool idle settings (G-026 spec 5.N), numbers only, e.g.
|
|
40
|
+
* `DB pools: minIdle=1 idleTimeout=600s queryTimeout=off leakDetection=off sealer=1`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function poolTuningLogLine(t: PoolTuning): string;
|
|
38
43
|
/**
|
|
39
44
|
* Single-database-layout spec §5.C, AC-1 (ADR-0041): the warning for `SHIELD_DB_NAME` set under
|
|
40
45
|
* the four layout (it is read only when `SHIELD_DB_LAYOUT=single`), else `undefined`. Names the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot-sequence.d.ts","sourceRoot":"","sources":["../../src/boot/boot-sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,
|
|
1
|
+
{"version":3,"file":"boot-sequence.d.ts","sourceRoot":"","sources":["../../src/boot/boot-sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,qBACa,YAAa,YAAW,sBAAsB;IAGzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFvD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;gBAEE,MAAM,EAAE,SAAS;IAE5D,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAe7C;;;;;;;;;OASG;YACW,yBAAyB;CAIxC;AAED,wFAAwF;AACxF,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAMrE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAOvD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,GAAG,SAAS,CAKrF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,CA0C5D"}
|
|
@@ -14,6 +14,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.BootSequence = void 0;
|
|
16
16
|
exports.frameworkDatabasesLogLine = frameworkDatabasesLogLine;
|
|
17
|
+
exports.poolTuningLogLine = poolTuningLogLine;
|
|
17
18
|
exports.shieldDbNameIgnoredWarning = shieldDbNameIgnoredWarning;
|
|
18
19
|
exports.assertPoolBudget = assertPoolBudget;
|
|
19
20
|
const common_1 = require("@nestjs/common");
|
|
@@ -29,7 +30,7 @@ const app_config_js_1 = require("../config/app-config.js");
|
|
|
29
30
|
* ───────────────────────────────────────────────────────────────────────────
|
|
30
31
|
* ADR-0018 connection-pool assertion (FILLED).
|
|
31
32
|
* {@link assertConnectionPoolReady} computes the connection budget
|
|
32
|
-
* workers × Σ(per-account runtime pool max) + headroom ≤ maxConnections
|
|
33
|
+
* workers × (Σ(per-account runtime pool max) + 1 audit sealer) + headroom ≤ maxConnections
|
|
33
34
|
* and THROWS (fail-closed, abort boot) on violation, so a pool config that
|
|
34
35
|
* would exceed MariaDB's `max_connections` is caught at boot, never under load.
|
|
35
36
|
* ───────────────────────────────────────────────────────────────────────────
|
|
@@ -44,6 +45,8 @@ let BootSequence = class BootSequence {
|
|
|
44
45
|
// configurable-framework-db spec 5.E: the resolved database names, once per boot. Names
|
|
45
46
|
// only — never a user, password, host or connection string.
|
|
46
47
|
this.logger.log(frameworkDatabasesLogLine((0, app_config_js_1.frameworkSchemasOf)(this.config)));
|
|
48
|
+
// G-026 spec 5.N: the effective pool idle settings, numbers only.
|
|
49
|
+
this.logger.log(poolTuningLogLine((0, app_config_js_1.poolTuningOf)(this.config)));
|
|
47
50
|
// Spec 5.C/AC-1: SHIELD_DB_NAME is read only in the single layout; say so when it is ignored.
|
|
48
51
|
const ignored = shieldDbNameIgnoredWarning(process.env);
|
|
49
52
|
if (ignored !== undefined)
|
|
@@ -81,6 +84,16 @@ function frameworkDatabasesLogLine(s) {
|
|
|
81
84
|
return (`Shield databases: namespace=${s.namespace} app=${s.app} identity=${s.identity} ` +
|
|
82
85
|
`authz=${s.authz} audit=${s.audit}`);
|
|
83
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* The boot log line with the effective pool idle settings (G-026 spec 5.N), numbers only, e.g.
|
|
89
|
+
* `DB pools: minIdle=1 idleTimeout=600s queryTimeout=off leakDetection=off sealer=1`.
|
|
90
|
+
*/
|
|
91
|
+
function poolTuningLogLine(t) {
|
|
92
|
+
const ms = (v) => (v === undefined ? 'off' : `${v}ms`);
|
|
93
|
+
return (`DB pools: minIdle=${t.minimumIdle} idleTimeout=${t.idleTimeoutS}s ` +
|
|
94
|
+
`queryTimeout=${ms(t.queryTimeoutMs)} leakDetection=${ms(t.leakDetectionMs)} ` +
|
|
95
|
+
`sealer=${app_config_js_1.AUDIT_SEALER_POOL_CONNECTIONS}`);
|
|
96
|
+
}
|
|
84
97
|
/**
|
|
85
98
|
* Single-database-layout spec §5.C, AC-1 (ADR-0041): the warning for `SHIELD_DB_NAME` set under
|
|
86
99
|
* the four layout (it is read only when `SHIELD_DB_LAYOUT=single`), else `undefined`. Names the
|
|
@@ -113,7 +126,8 @@ function assertPoolBudget(cfg) {
|
|
|
113
126
|
if (!e.withinUserBudget) {
|
|
114
127
|
throw new Error('[ADR-0018] connection-pool assertion FAILED (fail-closed): single layout needs ' +
|
|
115
128
|
`${e.requiredConnections} connections (workers(${cfg.workers}) × ` +
|
|
116
|
-
`${e.perWorkerConnections}
|
|
129
|
+
`${e.perWorkerConnections} (audit sealer's ${app_config_js_1.AUDIT_SEALER_POOL_CONNECTIONS} per worker ` +
|
|
130
|
+
`included) + headroom(${cfg.headroom})) but the account allows ` +
|
|
117
131
|
`${cfg.maxUserConnections} (APP_DB_MAX_USER_CONNECTIONS). Reduce POOL_MAX_CORE, ` +
|
|
118
132
|
'POOL_MAX_ENGINE, APP_AUTHZ_POOL_MAX, POOL_WORKERS or POOL_HEADROOM, or raise ' +
|
|
119
133
|
'MAX_USER_CONNECTIONS on the account (ADR-0041).');
|
|
@@ -122,11 +136,14 @@ function assertPoolBudget(cfg) {
|
|
|
122
136
|
throw new Error('[ADR-0018] connection-pool assertion FAILED (fail-closed): required ' +
|
|
123
137
|
`connections ${e.requiredConnections} exceed max_connections ` +
|
|
124
138
|
`${cfg.maxConnections}. Budget = workers(${cfg.workers}) × ` +
|
|
125
|
-
|
|
139
|
+
`(Σ(per-account pool max) + audit sealer ${app_config_js_1.AUDIT_SEALER_POOL_CONNECTIONS})` +
|
|
140
|
+
`(${e.perWorkerConnections}) + headroom(` +
|
|
126
141
|
`${cfg.headroom}) = ${e.requiredConnections} > ${cfg.maxConnections}. ` +
|
|
142
|
+
`The audit sealer's own pool counts ${app_config_js_1.AUDIT_SEALER_POOL_CONNECTIONS} per worker. ` +
|
|
127
143
|
(cfg.layout === 'single'
|
|
128
144
|
? 'Single layout: one account opens POOL_MAX_CORE + POOL_MAX_ENGINE (unset ⇒ ' +
|
|
129
|
-
'APP_DB_MAX_CONNECTIONS, else 10) + APP_AUTHZ_POOL_MAX per worker;
|
|
145
|
+
'APP_DB_MAX_CONNECTIONS, else 10) + APP_AUTHZ_POOL_MAX + 1 (audit sealer) per worker; ' +
|
|
146
|
+
'set POOL_MAX_ENGINE ' +
|
|
130
147
|
'explicitly, lower a pool cap or the worker count, or raise max_connections.'
|
|
131
148
|
: 'Reduce a per-account pool cap, the worker count, or raise ' +
|
|
132
149
|
'max_connections (and MariaDB my.cnf) to restore the budget.'));
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
13
13
|
* ADR-0018 budget (the invariant this config feeds):
|
|
14
|
-
* workers × Σ(per-account RUNTIME pool max) + headroom ≤ maxConnections
|
|
14
|
+
* workers × (Σ(per-account RUNTIME pool max) + 1 audit sealer) + headroom ≤ maxConnections
|
|
15
15
|
*
|
|
16
16
|
* "Runtime" pools are the pools each PM2 cluster worker holds open: shield_core,
|
|
17
17
|
* shield_app_crud, shield_schema_svc. The deploy/ops accounts (migrate, backup,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* Defaults below agree byte-for-byte with infra/mariadb/conf.d/my.cnf
|
|
22
22
|
* (max_connections=250) and the local docker-compose substrate:
|
|
23
|
-
* 8 × (12 + 8 + 1) + 40 =
|
|
23
|
+
* 8 × (12 + 8 + 1 + 1 sealer) + 40 = 216 ≤ 250 ✓ (G-026: the sealer's own 1-connection pool)
|
|
24
24
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
25
25
|
*/
|
|
26
26
|
import type { FrameworkSchemas, SecretsProvider } from '@astram/core';
|
|
@@ -81,6 +81,13 @@ export interface AppConfig {
|
|
|
81
81
|
* from `process.env` once at boot. Provided app-wide under `FRAMEWORK_SCHEMAS`.
|
|
82
82
|
*/
|
|
83
83
|
readonly schemas?: FrameworkSchemas;
|
|
84
|
+
/**
|
|
85
|
+
* G-026 (db-pool-idle spec 5.A, 5.C): the idle and timeout settings every framework pool applies
|
|
86
|
+
* (`POOL_MIN_IDLE`, `POOL_IDLE_TIMEOUT_S`, `APP_DB_QUERY_TIMEOUT_MS`, `POOL_LEAK_DETECTION_MS`),
|
|
87
|
+
* filled by {@link loadAppConfig}. Optional so hand-built configs keep compiling; absent ⇒ the
|
|
88
|
+
* pool factories read {@link loadPoolTuning}`(process.env)` once at boot.
|
|
89
|
+
*/
|
|
90
|
+
readonly poolTuning?: PoolTuning;
|
|
84
91
|
}
|
|
85
92
|
/**
|
|
86
93
|
* The resolved framework database names for a config: `config.schemas`, else resolved from
|
|
@@ -219,6 +226,41 @@ export declare const SCHEMA_SVC_POOL_HARD_CAP = 2;
|
|
|
219
226
|
* unset NODE_ENV is treated as "not dev").
|
|
220
227
|
*/
|
|
221
228
|
export declare function isDevOrTestNodeEnv(raw: string | undefined): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* G-026 (db-pool-idle spec 5.A, section 10): the idle and timeout settings of the framework pools.
|
|
231
|
+
* Caps are unchanged (they stay in {@link PoolBudgetConfig}); these only decide how many idle
|
|
232
|
+
* connections a pool keeps and how long a statement may run.
|
|
233
|
+
*/
|
|
234
|
+
export interface PoolTuning {
|
|
235
|
+
/** `POOL_MIN_IDLE` (default 1, 0–1000): idle connections kept; each pool caps it at its own cap. */
|
|
236
|
+
readonly minimumIdle: number;
|
|
237
|
+
/** `POOL_IDLE_TIMEOUT_S` (default 600, 10–3600): seconds before an idle connection above the minimum closes. */
|
|
238
|
+
readonly idleTimeoutS: number;
|
|
239
|
+
/**
|
|
240
|
+
* `APP_DB_QUERY_TIMEOUT_MS` (unset ⇒ off, 1000–3600000): the session `max_statement_time` of every
|
|
241
|
+
* request-serving pool. Never applied to the audit sealer pool; framework lock waits opt out
|
|
242
|
+
* per statement (`withoutStatementTimeout`).
|
|
243
|
+
*/
|
|
244
|
+
readonly queryTimeoutMs?: number;
|
|
245
|
+
/** `POOL_LEAK_DETECTION_MS` (unset ⇒ off, 1000–600000): log a connection held longer than this. */
|
|
246
|
+
readonly leakDetectionMs?: number;
|
|
247
|
+
}
|
|
248
|
+
/** Section 10 defaults: one idle connection per pool, closed after 10 idle minutes. */
|
|
249
|
+
export declare const DEFAULT_POOL_MIN_IDLE = 1;
|
|
250
|
+
export declare const DEFAULT_POOL_IDLE_TIMEOUT_S = 600;
|
|
251
|
+
/**
|
|
252
|
+
* Read the pool idle and timeout settings (db-pool-idle spec 5.A). Pure; every framework pool uses
|
|
253
|
+
* this one loader (no pool reads the variables itself). A set but invalid or out-of-range value
|
|
254
|
+
* throws naming the variable; blank or unset gives the default (off for the two optional ones).
|
|
255
|
+
*/
|
|
256
|
+
export declare function loadPoolTuning(env?: NodeJS.ProcessEnv): PoolTuning;
|
|
257
|
+
/** The tuning for a config: `config.poolTuning`, else read from `process.env` (call at boot only). */
|
|
258
|
+
export declare function poolTuningOf(config: Pick<AppConfig, 'poolTuning'>): PoolTuning;
|
|
259
|
+
/**
|
|
260
|
+
* The audit sealer's own pool (db-pool-idle spec 5.D): one connection per worker, always counted
|
|
261
|
+
* in the budget (5.F), whether or not `auth: true` starts the sealer.
|
|
262
|
+
*/
|
|
263
|
+
export declare const AUDIT_SEALER_POOL_CONNECTIONS = 1;
|
|
222
264
|
/**
|
|
223
265
|
* Build the {@link PoolBudgetConfig} from env with documented defaults.
|
|
224
266
|
* Field ↔ env name:
|
|
@@ -393,7 +435,7 @@ export declare const DEFAULT_OBJECT_STORAGE_MAX_BYTES: number;
|
|
|
393
435
|
export declare function loadObjectStorageConfig(env?: NodeJS.ProcessEnv, options?: LoadObjectStorageConfigOptions): ObjectStorageConfig | undefined;
|
|
394
436
|
/** Result of evaluating a {@link PoolBudgetConfig} against the ADR-0018 budget. */
|
|
395
437
|
export interface PoolBudgetEvaluation {
|
|
396
|
-
/** Σ(per-account runtime pool max) for a single worker. */
|
|
438
|
+
/** Σ(per-account runtime pool max) + the audit sealer's 1, for a single worker. */
|
|
397
439
|
readonly perWorkerConnections: number;
|
|
398
440
|
/** workers × perWorkerConnections — total runtime connections at full load. */
|
|
399
441
|
readonly runtimeConnections: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-config.d.ts","sourceRoot":"","sources":["../../src/config/app-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAWtE,MAAM,WAAW,SAAS;IACxB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,aAAa,GAAG,MAAM,GAAG,YAAY,CAAC;IAC5D,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAGhC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,wBA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AAgC,QAAmB,CAAC;AAKjE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,OAAO,GAAE,8BAAmC,GAC3C,mBAAmB,GAAG,SAAS,CA+DjC;AA0BD,mFAAmF;AACnF,MAAM,WAAW,oBAAoB;IACnC,mFAAmF;IACnF,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,0EAA0E;IAC1E,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,qEAAqE;IACrE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qDAAqD;IACrD,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,GAAG,oBAAoB,CA0B9E"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_OBJECT_STORAGE_MAX_BYTES = exports.DEFAULT_REDIS_URL = exports.DEFAULT_DB_CONFIG = exports.SCHEMA_SVC_POOL_HARD_CAP = exports.DEFAULT_POOL_BUDGET = exports.DEFAULT_REDIS_COMMAND_TIMEOUT_MS = exports.DEFAULT_LOGIN_IP_LIMIT = void 0;
|
|
3
|
+
exports.DEFAULT_OBJECT_STORAGE_MAX_BYTES = exports.DEFAULT_REDIS_URL = exports.DEFAULT_DB_CONFIG = exports.AUDIT_SEALER_POOL_CONNECTIONS = exports.DEFAULT_POOL_IDLE_TIMEOUT_S = exports.DEFAULT_POOL_MIN_IDLE = exports.SCHEMA_SVC_POOL_HARD_CAP = exports.DEFAULT_POOL_BUDGET = exports.DEFAULT_REDIS_COMMAND_TIMEOUT_MS = exports.DEFAULT_LOGIN_IP_LIMIT = void 0;
|
|
4
4
|
exports.frameworkSchemasOf = frameworkSchemasOf;
|
|
5
5
|
exports.isDevOrTestNodeEnv = isDevOrTestNodeEnv;
|
|
6
|
+
exports.loadPoolTuning = loadPoolTuning;
|
|
7
|
+
exports.poolTuningOf = poolTuningOf;
|
|
6
8
|
exports.loadPoolBudget = loadPoolBudget;
|
|
7
9
|
exports.loadDbConfig = loadDbConfig;
|
|
8
10
|
exports.loadDbTlsConfig = loadDbTlsConfig;
|
|
@@ -99,6 +101,51 @@ function strictOptionalPoolInt(raw, name) {
|
|
|
99
101
|
throw new Error(`${name} must be a positive integer`);
|
|
100
102
|
return n;
|
|
101
103
|
}
|
|
104
|
+
/** Section 10 defaults: one idle connection per pool, closed after 10 idle minutes. */
|
|
105
|
+
exports.DEFAULT_POOL_MIN_IDLE = 1;
|
|
106
|
+
exports.DEFAULT_POOL_IDLE_TIMEOUT_S = 600;
|
|
107
|
+
/**
|
|
108
|
+
* A tuning variable: unset or blank gives `undefined`; otherwise plain digits (surrounding
|
|
109
|
+
* whitespace allowed) within `[min, max]`, or it throws naming the variable and the range, never the
|
|
110
|
+
* value (fail closed, Shield #1, core 70-secrets).
|
|
111
|
+
*/
|
|
112
|
+
function strictOptionalRangeInt(raw, name, min, max) {
|
|
113
|
+
if (raw === undefined || raw.trim() === '')
|
|
114
|
+
return undefined;
|
|
115
|
+
const t = raw.trim();
|
|
116
|
+
const n = /^[0-9]+$/.test(t) ? Number(t) : Number.NaN;
|
|
117
|
+
if (!Number.isSafeInteger(n) || n < min || n > max) {
|
|
118
|
+
throw new Error(`${name} must be an integer ${min}–${max}`);
|
|
119
|
+
}
|
|
120
|
+
return n;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Read the pool idle and timeout settings (db-pool-idle spec 5.A). Pure; every framework pool uses
|
|
124
|
+
* this one loader (no pool reads the variables itself). A set but invalid or out-of-range value
|
|
125
|
+
* throws naming the variable; blank or unset gives the default (off for the two optional ones).
|
|
126
|
+
*/
|
|
127
|
+
function loadPoolTuning(env = process.env) {
|
|
128
|
+
const minimumIdle = strictOptionalRangeInt(env.POOL_MIN_IDLE, 'POOL_MIN_IDLE', 0, 1000) ?? exports.DEFAULT_POOL_MIN_IDLE;
|
|
129
|
+
const idleTimeoutS = strictOptionalRangeInt(env.POOL_IDLE_TIMEOUT_S, 'POOL_IDLE_TIMEOUT_S', 10, 3600) ??
|
|
130
|
+
exports.DEFAULT_POOL_IDLE_TIMEOUT_S;
|
|
131
|
+
const queryTimeoutMs = strictOptionalRangeInt(env.APP_DB_QUERY_TIMEOUT_MS, 'APP_DB_QUERY_TIMEOUT_MS', 1000, 3_600_000);
|
|
132
|
+
const leakDetectionMs = strictOptionalRangeInt(env.POOL_LEAK_DETECTION_MS, 'POOL_LEAK_DETECTION_MS', 1000, 600_000);
|
|
133
|
+
return {
|
|
134
|
+
minimumIdle,
|
|
135
|
+
idleTimeoutS,
|
|
136
|
+
...(queryTimeoutMs !== undefined ? { queryTimeoutMs } : {}),
|
|
137
|
+
...(leakDetectionMs !== undefined ? { leakDetectionMs } : {}),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** The tuning for a config: `config.poolTuning`, else read from `process.env` (call at boot only). */
|
|
141
|
+
function poolTuningOf(config) {
|
|
142
|
+
return config.poolTuning ?? loadPoolTuning(process.env);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The audit sealer's own pool (db-pool-idle spec 5.D): one connection per worker, always counted
|
|
146
|
+
* in the budget (5.F), whether or not `auth: true` starts the sealer.
|
|
147
|
+
*/
|
|
148
|
+
exports.AUDIT_SEALER_POOL_CONNECTIONS = 1;
|
|
102
149
|
/**
|
|
103
150
|
* Build the {@link PoolBudgetConfig} from env with documented defaults.
|
|
104
151
|
* Field ↔ env name:
|
|
@@ -362,6 +409,7 @@ function loadAppConfig(env = process.env) {
|
|
|
362
409
|
lifetimes: loadSessionLifetimes(env),
|
|
363
410
|
loginIpLimit: loadLoginIpLimit(env),
|
|
364
411
|
...(refreshReplayWindowMs !== undefined ? { refreshReplayWindowMs } : {}),
|
|
412
|
+
poolTuning: loadPoolTuning(env),
|
|
365
413
|
};
|
|
366
414
|
}
|
|
367
415
|
/**
|
|
@@ -479,11 +527,12 @@ function parseStorageMaxBytes(raw) {
|
|
|
479
527
|
*/
|
|
480
528
|
function evaluatePoolBudget(cfg) {
|
|
481
529
|
// Single layout (AC-12): one account opens core + engine + authz; app_crud/schema_svc are never opened.
|
|
482
|
-
|
|
530
|
+
// Both layouts add the audit sealer's own pool (G-026 spec 5.F: 1 per worker, always counted).
|
|
531
|
+
const perWorkerConnections = (cfg.layout === 'single'
|
|
483
532
|
? cfg.perAccountMax.shield_core + (cfg.engineMax ?? 10) + (cfg.authzMax ?? 4)
|
|
484
533
|
: cfg.perAccountMax.shield_core +
|
|
485
534
|
cfg.perAccountMax.shield_app_crud +
|
|
486
|
-
cfg.perAccountMax.shield_schema_svc;
|
|
535
|
+
cfg.perAccountMax.shield_schema_svc) + exports.AUDIT_SEALER_POOL_CONNECTIONS;
|
|
487
536
|
const runtimeConnections = cfg.workers * perWorkerConnections;
|
|
488
537
|
const requiredConnections = runtimeConnections + cfg.headroom;
|
|
489
538
|
const slack = cfg.maxConnections - requiredConnections;
|
package/dist/index.d.ts
CHANGED
|
@@ -70,10 +70,11 @@ export { FrameworkMigrationLedgerCheck, MigrationLedgerRegistry, SHIELD_MIGRATIO
|
|
|
70
70
|
export { APP_CONFIG } from './config/config.module.js';
|
|
71
71
|
export { FRAMEWORK_SCHEMAS } from './config/config.module.js';
|
|
72
72
|
export type { FrameworkSchemaNames } from './config/framework-schema-names.js';
|
|
73
|
-
export { frameworkSchemasOf, 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, loadRefreshReplayWindowMs, DEFAULT_LOGIN_IP_LIMIT, isDevOrTestNodeEnv, type LoginIpLimitConfig, loadDbTlsConfig, type DbTlsConfig, } from './config/app-config.js';
|
|
73
|
+
export { frameworkSchemasOf, 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, loadRefreshReplayWindowMs, DEFAULT_LOGIN_IP_LIMIT, isDevOrTestNodeEnv, type LoginIpLimitConfig, loadDbTlsConfig, type DbTlsConfig, loadPoolTuning, type PoolTuning, } from './config/app-config.js';
|
|
74
74
|
export { rootIdsFromEnv } from './config/root-ids-from-env.js';
|
|
75
75
|
export { ORG_BOOTSTRAP_PRINCIPAL_ID, assertNoReservedRootId, RESERVED_OPERATION_PRINCIPALS, reservedOperationPrincipal, type ReservedOperationPrincipal, } from './config/reserved-principal-ids.js';
|
|
76
76
|
export { mariadbSslOption } from './auth/connections.js';
|
|
77
|
+
export { mariadbPoolTuningOptions, withoutStatementTimeout, type MariadbPoolTuningOptions, type MariadbPoolTuningOptionsOpts, } from './auth/connections.js';
|
|
77
78
|
export { SHIELD_REDIS, SHIELD_CREDENTIAL_RESOLVER, SHIELD_PROFILE_RESOLVER, SHIELD_AUTHENTICATOR, SHIELD_SESSION_AUTHORITY, SHIELD_CREDENTIAL_WRITER, SHIELD_RESET_TOKEN_STORE, SHIELD_EMAIL_CHANGE_TOKEN_STORE, SHIELD_EMAIL_SENDER, SHIELD_MESSAGE_DISPATCHER, 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';
|
|
78
79
|
export { MariaDbCredentialResolver } from './authentication/mariadb-credential-resolver.js';
|
|
79
80
|
export { resolveSignInWith, DEFAULT_SIGN_IN_WITH, type SignInMethod, } from './authentication/sign-in-with.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,EACL,UAAU,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,SAAS,GACV,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EACL,YAAY,EACZ,yBAAyB,EAGzB,2BAA2B,EAC3B,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,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAKpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC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OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.wasResolvedFromSecretRef = exports.assertNoUnresolvedSecretRefs = exports.createSecretsProviderFromEnv = exports.resolveBootSecrets = exports.EncryptedFileSecretsProvider = exports.LocalKekCrypto = exports.resolveAuthLinkBaseUrls = exports.CredentialExistsError = exports.isLockedHash = exports.lockedPasswordHash = 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.uuidArrayField = exports.optionalUuidField = exports.uuidField = exports.UuidPipe = exports.normalizeClassification = exports.DEFAULT_CLASSIFIED_ACTION = exports.CLASSIFICATION_METADATA = exports.Classified = exports.Public = exports.SHIELD_RECORD_AUTHORIZATION = exports.SHIELD_DECISION_AUTHORITY = exports.ShieldModule = exports.actionsOf = exports.actionsFor = exports.SERVICE_ACCOUNT_ACTIONS = exports.RECORD_SHARE_ACTIONS = exports.CROSS_TENANT_GRANT_ACTIONS = exports.IDENTITY_ACTIONS = exports.MODULE_KEY = exports.buildIdentityModuleRegistry = exports.guardMigrationsDir = void 0;
|
|
20
20
|
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 = 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.RedisRecentRotationStore = exports.SHIELD_HOT_SESSION_STORE = exports.RedisHotSessionStore = exports.SHIELD_SESSION_RECORD_STORE = exports.MariaDbSessionRecordStore = exports.DEFAULT_OBJECT_STORAGE_MAX_BYTES = exports.loadObjectStorageConfig = exports.SHIELD_FILE_INGEST = exports.SHIELD_OBJECT_STORE = exports.FILE_INTAKE_DEFAULT_MAX_BYTES = exports.FILE_INTAKE_REQUEST_KEY = exports.FileIntake = exports.ObjectStoreBootCheck = exports.loadAuditSealConfig = exports.NodeSha256Hash = exports.NodeSha256Digest = exports.S3ObjectStore = void 0;
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.ScopeUnknownParentError = exports.ScopeDepthError = exports.ScopeCycleError = exports.buildClosureRows = exports.ConfirmEmailController = 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 = void 0;
|
|
21
|
+
exports.mariadbSslOption = exports.reservedOperationPrincipal = exports.RESERVED_OPERATION_PRINCIPALS = exports.assertNoReservedRootId = exports.ORG_BOOTSTRAP_PRINCIPAL_ID = exports.rootIdsFromEnv = exports.loadPoolTuning = exports.loadDbTlsConfig = exports.isDevOrTestNodeEnv = exports.DEFAULT_LOGIN_IP_LIMIT = exports.loadRefreshReplayWindowMs = 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.frameworkSchemasOf = exports.FRAMEWORK_SCHEMAS = exports.APP_CONFIG = exports.resolveMigrationLedgerCheck = exports.resolveMigrationLedger = exports.frameworkMigrationIds = exports.assertFrameworkMigrationsApplied = exports.SHIELD_MIGRATION_LEDGER_REGISTRY = exports.MigrationLedgerRegistry = exports.FrameworkMigrationLedgerCheck = exports.frameworkDatabasesLogLine = 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 = void 0;
|
|
22
|
+
exports.SHIELD_SESSION_FACTS_PROJECTOR = exports.ProfileNameTakenError = exports.maskPhone = exports.MAX_MESSAGE_SEND_TIMEOUT_MS = exports.DEFAULT_MESSAGE_SEND_TIMEOUT_MS = exports.EMAIL_PROVIDER_VALUES = exports.loadMessageConfig = exports.MariaDbEmailAddressChanger = exports.maskEmail = exports.isEmailShaped = exports.canonicalEmail = exports.hmacSha1 = exports.resolveTotpVerifier = exports.makeDefaultTotpVerifier = exports.AuthModule = exports.SHIELD_CAPTCHA_GATE = exports.RECAPTCHA_SITEVERIFY_URL = exports.RecaptchaVerifier = exports.TURNSTILE_SITEVERIFY_URL = exports.TurnstileVerifier = exports.MAX_CAPTCHA_TIMEOUT_MS = exports.DEFAULT_CAPTCHA_TIMEOUT_MS = exports.DEFAULT_CAPTCHA_MIN_SCORE = exports.DEFAULT_CAPTCHA_THRESHOLD = exports.CAPTCHA_FAIL_MODES = exports.CAPTCHA_MODES = exports.CAPTCHA_ENDPOINTS = exports.loadCaptchaConfig = exports.SHIELD_SIGN_IN_WITH = exports.DEFAULT_SIGN_IN_WITH = exports.resolveSignInWith = 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_MESSAGE_DISPATCHER = exports.SHIELD_EMAIL_SENDER = exports.SHIELD_EMAIL_CHANGE_TOKEN_STORE = 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.withoutStatementTimeout = exports.mariadbPoolTuningOptions = void 0;
|
|
23
|
+
exports.ScopeUnknownParentError = exports.ScopeDepthError = exports.ScopeCycleError = exports.buildClosureRows = exports.ConfirmEmailController = 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 = void 0;
|
|
24
24
|
// Framework authz migrations (shield_authz DDL — permission / role_permission /
|
|
25
25
|
// authz_permission_version). Absolute path a consumer's `@astram/migrate` setup merges in.
|
|
26
26
|
var migrations_dir_js_1 = require("./migrations-dir.js");
|
|
@@ -376,6 +376,9 @@ Object.defineProperty(exports, "DEFAULT_LOGIN_IP_LIMIT", { enumerable: true, get
|
|
|
376
376
|
Object.defineProperty(exports, "isDevOrTestNodeEnv", { enumerable: true, get: function () { return app_config_js_2.isDevOrTestNodeEnv; } });
|
|
377
377
|
// Phase 16 (additive): TLS to MariaDB (APP_DB_TLS / APP_DB_TLS_CA).
|
|
378
378
|
Object.defineProperty(exports, "loadDbTlsConfig", { enumerable: true, get: function () { return app_config_js_2.loadDbTlsConfig; } });
|
|
379
|
+
// G-026 (additive): pool idle and timeout settings (POOL_MIN_IDLE, POOL_IDLE_TIMEOUT_S,
|
|
380
|
+
// APP_DB_QUERY_TIMEOUT_MS, POOL_LEAK_DETECTION_MS); identity's pools read them through this.
|
|
381
|
+
Object.defineProperty(exports, "loadPoolTuning", { enumerable: true, get: function () { return app_config_js_2.loadPoolTuning; } });
|
|
379
382
|
// G-009 R9: platform-root ids from `SHIELD_ROOT_IDS` (strict canonical uuids, fail closed).
|
|
380
383
|
var root_ids_from_env_js_1 = require("./config/root-ids-from-env.js");
|
|
381
384
|
Object.defineProperty(exports, "rootIdsFromEnv", { enumerable: true, get: function () { return root_ids_from_env_js_1.rootIdsFromEnv; } });
|
|
@@ -388,6 +391,11 @@ Object.defineProperty(exports, "reservedOperationPrincipal", { enumerable: true,
|
|
|
388
391
|
// Phase 16: the driver `ssl` option every framework pool uses (identity's pools build on it).
|
|
389
392
|
var connections_js_1 = require("./auth/connections.js");
|
|
390
393
|
Object.defineProperty(exports, "mariadbSslOption", { enumerable: true, get: function () { return connections_js_1.mariadbSslOption; } });
|
|
394
|
+
// G-026: the pool tuning options every framework pool spreads, and the per-statement opt-out of
|
|
395
|
+
// the query timeout for fixed framework lock waits.
|
|
396
|
+
var connections_js_2 = require("./auth/connections.js");
|
|
397
|
+
Object.defineProperty(exports, "mariadbPoolTuningOptions", { enumerable: true, get: function () { return connections_js_2.mariadbPoolTuningOptions; } });
|
|
398
|
+
Object.defineProperty(exports, "withoutStatementTimeout", { enumerable: true, get: function () { return connections_js_2.withoutStatementTimeout; } });
|
|
391
399
|
// ---------------------------------------------------------------------------
|
|
392
400
|
// Phase 0b Auth surface (framework-owned login → session, spec §2/§3/§4).
|
|
393
401
|
//
|
package/dist/internal.d.ts
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { PersistenceModule } from './auth/persistence.module.js';
|
|
11
11
|
export { SHIELD_DB_POOL } from './auth/tokens.js';
|
|
12
|
+
/**
|
|
13
|
+
* Test surface only (G-026 spec 5.D): the audit sealer's own pool token. `PersistenceModule` does
|
|
14
|
+
* not export it (only the sealer injects it); a spec that stubs `SHIELD_DB_POOL` overrides this
|
|
15
|
+
* one too, else a real one-connection pool is opened for the sealer.
|
|
16
|
+
*/
|
|
17
|
+
export { SHIELD_AUDIT_SEALER_POOL } from './auth/tokens.js';
|
|
12
18
|
export { MariaDbCredentialProvisioner } from './authentication/mariadb-credential-provisioner.js';
|
|
13
19
|
/**
|
|
14
20
|
* For `@astram/identity`'s invite rate limits only (G-010, spec P-5), not app use: guard's
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,iBAAiB,EAAE,M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AIG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG;;;;;GAKG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE;;;GAGG;AACH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE;;;GAGG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,sGAAsG;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D;;;;GAIG;AACH,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,0CAA0C,CAAC;AAClD,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,sCAAsC,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MariaDbMfaResetter = exports.accountUnlockKeys = exports.AdminControlUnavailableError = exports.SHIELD_ACCOUNT_UNLOCKER = exports.SHIELD_ADMIN_STEP_UP = exports.SHIELD_MFA_REQUIREMENT_SOURCE = exports.SHIELD_MFA_REQUIREMENT = exports.SHIELD_MFA_POLICY_FEATURE = exports.SHIELD_DEFAULT_AUTH_AUDIT_SINK = exports.SHIELD_ATTEMPT_LIMITER_FACTORY = exports.SHIELD_REDIS = exports.AttemptLimiter = exports.MariaDbCredentialProvisioner = exports.SHIELD_DB_POOL = exports.PersistenceModule = void 0;
|
|
3
|
+
exports.MariaDbMfaResetter = exports.accountUnlockKeys = exports.AdminControlUnavailableError = exports.SHIELD_ACCOUNT_UNLOCKER = exports.SHIELD_ADMIN_STEP_UP = exports.SHIELD_MFA_REQUIREMENT_SOURCE = exports.SHIELD_MFA_REQUIREMENT = exports.SHIELD_MFA_POLICY_FEATURE = exports.SHIELD_DEFAULT_AUTH_AUDIT_SINK = exports.SHIELD_ATTEMPT_LIMITER_FACTORY = exports.SHIELD_REDIS = exports.AttemptLimiter = exports.MariaDbCredentialProvisioner = exports.SHIELD_AUDIT_SEALER_POOL = exports.SHIELD_DB_POOL = exports.PersistenceModule = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @astram/guard/internal — framework-composition and test surface (Phase 8 #5).
|
|
6
6
|
*
|
|
@@ -14,6 +14,13 @@ var persistence_module_js_1 = require("./auth/persistence.module.js");
|
|
|
14
14
|
Object.defineProperty(exports, "PersistenceModule", { enumerable: true, get: function () { return persistence_module_js_1.PersistenceModule; } });
|
|
15
15
|
var tokens_js_1 = require("./auth/tokens.js");
|
|
16
16
|
Object.defineProperty(exports, "SHIELD_DB_POOL", { enumerable: true, get: function () { return tokens_js_1.SHIELD_DB_POOL; } });
|
|
17
|
+
/**
|
|
18
|
+
* Test surface only (G-026 spec 5.D): the audit sealer's own pool token. `PersistenceModule` does
|
|
19
|
+
* not export it (only the sealer injects it); a spec that stubs `SHIELD_DB_POOL` overrides this
|
|
20
|
+
* one too, else a real one-connection pool is opened for the sealer.
|
|
21
|
+
*/
|
|
22
|
+
var tokens_js_2 = require("./auth/tokens.js");
|
|
23
|
+
Object.defineProperty(exports, "SHIELD_AUDIT_SEALER_POOL", { enumerable: true, get: function () { return tokens_js_2.SHIELD_AUDIT_SEALER_POOL; } });
|
|
17
24
|
var mariadb_credential_provisioner_js_1 = require("./authentication/mariadb-credential-provisioner.js");
|
|
18
25
|
Object.defineProperty(exports, "MariaDbCredentialProvisioner", { enumerable: true, get: function () { return mariadb_credential_provisioner_js_1.MariaDbCredentialProvisioner; } });
|
|
19
26
|
/**
|
|
@@ -24,40 +31,40 @@ Object.defineProperty(exports, "MariaDbCredentialProvisioner", { enumerable: tru
|
|
|
24
31
|
*/
|
|
25
32
|
var attempt_limiter_js_1 = require("./auth/rate-limit/attempt-limiter.js");
|
|
26
33
|
Object.defineProperty(exports, "AttemptLimiter", { enumerable: true, get: function () { return attempt_limiter_js_1.AttemptLimiter; } });
|
|
27
|
-
var tokens_js_2 = require("./auth/tokens.js");
|
|
28
|
-
Object.defineProperty(exports, "SHIELD_REDIS", { enumerable: true, get: function () { return tokens_js_2.SHIELD_REDIS; } });
|
|
29
34
|
var tokens_js_3 = require("./auth/tokens.js");
|
|
30
|
-
Object.defineProperty(exports, "
|
|
35
|
+
Object.defineProperty(exports, "SHIELD_REDIS", { enumerable: true, get: function () { return tokens_js_3.SHIELD_REDIS; } });
|
|
36
|
+
var tokens_js_4 = require("./auth/tokens.js");
|
|
37
|
+
Object.defineProperty(exports, "SHIELD_ATTEMPT_LIMITER_FACTORY", { enumerable: true, get: function () { return tokens_js_4.SHIELD_ATTEMPT_LIMITER_FACTORY; } });
|
|
31
38
|
/**
|
|
32
39
|
* For `@astram/identity` only (R12.1, B-3): the token identity binds its default auth audit sink
|
|
33
40
|
* under, so guard's auth surface records to `audit_log` when the app supplies no `auditSink`.
|
|
34
41
|
*/
|
|
35
|
-
var
|
|
36
|
-
Object.defineProperty(exports, "SHIELD_DEFAULT_AUTH_AUDIT_SINK", { enumerable: true, get: function () { return
|
|
42
|
+
var tokens_js_5 = require("./auth/tokens.js");
|
|
43
|
+
Object.defineProperty(exports, "SHIELD_DEFAULT_AUTH_AUDIT_SINK", { enumerable: true, get: function () { return tokens_js_5.SHIELD_DEFAULT_AUTH_AUDIT_SINK; } });
|
|
37
44
|
/**
|
|
38
45
|
* For `@astram/identity` only (auth capabilities R2): the token identity binds `true` when its
|
|
39
46
|
* security-policy feature is registered, which turns guard's mandatory-2FA evaluation on.
|
|
40
47
|
*/
|
|
41
|
-
var tokens_js_5 = require("./auth/tokens.js");
|
|
42
|
-
Object.defineProperty(exports, "SHIELD_MFA_POLICY_FEATURE", { enumerable: true, get: function () { return tokens_js_5.SHIELD_MFA_POLICY_FEATURE; } });
|
|
43
|
-
/** Test surface (auth capabilities R2): the guard's mandatory-2FA service token (`null` when off). */
|
|
44
48
|
var tokens_js_6 = require("./auth/tokens.js");
|
|
45
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "SHIELD_MFA_POLICY_FEATURE", { enumerable: true, get: function () { return tokens_js_6.SHIELD_MFA_POLICY_FEATURE; } });
|
|
50
|
+
/** Test surface (auth capabilities R2): the guard's mandatory-2FA service token (`null` when off). */
|
|
51
|
+
var tokens_js_7 = require("./auth/tokens.js");
|
|
52
|
+
Object.defineProperty(exports, "SHIELD_MFA_REQUIREMENT", { enumerable: true, get: function () { return tokens_js_7.SHIELD_MFA_REQUIREMENT; } });
|
|
46
53
|
/**
|
|
47
54
|
* For `@astram/identity` only (auth capabilities R11.3): the guard's MariaDB mandatory-2FA source
|
|
48
55
|
* token; identity's users list falls back to its batched confirmed-device read when the policy
|
|
49
56
|
* feature is off.
|
|
50
57
|
*/
|
|
51
|
-
var
|
|
52
|
-
Object.defineProperty(exports, "SHIELD_MFA_REQUIREMENT_SOURCE", { enumerable: true, get: function () { return
|
|
58
|
+
var tokens_js_8 = require("./auth/tokens.js");
|
|
59
|
+
Object.defineProperty(exports, "SHIELD_MFA_REQUIREMENT_SOURCE", { enumerable: true, get: function () { return tokens_js_8.SHIELD_MFA_REQUIREMENT_SOURCE; } });
|
|
53
60
|
/**
|
|
54
61
|
* For `@astram/identity` only (auth capabilities R11, B-5): the admin sign-in controls. The step-up
|
|
55
62
|
* (the admin's own TOTP on their `mfa:pid` budget), the account unlocker (login, MFA, recovery and
|
|
56
63
|
* CAPTCHA account counters) and the MFA resetter identity builds over its runtime pool.
|
|
57
64
|
*/
|
|
58
|
-
var
|
|
59
|
-
Object.defineProperty(exports, "SHIELD_ADMIN_STEP_UP", { enumerable: true, get: function () { return
|
|
60
|
-
Object.defineProperty(exports, "SHIELD_ACCOUNT_UNLOCKER", { enumerable: true, get: function () { return
|
|
65
|
+
var tokens_js_9 = require("./auth/tokens.js");
|
|
66
|
+
Object.defineProperty(exports, "SHIELD_ADMIN_STEP_UP", { enumerable: true, get: function () { return tokens_js_9.SHIELD_ADMIN_STEP_UP; } });
|
|
67
|
+
Object.defineProperty(exports, "SHIELD_ACCOUNT_UNLOCKER", { enumerable: true, get: function () { return tokens_js_9.SHIELD_ACCOUNT_UNLOCKER; } });
|
|
61
68
|
var admin_signin_controls_js_1 = require("./auth/admin-signin-controls.js");
|
|
62
69
|
Object.defineProperty(exports, "AdminControlUnavailableError", { enumerable: true, get: function () { return admin_signin_controls_js_1.AdminControlUnavailableError; } });
|
|
63
70
|
Object.defineProperty(exports, "accountUnlockKeys", { enumerable: true, get: function () { return admin_signin_controls_js_1.accountUnlockKeys; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astram/guard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Astram framework — the enforcement guard + real-world adapters (the 'hands'). One global deny-by-default gate every request passes through (ADR-0002), classification decorators, boot-pool assertion (ADR-0018), the forRoot() registration seam, and the DB/Redis/crypto adapters that connect the sealed core to a real backend. Depends on @astram/core (ADR-0003, ADR-0023).",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"argon2": "^0.41.1",
|
|
37
37
|
"ioredis": "^5.4.1",
|
|
38
38
|
"mariadb": "^3.5.4",
|
|
39
|
-
"@astram/
|
|
40
|
-
"@astram/
|
|
39
|
+
"@astram/engine": "0.15.0",
|
|
40
|
+
"@astram/core": "1.12.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@nestjs/common": "^11",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@nestjs/platform-express": "^11",
|
|
46
46
|
"reflect-metadata": "^0.2",
|
|
47
47
|
"rxjs": "^7",
|
|
48
|
-
"@astram/messaging": "^0.1.
|
|
48
|
+
"@astram/messaging": "^0.1.7"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"@astram/messaging": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"typescript": "^5.7.0",
|
|
69
69
|
"unplugin-swc": "^1.5.1",
|
|
70
70
|
"vitest": "^2.1.8",
|
|
71
|
-
"@astram/messaging": "0.1.
|
|
71
|
+
"@astram/messaging": "0.1.7"
|
|
72
72
|
},
|
|
73
73
|
"repository": {
|
|
74
74
|
"type": "git",
|