@astram/guard 0.14.0 → 0.15.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/auth.module.d.ts.map +1 -1
- package/dist/auth/auth.module.js +57 -30
- package/dist/authentication/mariadb-api-key-store.d.ts +10 -1
- package/dist/authentication/mariadb-api-key-store.d.ts.map +1 -1
- package/dist/authentication/mariadb-api-key-store.js +20 -10
- package/dist/authentication/mariadb-credential-resolver.d.ts +8 -1
- package/dist/authentication/mariadb-credential-resolver.d.ts.map +1 -1
- package/dist/authentication/mariadb-credential-resolver.js +15 -5
- package/dist/authentication/mariadb-credential-writer.d.ts +6 -1
- package/dist/authentication/mariadb-credential-writer.d.ts.map +1 -1
- package/dist/authentication/mariadb-credential-writer.js +9 -3
- package/dist/authentication/mariadb-email-address-changer.d.ts +10 -1
- package/dist/authentication/mariadb-email-address-changer.d.ts.map +1 -1
- package/dist/authentication/mariadb-email-address-changer.js +22 -9
- package/dist/authentication/mariadb-email-change-token-store.d.ts +8 -1
- package/dist/authentication/mariadb-email-change-token-store.d.ts.map +1 -1
- package/dist/authentication/mariadb-email-change-token-store.js +18 -9
- package/dist/authentication/mariadb-mfa-device-store.d.ts +6 -1
- package/dist/authentication/mariadb-mfa-device-store.d.ts.map +1 -1
- package/dist/authentication/mariadb-mfa-device-store.js +22 -13
- package/dist/authentication/mariadb-profile-resolver.d.ts +6 -1
- package/dist/authentication/mariadb-profile-resolver.d.ts.map +1 -1
- package/dist/authentication/mariadb-profile-resolver.js +12 -6
- package/dist/authentication/mariadb-profile-writer.d.ts +6 -1
- package/dist/authentication/mariadb-profile-writer.d.ts.map +1 -1
- package/dist/authentication/mariadb-profile-writer.js +11 -4
- package/dist/authentication/mariadb-recovery-code-store.d.ts +6 -1
- package/dist/authentication/mariadb-recovery-code-store.d.ts.map +1 -1
- package/dist/authentication/mariadb-recovery-code-store.js +11 -5
- package/dist/authentication/mariadb-reset-token-store.d.ts +6 -1
- package/dist/authentication/mariadb-reset-token-store.d.ts.map +1 -1
- package/dist/authentication/mariadb-reset-token-store.js +11 -5
- package/dist/authentication/mariadb-session-sweeper.d.ts +6 -1
- package/dist/authentication/mariadb-session-sweeper.d.ts.map +1 -1
- package/dist/authentication/mariadb-session-sweeper.js +11 -5
- package/dist/authz/cross-tenant-grant-writer.d.ts.map +1 -1
- package/dist/authz/cross-tenant-grant-writer.js +4 -3
- package/dist/authz/list-scope-sql.d.ts +10 -2
- package/dist/authz/list-scope-sql.d.ts.map +1 -1
- package/dist/authz/list-scope-sql.js +4 -4
- package/dist/authz/mariadb-cross-tenant-grant-adapter.d.ts.map +1 -1
- package/dist/authz/mariadb-cross-tenant-grant-adapter.js +4 -3
- package/dist/authz/mariadb-list-scope-adapter.d.ts.map +1 -1
- package/dist/authz/mariadb-list-scope-adapter.js +4 -3
- package/dist/authz/mariadb-policy-store.d.ts.map +1 -1
- package/dist/authz/mariadb-policy-store.js +4 -3
- package/dist/authz/mariadb-record-rule-adapter.d.ts.map +1 -1
- package/dist/authz/mariadb-record-rule-adapter.js +4 -3
- package/dist/authz/mariadb-record-share-adapter.d.ts.map +1 -1
- package/dist/authz/mariadb-record-share-adapter.js +4 -3
- package/dist/authz/record-share-cascade.d.ts.map +1 -1
- package/dist/authz/record-share-cascade.js +4 -3
- package/dist/authz/record-share-writer.d.ts.map +1 -1
- package/dist/authz/record-share-writer.js +4 -3
- package/dist/authz/wire-record-authorization.d.ts +8 -0
- package/dist/authz/wire-record-authorization.d.ts.map +1 -1
- package/dist/authz/wire-record-authorization.js +14 -6
- package/dist/boot/boot-sequence.d.ts +4 -0
- package/dist/boot/boot-sequence.d.ts.map +1 -1
- package/dist/boot/boot-sequence.js +13 -1
- package/dist/boot/migration-ledger-check.d.ts +94 -0
- package/dist/boot/migration-ledger-check.d.ts.map +1 -0
- package/dist/boot/migration-ledger-check.js +280 -0
- package/dist/config/app-config.d.ts +29 -3
- package/dist/config/app-config.d.ts.map +1 -1
- package/dist/config/app-config.js +37 -6
- package/dist/config/config.module.d.ts +7 -0
- package/dist/config/config.module.d.ts.map +1 -1
- package/dist/config/config.module.js +8 -1
- package/dist/config/framework-schema-names.d.ts +29 -0
- package/dist/config/framework-schema-names.d.ts.map +1 -0
- package/dist/config/framework-schema-names.js +41 -0
- package/dist/identity/permission-facts.adapter.d.ts +7 -1
- package/dist/identity/permission-facts.adapter.d.ts.map +1 -1
- package/dist/identity/permission-facts.adapter.js +15 -6
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -2
- package/dist/module/shield.module.d.ts.map +1 -1
- package/dist/module/shield.module.js +43 -7
- package/dist/session/mariadb-session-record-store.d.ts +8 -1
- package/dist/session/mariadb-session-record-store.d.ts.map +1 -1
- package/dist/session/mariadb-session-record-store.js +23 -13
- package/dist/session/session-restriction-store.d.ts +8 -1
- package/dist/session/session-restriction-store.d.ts.map +1 -1
- package/dist/session/session-restriction-store.js +15 -5
- package/migrations/1710000000006-CreateAuthzSchema.cjs +15 -4
- package/migrations/1710000000007-ExtendPermissionAndRolePermission.cjs +11 -3
- package/migrations/1710000000008-CreateAccessBundleTables.cjs +14 -4
- package/migrations/1710000000009-CreateRecordPermissionRule.cjs +15 -4
- package/migrations/1710000000014-CreateRecordShare.cjs +15 -4
- package/migrations/1710000000015-CreateScopeClosure.cjs +14 -4
- package/migrations/1710000000016-AlterCompanyParentFkRestrict.cjs +20 -9
- package/migrations/1710000000017-CreateServiceAccountKey.cjs +14 -4
- package/package.json +3 -3
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MariaDbPermissionFactsAdapter = exports.AuthorizationUnavailableError = void 0;
|
|
13
|
+
const framework_schema_names_js_1 = require("../config/framework-schema-names.js");
|
|
13
14
|
/** A store/dependency outage while computing facts — the controller maps this to 503. */
|
|
14
15
|
class AuthorizationUnavailableError extends Error {
|
|
15
16
|
constructor(message = 'authorization_unavailable') {
|
|
@@ -23,11 +24,19 @@ class MariaDbPermissionFactsAdapter {
|
|
|
23
24
|
listActions;
|
|
24
25
|
controlPlaneKeys;
|
|
25
26
|
now;
|
|
26
|
-
|
|
27
|
+
/** The org (`<app>`) and authorization (`<authz>`) databases, resolved at construction. */
|
|
28
|
+
app;
|
|
29
|
+
authz;
|
|
30
|
+
constructor(pool, listActions, controlPlaneKeys, now = Date.now,
|
|
31
|
+
/** Framework database names; absent ⇒ resolved from `SHIELD_DB_NAMESPACE` here, once. */
|
|
32
|
+
schemas) {
|
|
27
33
|
this.pool = pool;
|
|
28
34
|
this.listActions = listActions;
|
|
29
35
|
this.controlPlaneKeys = controlPlaneKeys;
|
|
30
36
|
this.now = now;
|
|
37
|
+
const s = (0, framework_schema_names_js_1.schemaNamesAtConstruction)(schemas);
|
|
38
|
+
this.app = s.app;
|
|
39
|
+
this.authz = s.authz;
|
|
31
40
|
}
|
|
32
41
|
async projectFor(principalId, tenantId, isRoot) {
|
|
33
42
|
try {
|
|
@@ -62,9 +71,9 @@ class MariaDbPermissionFactsAdapter {
|
|
|
62
71
|
async readRoleIdsForTenant(userUuid, companyUuid) {
|
|
63
72
|
const nowMs = this.now();
|
|
64
73
|
const rows = (await this.pool.query(`SELECT DISTINCT mp.mp_role_uuid AS role_uuid
|
|
65
|
-
FROM
|
|
66
|
-
JOIN
|
|
67
|
-
JOIN
|
|
74
|
+
FROM \`${this.app}\`.\`company_membership\` cm
|
|
75
|
+
JOIN \`${this.app}\`.\`users\` u ON u.u_uuid = cm.cm_user_uuid AND u.u_status = 'active'
|
|
76
|
+
JOIN \`${this.app}\`.\`membership_posting\` mp ON mp.mp_membership_uuid = cm.cm_uuid
|
|
68
77
|
WHERE cm.cm_user_uuid = ? AND cm.cm_company_uuid = ? AND cm.cm_is_active = 1
|
|
69
78
|
AND (mp.mp_effective_from_ms IS NULL OR mp.mp_effective_from_ms <= ?)
|
|
70
79
|
AND (mp.mp_effective_until_ms IS NULL OR mp.mp_effective_until_ms > ?)`, [userUuid, companyUuid, nowMs, nowMs]));
|
|
@@ -72,11 +81,11 @@ class MariaDbPermissionFactsAdapter {
|
|
|
72
81
|
}
|
|
73
82
|
async readGrantKeys(roleIds) {
|
|
74
83
|
const placeholders = roleIds.map(() => '?').join(', ');
|
|
75
|
-
const rows = (await this.pool.query(`SELECT rp_perm_key FROM
|
|
84
|
+
const rows = (await this.pool.query(`SELECT rp_perm_key FROM \`${this.authz}\`.\`role_permission\` WHERE rp_role_uuid IN (${placeholders})`, [...roleIds]));
|
|
76
85
|
return rows.map((r) => r.rp_perm_key);
|
|
77
86
|
}
|
|
78
87
|
async readVersion(tenantId) {
|
|
79
|
-
const rows = (await this.pool.query(
|
|
88
|
+
const rows = (await this.pool.query(`SELECT apv_version FROM \`${this.authz}\`.\`authz_permission_version\` WHERE apv_tenant_uuid = ? LIMIT 1`, [tenantId]));
|
|
80
89
|
return rows[0] !== undefined ? Number(rows[0].apv_version) : 0;
|
|
81
90
|
}
|
|
82
91
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -61,9 +61,12 @@ export { SHIELD_PERMISSION_VERSION_CACHE } from './auth/tokens.js';
|
|
|
61
61
|
export { SHIELD_SESSION_RESTRICTIONS } from './auth/tokens.js';
|
|
62
62
|
export { MariaDbSessionRestrictionStore, type SessionRestrictionStore, type SessionRebuildFacts, } from './session/session-restriction-store.js';
|
|
63
63
|
export { buildListScopeFn, type ListScopeFn } from './authz/wire-record-authorization.js';
|
|
64
|
-
export { BootSequence, assertPoolBudget } from './boot/boot-sequence.js';
|
|
64
|
+
export { BootSequence, assertPoolBudget, frameworkDatabasesLogLine } from './boot/boot-sequence.js';
|
|
65
|
+
export { FrameworkMigrationLedgerCheck, MigrationLedgerRegistry, SHIELD_MIGRATION_LEDGER_REGISTRY, assertFrameworkMigrationsApplied, frameworkMigrationIds, resolveMigrationLedger, resolveMigrationLedgerCheck, type MigrationLedgerCheckLocation, type FrameworkMigrationsCheckOptions, type FrameworkMigrationsCheckResult, type LedgerCheckLogger, type LedgerQuery, type MigrationLedgerLocation, } from './boot/migration-ledger-check.js';
|
|
65
66
|
export { APP_CONFIG } from './config/config.module.js';
|
|
66
|
-
export {
|
|
67
|
+
export { FRAMEWORK_SCHEMAS } from './config/config.module.js';
|
|
68
|
+
export type { FrameworkSchemaNames } from './config/framework-schema-names.js';
|
|
69
|
+
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';
|
|
67
70
|
export { mariadbSslOption } from './auth/connections.js';
|
|
68
71
|
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_RECOVERY_CODE_STORE, SHIELD_PROFILE_WRITER, SHIELD_SESSION_SWEEPER, SHIELD_AUDIT_SINK, SHIELD_MFA_DEVICE_STORE, SHIELD_TOTP_VERIFIER_OVERRIDE, } from './auth/tokens.js';
|
|
69
72
|
export { MariaDbCredentialResolver } from './authentication/mariadb-credential-resolver.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":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BAAkB,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;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAQ5E,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,8 +18,8 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.FileIntake = exports.ObjectStoreBootCheck = exports.NodeSha256Digest = exports.S3ObjectStore = exports.wasResolvedFromSecretRef = exports.assertNoUnresolvedSecretRefs = exports.createSecretsProviderFromEnv = exports.resolveBootSecrets = 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.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.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 = 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 = void 0;
|
|
21
|
-
exports.
|
|
22
|
-
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 = exports.SHIELD_SESSION_FACTS_PROJECTOR = exports.ProfileNameTakenError = exports.MariaDbEmailAddressChanger = exports.maskEmail = void 0;
|
|
21
|
+
exports.SHIELD_SESSION_SWEEPER = exports.SHIELD_PROFILE_WRITER = exports.SHIELD_RECOVERY_CODE_STORE = 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.mariadbSslOption = 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 = void 0;
|
|
22
|
+
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 = exports.SHIELD_SESSION_FACTS_PROJECTOR = exports.ProfileNameTakenError = exports.MariaDbEmailAddressChanger = exports.maskEmail = exports.isEmailShaped = exports.canonicalEmail = exports.hmacSha1 = exports.resolveTotpVerifier = exports.makeDefaultTotpVerifier = exports.AuthModule = exports.MariaDbCredentialResolver = exports.SHIELD_TOTP_VERIFIER_OVERRIDE = exports.SHIELD_MFA_DEVICE_STORE = exports.SHIELD_AUDIT_SINK = void 0;
|
|
23
23
|
// Framework authz migrations (shield_authz DDL — permission / role_permission /
|
|
24
24
|
// authz_permission_version). Absolute path a consumer's `@astram/migrate` setup merges in.
|
|
25
25
|
var migrations_dir_js_1 = require("./migrations-dir.js");
|
|
@@ -317,6 +317,17 @@ Object.defineProperty(exports, "buildListScopeFn", { enumerable: true, get: func
|
|
|
317
317
|
var boot_sequence_js_1 = require("./boot/boot-sequence.js");
|
|
318
318
|
Object.defineProperty(exports, "BootSequence", { enumerable: true, get: function () { return boot_sequence_js_1.BootSequence; } });
|
|
319
319
|
Object.defineProperty(exports, "assertPoolBudget", { enumerable: true, get: function () { return boot_sequence_js_1.assertPoolBudget; } });
|
|
320
|
+
Object.defineProperty(exports, "frameworkDatabasesLogLine", { enumerable: true, get: function () { return boot_sequence_js_1.frameworkDatabasesLogLine; } });
|
|
321
|
+
// configurable-framework-db spec 5.D: the boot-time migration ledger check. Guard runs it for its
|
|
322
|
+
// own migrations; `@astram/identity` runs the same helper for its own (ADR-0003).
|
|
323
|
+
var migration_ledger_check_js_1 = require("./boot/migration-ledger-check.js");
|
|
324
|
+
Object.defineProperty(exports, "FrameworkMigrationLedgerCheck", { enumerable: true, get: function () { return migration_ledger_check_js_1.FrameworkMigrationLedgerCheck; } });
|
|
325
|
+
Object.defineProperty(exports, "MigrationLedgerRegistry", { enumerable: true, get: function () { return migration_ledger_check_js_1.MigrationLedgerRegistry; } });
|
|
326
|
+
Object.defineProperty(exports, "SHIELD_MIGRATION_LEDGER_REGISTRY", { enumerable: true, get: function () { return migration_ledger_check_js_1.SHIELD_MIGRATION_LEDGER_REGISTRY; } });
|
|
327
|
+
Object.defineProperty(exports, "assertFrameworkMigrationsApplied", { enumerable: true, get: function () { return migration_ledger_check_js_1.assertFrameworkMigrationsApplied; } });
|
|
328
|
+
Object.defineProperty(exports, "frameworkMigrationIds", { enumerable: true, get: function () { return migration_ledger_check_js_1.frameworkMigrationIds; } });
|
|
329
|
+
Object.defineProperty(exports, "resolveMigrationLedger", { enumerable: true, get: function () { return migration_ledger_check_js_1.resolveMigrationLedger; } });
|
|
330
|
+
Object.defineProperty(exports, "resolveMigrationLedgerCheck", { enumerable: true, get: function () { return migration_ledger_check_js_1.resolveMigrationLedgerCheck; } });
|
|
320
331
|
// Application config surface (port / environment / ADR-0018 pool budget). The
|
|
321
332
|
// consumer skeleton reads `loadAppConfig()` for its HTTP port; the boot assertion
|
|
322
333
|
// validates the pool budget. The `APP_CONFIG` DI token is exported; `ConfigModule`
|
|
@@ -324,7 +335,12 @@ Object.defineProperty(exports, "assertPoolBudget", { enumerable: true, get: func
|
|
|
324
335
|
// the one seam can honor caller-supplied config.
|
|
325
336
|
var config_module_js_1 = require("./config/config.module.js");
|
|
326
337
|
Object.defineProperty(exports, "APP_CONFIG", { enumerable: true, get: function () { return config_module_js_1.APP_CONFIG; } });
|
|
338
|
+
// configurable-framework-db (ADR-0037): the resolved framework database names, provided
|
|
339
|
+
// app-wide by `ShieldModule`; identity and app modules inject it instead of `shield_*` literals.
|
|
340
|
+
var config_module_js_2 = require("./config/config.module.js");
|
|
341
|
+
Object.defineProperty(exports, "FRAMEWORK_SCHEMAS", { enumerable: true, get: function () { return config_module_js_2.FRAMEWORK_SCHEMAS; } });
|
|
327
342
|
var app_config_js_2 = require("./config/app-config.js");
|
|
343
|
+
Object.defineProperty(exports, "frameworkSchemasOf", { enumerable: true, get: function () { return app_config_js_2.frameworkSchemasOf; } });
|
|
328
344
|
Object.defineProperty(exports, "loadAppConfig", { enumerable: true, get: function () { return app_config_js_2.loadAppConfig; } });
|
|
329
345
|
Object.defineProperty(exports, "loadPoolBudget", { enumerable: true, get: function () { return app_config_js_2.loadPoolBudget; } });
|
|
330
346
|
Object.defineProperty(exports, "evaluatePoolBudget", { enumerable: true, get: function () { return app_config_js_2.evaluatePoolBudget; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shield.module.d.ts","sourceRoot":"","sources":["../../src/module/shield.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AAOnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"shield.module.d.ts","sourceRoot":"","sources":["../../src/module/shield.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAiB,MAAM,gBAAgB,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Ac,CAAC,EAAE,cAAc,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,cAAc,CAAC;IACvC;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,2FAA2F;IAC3F,QAAQ,CAAC,wBAAwB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtD;;;;;OAKG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IACvD;;;;OAIG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IACrD;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAC/C,+FAA+F;IAC/F,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CACxC;AAYD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAEa,YAAY;IACvB,6DAA6D;IAC7D,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,mBAAwB,GAAG,aAAa;IA+GhE;;;;;;;;;OASG;IACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;CA4HtE"}
|
|
@@ -46,8 +46,27 @@ const node_url_1 = require("node:url");
|
|
|
46
46
|
const core_seam_js_1 = require("../enforcement/core-seam.js");
|
|
47
47
|
const enforcement_module_js_1 = require("../enforcement/enforcement.module.js");
|
|
48
48
|
const boot_module_js_1 = require("../boot/boot.module.js");
|
|
49
|
+
const migration_ledger_check_js_1 = require("../boot/migration-ledger-check.js");
|
|
49
50
|
const config_module_js_1 = require("../config/config.module.js");
|
|
50
51
|
const app_config_js_1 = require("../config/app-config.js");
|
|
52
|
+
/**
|
|
53
|
+
* `FRAMEWORK_SCHEMAS` from `APP_CONFIG` (configurable-framework-db, ADR-0037): resolved once
|
|
54
|
+
* at boot, the same frozen names every framework store and module receives.
|
|
55
|
+
*/
|
|
56
|
+
const frameworkSchemasProvider = {
|
|
57
|
+
provide: config_module_js_1.FRAMEWORK_SCHEMAS,
|
|
58
|
+
useFactory: (config) => (0, app_config_js_1.frameworkSchemasOf)(config),
|
|
59
|
+
inject: [config_module_js_1.APP_CONFIG],
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* configurable-framework-db spec 5.D: one {@link MigrationLedgerRegistry} per application, so
|
|
63
|
+
* guard's (`AuthModule`) and identity's ledger checks share ONE read per ledger location. Holds
|
|
64
|
+
* no connection; an enforcement-only app registers no check and so reads nothing.
|
|
65
|
+
*/
|
|
66
|
+
const migrationLedgerRegistryProvider = {
|
|
67
|
+
provide: migration_ledger_check_js_1.SHIELD_MIGRATION_LEDGER_REGISTRY,
|
|
68
|
+
useFactory: () => new migration_ledger_check_js_1.MigrationLedgerRegistry(),
|
|
69
|
+
};
|
|
51
70
|
const boot_secrets_js_1 = require("../secrets/boot-secrets.js");
|
|
52
71
|
// Static import is SAFE: auth.module.ts top-level-imports @astram/core as TYPES
|
|
53
72
|
// only (it loads core's ESM factory VALUES lazily inside its async provider
|
|
@@ -138,7 +157,10 @@ async function resolveDecisionAuthority(options, extras = {}) {
|
|
|
138
157
|
'supply the record-authorization inputs (pool + app ports + registry) so the framework ' +
|
|
139
158
|
'builds the decision authority, OR a pre-built `decisionAuthority`, but not both.');
|
|
140
159
|
}
|
|
141
|
-
const
|
|
160
|
+
const supplied = provided ?? options.recordAuthorization;
|
|
161
|
+
const recordAuthorization = supplied && supplied.schemas === undefined && extras.schemas !== undefined
|
|
162
|
+
? { ...supplied, schemas: extras.schemas }
|
|
163
|
+
: supplied;
|
|
142
164
|
if (recordAuthorization) {
|
|
143
165
|
const api = await loadBuildRecordAuthorization();
|
|
144
166
|
const versionCache = extras.versionCache ?? undefined;
|
|
@@ -274,18 +296,21 @@ let ShieldModule = ShieldModule_1 = class ShieldModule {
|
|
|
274
296
|
// stub paths resolve synchronously but flow through the same one seam. Both
|
|
275
297
|
// supplied → throws (mutual exclusion).
|
|
276
298
|
provide: shield_tokens_js_1.SHIELD_DECISION_AUTHORITY,
|
|
277
|
-
useFactory: (versionCache, providedRecordAuthorization) => resolveDecisionAuthority({
|
|
299
|
+
useFactory: (schemas, versionCache, providedRecordAuthorization) => resolveDecisionAuthority({
|
|
278
300
|
...(options.recordAuthorization
|
|
279
301
|
? { recordAuthorization: options.recordAuthorization }
|
|
280
302
|
: {}),
|
|
281
303
|
...(options.decisionAuthority
|
|
282
304
|
? { decisionAuthority: options.decisionAuthority }
|
|
283
305
|
: {}),
|
|
284
|
-
}, { versionCache, defaultProjector, providedRecordAuthorization }),
|
|
306
|
+
}, { versionCache, defaultProjector, providedRecordAuthorization, schemas }),
|
|
307
|
+
// R2: the resolved framework names (provided below from APP_CONFIG).
|
|
285
308
|
// ADR-0035: the Redis version cache AuthModule provides under `auth: true`.
|
|
286
309
|
// Phase 9 #7: the record authorization a feature module provides (IdentityFeatureModule).
|
|
287
|
-
inject: [OPTIONAL_VERSION_CACHE, OPTIONAL_RECORD_AUTHORIZATION],
|
|
310
|
+
inject: [config_module_js_1.FRAMEWORK_SCHEMAS, OPTIONAL_VERSION_CACHE, OPTIONAL_RECORD_AUTHORIZATION],
|
|
288
311
|
},
|
|
312
|
+
frameworkSchemasProvider,
|
|
313
|
+
migrationLedgerRegistryProvider,
|
|
289
314
|
...(0, storage_providers_js_1.storageProviders)(options.storage),
|
|
290
315
|
],
|
|
291
316
|
// Re-export the composed AuthModule app-wide ONLY when auth is opted in — its
|
|
@@ -293,7 +318,9 @@ let ShieldModule = ShieldModule_1 = class ShieldModule {
|
|
|
293
318
|
// visible to a consumer's controllers/services via the @Global seam.
|
|
294
319
|
exports: [
|
|
295
320
|
config_module_js_1.APP_CONFIG,
|
|
321
|
+
config_module_js_1.FRAMEWORK_SCHEMAS,
|
|
296
322
|
shield_tokens_js_1.SHIELD_DECISION_AUTHORITY,
|
|
323
|
+
migration_ledger_check_js_1.SHIELD_MIGRATION_LEDGER_REGISTRY,
|
|
297
324
|
...storage_providers_js_1.STORAGE_EXPORTS,
|
|
298
325
|
...(authModule ? [authModule] : []),
|
|
299
326
|
],
|
|
@@ -334,11 +361,16 @@ let ShieldModule = ShieldModule_1 = class ShieldModule {
|
|
|
334
361
|
// in its useFactory from the injected registrations) has the framework build the
|
|
335
362
|
// real wired authority; `decisionAuthority` is the legacy passthrough; both →
|
|
336
363
|
// throws; neither → stub. Async because the record path lazy-loads the builder.
|
|
337
|
-
useFactory: (opts, versionCache, providedRecordAuthorization) => resolveDecisionAuthority({
|
|
364
|
+
useFactory: (opts, schemas, versionCache, providedRecordAuthorization) => resolveDecisionAuthority({
|
|
338
365
|
...(opts.recordAuthorization ? { recordAuthorization: opts.recordAuthorization } : {}),
|
|
339
366
|
...(opts.decisionAuthority ? { decisionAuthority: opts.decisionAuthority } : {}),
|
|
340
|
-
}, { versionCache, defaultProjector, providedRecordAuthorization }),
|
|
341
|
-
inject: [
|
|
367
|
+
}, { versionCache, defaultProjector, providedRecordAuthorization, schemas }),
|
|
368
|
+
inject: [
|
|
369
|
+
optionsToken,
|
|
370
|
+
config_module_js_1.FRAMEWORK_SCHEMAS,
|
|
371
|
+
OPTIONAL_VERSION_CACHE,
|
|
372
|
+
OPTIONAL_RECORD_AUTHORIZATION,
|
|
373
|
+
],
|
|
342
374
|
};
|
|
343
375
|
// Same one-instance opt-in AuthModule as forRoot (imported + re-exported).
|
|
344
376
|
// `credentialResolver` is STATIC on the async options (like `auth`) — a
|
|
@@ -399,11 +431,15 @@ let ShieldModule = ShieldModule_1 = class ShieldModule {
|
|
|
399
431
|
asyncOptionsProvider,
|
|
400
432
|
configProvider,
|
|
401
433
|
authorityProvider,
|
|
434
|
+
frameworkSchemasProvider,
|
|
435
|
+
migrationLedgerRegistryProvider,
|
|
402
436
|
...(0, storage_providers_js_1.storageProviders)(options.storage),
|
|
403
437
|
],
|
|
404
438
|
exports: [
|
|
405
439
|
config_module_js_1.APP_CONFIG,
|
|
440
|
+
config_module_js_1.FRAMEWORK_SCHEMAS,
|
|
406
441
|
shield_tokens_js_1.SHIELD_DECISION_AUTHORITY,
|
|
442
|
+
migration_ledger_check_js_1.SHIELD_MIGRATION_LEDGER_REGISTRY,
|
|
407
443
|
...storage_providers_js_1.STORAGE_EXPORTS,
|
|
408
444
|
...(authModule ? [authModule] : []),
|
|
409
445
|
],
|
|
@@ -19,11 +19,18 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import type { Pool } from 'mariadb';
|
|
21
21
|
import type { CreateSessionInput, InsertRefreshInput, RefreshTokenRecord, SessionRecord, SessionRecordStore } from '@astram/core';
|
|
22
|
+
import { type FrameworkSchemaNames } from '../config/framework-schema-names.js';
|
|
22
23
|
/** The DI token the store is bound under. */
|
|
23
24
|
export declare const SHIELD_SESSION_RECORD_STORE: unique symbol;
|
|
24
25
|
export declare class MariaDbSessionRecordStore implements SessionRecordStore {
|
|
25
26
|
private readonly pool;
|
|
26
|
-
|
|
27
|
+
/** `<identity>`.`session`, resolved at construction (lifecycle writes only, ADR-0013). */
|
|
28
|
+
private readonly sessionTable;
|
|
29
|
+
/** `<identity>`.`refresh_token`. */
|
|
30
|
+
private readonly refreshTable;
|
|
31
|
+
constructor(pool: Pool,
|
|
32
|
+
/** Framework database names; absent ⇒ resolved from `SHIELD_DB_NAMESPACE` here, once. */
|
|
33
|
+
schemas?: FrameworkSchemaNames);
|
|
27
34
|
createSession(input: CreateSessionInput): Promise<SessionRecord>;
|
|
28
35
|
insertRefreshRecord(input: InsertRefreshInput): Promise<RefreshTokenRecord>;
|
|
29
36
|
findRefreshByHash(tokenHash: string): Promise<RefreshTokenRecord | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mariadb-session-record-store.d.ts","sourceRoot":"","sources":["../../src/session/mariadb-session-record-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EACnB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"mariadb-session-record-store.d.ts","sourceRoot":"","sources":["../../src/session/mariadb-session-record-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,qCAAqC,CAAC;AAE7C,6CAA6C;AAC7C,eAAO,MAAM,2BAA2B,eAAwC,CAAC;AAmDjF,qBAAa,yBAA0B,YAAW,kBAAkB;IAOhE,OAAO,CAAC,QAAQ,CAAC,IAAI;IANvB,0FAA0F;IAC1F,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAGnB,IAAI,EAAE,IAAI;IAC3B,yFAAyF;IACzF,OAAO,CAAC,EAAE,oBAAoB;IAO1B,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;IAuBhE,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4B3E,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IASxE,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IASvE;;;;;;;OAOG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASxD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnD;;;OAGG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBrD;;;;OAIG;IACG,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ1D,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAarD,sEAAsE;YACxD,MAAM;CAiBrB"}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.MariaDbSessionRecordStore = exports.SHIELD_SESSION_RECORD_STORE = void 0;
|
|
23
|
+
const framework_schema_names_js_1 = require("../config/framework-schema-names.js");
|
|
23
24
|
/** The DI token the store is bound under. */
|
|
24
25
|
exports.SHIELD_SESSION_RECORD_STORE = Symbol('SHIELD_SESSION_RECORD_STORE');
|
|
25
26
|
/** BIGINT columns can arrive as string; normalize to number safely. */
|
|
@@ -50,11 +51,20 @@ function mapRefresh(r) {
|
|
|
50
51
|
}
|
|
51
52
|
class MariaDbSessionRecordStore {
|
|
52
53
|
pool;
|
|
53
|
-
|
|
54
|
+
/** `<identity>`.`session`, resolved at construction (lifecycle writes only, ADR-0013). */
|
|
55
|
+
sessionTable;
|
|
56
|
+
/** `<identity>`.`refresh_token`. */
|
|
57
|
+
refreshTable;
|
|
58
|
+
constructor(pool,
|
|
59
|
+
/** Framework database names; absent ⇒ resolved from `SHIELD_DB_NAMESPACE` here, once. */
|
|
60
|
+
schemas) {
|
|
54
61
|
this.pool = pool;
|
|
62
|
+
const identity = (0, framework_schema_names_js_1.schemaNamesAtConstruction)(schemas).identity;
|
|
63
|
+
this.sessionTable = (0, framework_schema_names_js_1.qualifiedTableName)(identity, 'session');
|
|
64
|
+
this.refreshTable = (0, framework_schema_names_js_1.qualifiedTableName)(identity, 'refresh_token');
|
|
55
65
|
}
|
|
56
66
|
async createSession(input) {
|
|
57
|
-
await this.pool.query(`INSERT INTO
|
|
67
|
+
await this.pool.query(`INSERT INTO ${this.sessionTable}
|
|
58
68
|
(s_session_id, s_principal_id, s_tenant_id, s_status, s_issued_at_ms, s_absolute_expires_at_ms)
|
|
59
69
|
VALUES (?, ?, ?, 'active', ?, ?)`, [
|
|
60
70
|
input.sessionId,
|
|
@@ -73,7 +83,7 @@ class MariaDbSessionRecordStore {
|
|
|
73
83
|
};
|
|
74
84
|
}
|
|
75
85
|
async insertRefreshRecord(input) {
|
|
76
|
-
await this.pool.query(`INSERT INTO
|
|
86
|
+
await this.pool.query(`INSERT INTO ${this.refreshTable}
|
|
77
87
|
(rt_refresh_id, rt_session_id, rt_lineage_id, rt_prev_refresh_id,
|
|
78
88
|
rt_token_hash, rt_status, rt_issued_at_ms, rt_idle_expires_at_ms)
|
|
79
89
|
VALUES (?, ?, ?, ?, ?, 'active', ?, ?)`, [
|
|
@@ -97,12 +107,12 @@ class MariaDbSessionRecordStore {
|
|
|
97
107
|
};
|
|
98
108
|
}
|
|
99
109
|
async findRefreshByHash(tokenHash) {
|
|
100
|
-
const rows = (await this.pool.query(`SELECT * FROM
|
|
110
|
+
const rows = (await this.pool.query(`SELECT * FROM ${this.refreshTable} WHERE rt_token_hash = ? LIMIT 1`, [tokenHash]));
|
|
101
111
|
const row = rows[0];
|
|
102
112
|
return row ? mapRefresh(row) : null;
|
|
103
113
|
}
|
|
104
114
|
async findSessionById(sessionId) {
|
|
105
|
-
const rows = (await this.pool.query(`SELECT * FROM
|
|
115
|
+
const rows = (await this.pool.query(`SELECT * FROM ${this.sessionTable} WHERE s_session_id = ? LIMIT 1`, [sessionId]));
|
|
106
116
|
const row = rows[0];
|
|
107
117
|
return row ? mapSession(row) : null;
|
|
108
118
|
}
|
|
@@ -115,12 +125,12 @@ class MariaDbSessionRecordStore {
|
|
|
115
125
|
* gets `0` (row already 'rotated' → loser). This makes rotation single-winner.
|
|
116
126
|
*/
|
|
117
127
|
async markRotatedIfActive(refreshId) {
|
|
118
|
-
const res = (await this.pool.query(`UPDATE
|
|
128
|
+
const res = (await this.pool.query(`UPDATE ${this.refreshTable} SET rt_status = 'rotated'
|
|
119
129
|
WHERE rt_refresh_id = ? AND rt_status = 'active'`, [refreshId]));
|
|
120
130
|
return res?.affectedRows === 1;
|
|
121
131
|
}
|
|
122
132
|
async markRevoked(refreshId) {
|
|
123
|
-
await this.pool.query(`UPDATE
|
|
133
|
+
await this.pool.query(`UPDATE ${this.refreshTable} SET rt_status = 'revoked'
|
|
124
134
|
WHERE rt_refresh_id = ?`, [refreshId]);
|
|
125
135
|
}
|
|
126
136
|
/**
|
|
@@ -129,11 +139,11 @@ class MariaDbSessionRecordStore {
|
|
|
129
139
|
*/
|
|
130
140
|
async revokeLineage(lineageId) {
|
|
131
141
|
await this.withTx(async (conn) => {
|
|
132
|
-
await conn.query(`UPDATE
|
|
142
|
+
await conn.query(`UPDATE ${this.refreshTable} SET rt_status = 'revoked'
|
|
133
143
|
WHERE rt_lineage_id = ?`, [lineageId]);
|
|
134
|
-
await conn.query(`UPDATE
|
|
144
|
+
await conn.query(`UPDATE ${this.sessionTable} SET s_status = 'revoked'
|
|
135
145
|
WHERE s_session_id IN (
|
|
136
|
-
SELECT DISTINCT rt_session_id FROM
|
|
146
|
+
SELECT DISTINCT rt_session_id FROM ${this.refreshTable} WHERE rt_lineage_id = ?
|
|
137
147
|
)`, [lineageId]);
|
|
138
148
|
});
|
|
139
149
|
}
|
|
@@ -143,13 +153,13 @@ class MariaDbSessionRecordStore {
|
|
|
143
153
|
* those sessions in Redis — never on the per-request path.
|
|
144
154
|
*/
|
|
145
155
|
async sessionIdsForLineage(lineageId) {
|
|
146
|
-
const rows = (await this.pool.query(`SELECT DISTINCT rt_session_id FROM
|
|
156
|
+
const rows = (await this.pool.query(`SELECT DISTINCT rt_session_id FROM ${this.refreshTable} WHERE rt_lineage_id = ?`, [lineageId]));
|
|
147
157
|
return rows.map((r) => r.rt_session_id);
|
|
148
158
|
}
|
|
149
159
|
async revokeSession(sessionId) {
|
|
150
160
|
await this.withTx(async (conn) => {
|
|
151
|
-
await conn.query(`UPDATE
|
|
152
|
-
await conn.query(`UPDATE
|
|
161
|
+
await conn.query(`UPDATE ${this.sessionTable} SET s_status = 'revoked' WHERE s_session_id = ?`, [sessionId]);
|
|
162
|
+
await conn.query(`UPDATE ${this.refreshTable} SET rt_status = 'revoked' WHERE rt_session_id = ?`, [sessionId]);
|
|
153
163
|
});
|
|
154
164
|
}
|
|
155
165
|
/** Run `fn` in a transaction, releasing the connection either way. */
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* Every read error propagates: the caller fails closed.
|
|
16
16
|
*/
|
|
17
17
|
import type { Pool } from 'mariadb';
|
|
18
|
+
import { type FrameworkSchemaNames } from '../config/framework-schema-names.js';
|
|
18
19
|
/** What the refresh rebuild needs to know about a session and its principal. */
|
|
19
20
|
export interface SessionRebuildFacts {
|
|
20
21
|
/** The session was opened by a recovery-code login and is not yet re-secured. */
|
|
@@ -35,7 +36,13 @@ export interface SessionRestrictionStore {
|
|
|
35
36
|
}
|
|
36
37
|
export declare class MariaDbSessionRestrictionStore implements SessionRestrictionStore {
|
|
37
38
|
private readonly pool;
|
|
38
|
-
|
|
39
|
+
/** `<identity>`.`session`. */
|
|
40
|
+
private readonly sessionTable;
|
|
41
|
+
/** `<app>`.`users`. */
|
|
42
|
+
private readonly usersTable;
|
|
43
|
+
constructor(pool: Pool,
|
|
44
|
+
/** Framework database names; absent ⇒ resolved from `SHIELD_DB_NAMESPACE` here, once. */
|
|
45
|
+
schemas?: FrameworkSchemaNames);
|
|
39
46
|
markMustReenroll(sessionId: string): Promise<void>;
|
|
40
47
|
clearMustReenroll(sessionId: string): Promise<void>;
|
|
41
48
|
rebuildFacts(sessionId: string, principalId: string): Promise<SessionRebuildFacts>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-restriction-store.d.ts","sourceRoot":"","sources":["../../src/session/session-restriction-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"session-restriction-store.d.ts","sourceRoot":"","sources":["../../src/session/session-restriction-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,qCAAqC,CAAC;AAE7C,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,uBAAuB;IACtC,uGAAuG;IACvG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,+DAA+D;IAC/D,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,2FAA2F;IAC3F,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACpF;AAKD,qBAAa,8BAA+B,YAAW,uBAAuB;IAO1E,OAAO,CAAC,QAAQ,CAAC,IAAI;IANvB,8BAA8B;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,uBAAuB;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAGjB,IAAI,EAAE,IAAI;IAC3B,yFAAyF;IACzF,OAAO,CAAC,EAAE,oBAAoB;IAO1B,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOlD,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnD,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAqBzF"}
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MariaDbSessionRestrictionStore = void 0;
|
|
4
|
+
const framework_schema_names_js_1 = require("../config/framework-schema-names.js");
|
|
4
5
|
/** MariaDB `ER_NO_SUCH_TABLE`. */
|
|
5
6
|
const ER_NO_SUCH_TABLE = 1146;
|
|
6
7
|
class MariaDbSessionRestrictionStore {
|
|
7
8
|
pool;
|
|
8
|
-
|
|
9
|
+
/** `<identity>`.`session`. */
|
|
10
|
+
sessionTable;
|
|
11
|
+
/** `<app>`.`users`. */
|
|
12
|
+
usersTable;
|
|
13
|
+
constructor(pool,
|
|
14
|
+
/** Framework database names; absent ⇒ resolved from `SHIELD_DB_NAMESPACE` here, once. */
|
|
15
|
+
schemas) {
|
|
9
16
|
this.pool = pool;
|
|
17
|
+
const s = (0, framework_schema_names_js_1.schemaNamesAtConstruction)(schemas);
|
|
18
|
+
this.sessionTable = (0, framework_schema_names_js_1.qualifiedTableName)(s.identity, 'session');
|
|
19
|
+
this.usersTable = (0, framework_schema_names_js_1.qualifiedTableName)(s.app, 'users');
|
|
10
20
|
}
|
|
11
21
|
async markMustReenroll(sessionId) {
|
|
12
|
-
await this.pool.query(
|
|
22
|
+
await this.pool.query(`UPDATE ${this.sessionTable} SET s_must_reenroll = 1 WHERE s_session_id = ?`, [sessionId]);
|
|
13
23
|
}
|
|
14
24
|
async clearMustReenroll(sessionId) {
|
|
15
|
-
await this.pool.query(
|
|
25
|
+
await this.pool.query(`UPDATE ${this.sessionTable} SET s_must_reenroll = 0 WHERE s_session_id = ?`, [sessionId]);
|
|
16
26
|
}
|
|
17
27
|
async rebuildFacts(sessionId, principalId) {
|
|
18
|
-
const rows = (await this.pool.query(
|
|
28
|
+
const rows = (await this.pool.query(`SELECT s_must_reenroll FROM ${this.sessionTable} WHERE s_session_id = ? LIMIT 1`, [sessionId]));
|
|
19
29
|
// No row → treat as restricted (the caller also re-reads the session and refuses a missing one).
|
|
20
30
|
const mustReenroll = rows[0] === undefined || Number(rows[0].s_must_reenroll) !== 0;
|
|
21
31
|
let accountActive = true;
|
|
22
32
|
try {
|
|
23
|
-
const users = (await this.pool.query(
|
|
33
|
+
const users = (await this.pool.query(`SELECT u_status FROM ${this.usersTable} WHERE u_uuid = ? LIMIT 1`, [principalId]));
|
|
24
34
|
if (users[0] !== undefined)
|
|
25
35
|
accountActive = users[0].u_status === 'active';
|
|
26
36
|
}
|
|
@@ -10,10 +10,19 @@
|
|
|
10
10
|
* Idempotent (CREATE TABLE IF NOT EXISTS). No hard-coded UUIDs. Run by the DDL account.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const { frameworkSchemasForMigration } = require('@astram/core');
|
|
14
|
+
|
|
15
|
+
// Database names come from `ctx.schemas` (SHIELD_DB_NAMESPACE, ADR-0037); under an older
|
|
16
|
+
// @astram/migrate without it, the default names apply only while the namespace is unset.
|
|
17
|
+
// replacesChecksums: every checksum this file had in a published release (git release tags), so
|
|
18
|
+
// an existing ledger row is accepted and updated, not reported as drift (ADR-0037).
|
|
19
|
+
const replacesChecksums = ['48b8c9616c73a05ad030cfbfeb8b9e447d74f59804dbd7d3d26850df16d9e07e'];
|
|
20
|
+
|
|
14
21
|
const TS = 'TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP';
|
|
15
22
|
|
|
16
|
-
async function up(
|
|
23
|
+
async function up(ctx) {
|
|
24
|
+
const { query } = ctx;
|
|
25
|
+
const SCHEMA = frameworkSchemasForMigration(ctx, process.env).authz;
|
|
17
26
|
await query(`CREATE SCHEMA IF NOT EXISTS \`${SCHEMA}\` DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`);
|
|
18
27
|
|
|
19
28
|
// permission — the grantable key catalog (perm_key is the stable identity).
|
|
@@ -44,10 +53,12 @@ async function up({ query }) {
|
|
|
44
53
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`);
|
|
45
54
|
}
|
|
46
55
|
|
|
47
|
-
async function down(
|
|
56
|
+
async function down(ctx) {
|
|
57
|
+
const { query } = ctx;
|
|
58
|
+
const SCHEMA = frameworkSchemasForMigration(ctx, process.env).authz;
|
|
48
59
|
await query(`DROP TABLE IF EXISTS \`${SCHEMA}\`.\`role_permission\``);
|
|
49
60
|
await query(`DROP TABLE IF EXISTS \`${SCHEMA}\`.\`authz_permission_version\``);
|
|
50
61
|
await query(`DROP TABLE IF EXISTS \`${SCHEMA}\`.\`permission\``);
|
|
51
62
|
}
|
|
52
63
|
|
|
53
|
-
module.exports = { up, down };
|
|
64
|
+
module.exports = { up, down, replacesChecksums };
|
|
@@ -20,9 +20,17 @@
|
|
|
20
20
|
* Run by the DDL account.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const { frameworkSchemasForMigration } = require('@astram/core');
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// Database names come from `ctx.schemas` (SHIELD_DB_NAMESPACE, ADR-0037); under an older
|
|
26
|
+
// @astram/migrate without it, the default names apply only while the namespace is unset.
|
|
27
|
+
// replacesChecksums: every checksum this file had in a published release (git release tags), so
|
|
28
|
+
// an existing ledger row is accepted and updated, not reported as drift (ADR-0037).
|
|
29
|
+
const replacesChecksums = ['7c6733f7acb8dfc8ddc32d79aa3e19df1a424802d87e2a18c2b109a7a0b07f5d'];
|
|
30
|
+
|
|
31
|
+
async function up(ctx) {
|
|
32
|
+
const { query } = ctx;
|
|
33
|
+
const SCHEMA = frameworkSchemasForMigration(ctx, process.env).authz;
|
|
26
34
|
// permission — add the catalog columns astram3's MariaDbCatalogStore contract expects.
|
|
27
35
|
await query(
|
|
28
36
|
`ALTER TABLE \`${SCHEMA}\`.\`permission\` ADD COLUMN IF NOT EXISTS perm_uuid VARCHAR(36) NULL`
|
|
@@ -63,4 +71,4 @@ async function down() {
|
|
|
63
71
|
// reviewed follow-up migration — not an automatic DROP COLUMN in `down()`.
|
|
64
72
|
}
|
|
65
73
|
|
|
66
|
-
module.exports = { up, down };
|
|
74
|
+
module.exports = { up, down, replacesChecksums };
|
|
@@ -14,9 +14,17 @@
|
|
|
14
14
|
* Idempotent (CREATE TABLE IF NOT EXISTS). Structural (no tenant gate). Run by the DDL account.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const { frameworkSchemasForMigration } = require('@astram/core');
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
// Database names come from `ctx.schemas` (SHIELD_DB_NAMESPACE, ADR-0037); under an older
|
|
20
|
+
// @astram/migrate without it, the default names apply only while the namespace is unset.
|
|
21
|
+
// replacesChecksums: every checksum this file had in a published release (git release tags), so
|
|
22
|
+
// an existing ledger row is accepted and updated, not reported as drift (ADR-0037).
|
|
23
|
+
const replacesChecksums = ['7537d160c1ce7890e2ddb29333fd48ca4a13c3d191af85e8bff601d41245488f'];
|
|
24
|
+
|
|
25
|
+
async function up(ctx) {
|
|
26
|
+
const { query } = ctx;
|
|
27
|
+
const SCHEMA = frameworkSchemasForMigration(ctx, process.env).authz;
|
|
20
28
|
await query(`CREATE TABLE IF NOT EXISTS \`${SCHEMA}\`.\`access_bundle\` (
|
|
21
29
|
ab_uuid CHAR(36) NOT NULL,
|
|
22
30
|
ab_key VARCHAR(120) NOT NULL,
|
|
@@ -40,10 +48,12 @@ async function up({ query }) {
|
|
|
40
48
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`);
|
|
41
49
|
}
|
|
42
50
|
|
|
43
|
-
async function down(
|
|
51
|
+
async function down(ctx) {
|
|
52
|
+
const { query } = ctx;
|
|
53
|
+
const SCHEMA = frameworkSchemasForMigration(ctx, process.env).authz;
|
|
44
54
|
// FK order: drop the child (access_bundle_permission) before the parent (access_bundle).
|
|
45
55
|
await query(`DROP TABLE IF EXISTS \`${SCHEMA}\`.\`access_bundle_permission\``);
|
|
46
56
|
await query(`DROP TABLE IF EXISTS \`${SCHEMA}\`.\`access_bundle\``);
|
|
47
57
|
}
|
|
48
58
|
|
|
49
|
-
module.exports = { up, down };
|
|
59
|
+
module.exports = { up, down, replacesChecksums };
|