@astram/guard 0.18.0 → 0.20.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 +90 -0
- package/dist/audit/audit-chain-sealer.d.ts.map +1 -0
- package/dist/audit/audit-chain-sealer.js +520 -0
- package/dist/audit/audit-seal-config.d.ts +22 -0
- package/dist/audit/audit-seal-config.d.ts.map +1 -0
- package/dist/audit/audit-seal-config.js +35 -0
- package/dist/audit/audit-sealer.service.d.ts +62 -0
- package/dist/audit/audit-sealer.service.d.ts.map +1 -0
- package/dist/audit/audit-sealer.service.js +197 -0
- package/dist/audit/node-sha256-hash.d.ts +6 -0
- package/dist/audit/node-sha256-hash.d.ts.map +1 -0
- package/dist/audit/node-sha256-hash.js +16 -0
- package/dist/auth/account.controller.d.ts +3 -1
- package/dist/auth/account.controller.d.ts.map +1 -1
- package/dist/auth/account.controller.js +79 -6
- package/dist/auth/admin-signin-controls.d.ts +80 -0
- package/dist/auth/admin-signin-controls.d.ts.map +1 -0
- package/dist/auth/admin-signin-controls.js +91 -0
- package/dist/auth/auth-audit.d.ts +59 -0
- package/dist/auth/auth-audit.d.ts.map +1 -0
- package/dist/auth/auth-audit.js +93 -0
- package/dist/auth/auth.controller.d.ts +53 -6
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +330 -44
- package/dist/auth/auth.module.d.ts +49 -0
- package/dist/auth/auth.module.d.ts.map +1 -1
- package/dist/auth/auth.module.js +149 -4
- package/dist/auth/captcha-gate.d.ts +103 -0
- package/dist/auth/captcha-gate.d.ts.map +1 -0
- package/dist/auth/captcha-gate.js +245 -0
- package/dist/auth/dto.d.ts +22 -1
- package/dist/auth/dto.d.ts.map +1 -1
- package/dist/auth/login-name-count-boot.d.ts +24 -0
- package/dist/auth/login-name-count-boot.d.ts.map +1 -0
- package/dist/auth/login-name-count-boot.js +47 -0
- package/dist/auth/logout-proof.d.ts +55 -0
- package/dist/auth/logout-proof.d.ts.map +1 -0
- package/dist/auth/logout-proof.js +127 -0
- package/dist/auth/pending-mfa-store.d.ts +5 -0
- package/dist/auth/pending-mfa-store.d.ts.map +1 -1
- package/dist/auth/pending-mfa-store.js +2 -0
- package/dist/auth/persistence.module.d.ts +2 -2
- package/dist/auth/persistence.module.d.ts.map +1 -1
- package/dist/auth/persistence.module.js +19 -3
- package/dist/auth/ports/audit-sink.d.ts +5 -2
- package/dist/auth/ports/audit-sink.d.ts.map +1 -1
- package/dist/auth/ports/mfa-device-store.d.ts +7 -0
- package/dist/auth/ports/mfa-device-store.d.ts.map +1 -1
- package/dist/auth/profile-resolver.d.ts +6 -0
- package/dist/auth/profile-resolver.d.ts.map +1 -1
- package/dist/auth/rate-limit/attempt-limiter.d.ts +6 -0
- package/dist/auth/rate-limit/attempt-limiter.d.ts.map +1 -1
- package/dist/auth/rate-limit/attempt-limiter.js +14 -0
- package/dist/auth/tokens.d.ts +59 -0
- package/dist/auth/tokens.d.ts.map +1 -1
- package/dist/auth/tokens.js +61 -1
- package/dist/authentication/credential-provisioner.d.ts +7 -0
- package/dist/authentication/credential-provisioner.d.ts.map +1 -1
- package/dist/authentication/mariadb-credential-provisioner.d.ts +1 -0
- package/dist/authentication/mariadb-credential-provisioner.d.ts.map +1 -1
- package/dist/authentication/mariadb-credential-provisioner.js +7 -0
- package/dist/authentication/mariadb-credential-resolver.d.ts +23 -2
- package/dist/authentication/mariadb-credential-resolver.d.ts.map +1 -1
- package/dist/authentication/mariadb-credential-resolver.js +45 -1
- package/dist/authentication/mariadb-mfa-device-store.d.ts +7 -0
- package/dist/authentication/mariadb-mfa-device-store.d.ts.map +1 -1
- package/dist/authentication/mariadb-mfa-device-store.js +32 -0
- package/dist/authentication/mariadb-mfa-requirement-source.d.ts +55 -0
- package/dist/authentication/mariadb-mfa-requirement-source.d.ts.map +1 -0
- package/dist/authentication/mariadb-mfa-requirement-source.js +164 -0
- package/dist/authentication/mariadb-mfa-resetter.d.ts +42 -0
- package/dist/authentication/mariadb-mfa-resetter.d.ts.map +1 -0
- package/dist/authentication/mariadb-mfa-resetter.js +59 -0
- package/dist/authentication/mariadb-profile-writer.d.ts.map +1 -1
- package/dist/authentication/mariadb-profile-writer.js +5 -0
- package/dist/authentication/sign-in-with.d.ts +14 -0
- package/dist/authentication/sign-in-with.d.ts.map +1 -0
- package/dist/authentication/sign-in-with.js +36 -0
- package/dist/authz/core-access.d.ts +11 -0
- package/dist/authz/core-access.d.ts.map +1 -0
- package/dist/authz/core-access.js +14 -0
- package/dist/authz/list-scope-sql.d.ts.map +1 -1
- package/dist/authz/list-scope-sql.js +15 -5
- package/dist/authz/wire-record-authorization.d.ts.map +1 -1
- package/dist/authz/wire-record-authorization.js +21 -3
- package/dist/captcha/captcha.providers.d.ts +18 -0
- package/dist/captcha/captcha.providers.d.ts.map +1 -0
- package/dist/captcha/captcha.providers.js +78 -0
- package/dist/captcha/recaptcha-verifier.d.ts +20 -0
- package/dist/captcha/recaptcha-verifier.d.ts.map +1 -0
- package/dist/captcha/recaptcha-verifier.js +48 -0
- package/dist/captcha/siteverify.d.ts +47 -0
- package/dist/captcha/siteverify.d.ts.map +1 -0
- package/dist/captcha/siteverify.js +98 -0
- package/dist/captcha/turnstile-verifier.d.ts +18 -0
- package/dist/captcha/turnstile-verifier.d.ts.map +1 -0
- package/dist/captcha/turnstile-verifier.js +41 -0
- package/dist/config/captcha-config.d.ts +47 -0
- package/dist/config/captcha-config.d.ts.map +1 -0
- package/dist/config/captcha-config.js +163 -0
- package/dist/config/reserved-principal-ids.d.ts +15 -0
- package/dist/config/reserved-principal-ids.d.ts.map +1 -1
- package/dist/config/reserved-principal-ids.js +20 -3
- package/dist/enforcement/global-enforcement.guard.d.ts +9 -1
- package/dist/enforcement/global-enforcement.guard.d.ts.map +1 -1
- package/dist/enforcement/global-enforcement.guard.js +52 -10
- package/dist/enforcement/reenroll-allowlist.d.ts +5 -0
- package/dist/enforcement/reenroll-allowlist.d.ts.map +1 -1
- package/dist/enforcement/reenroll-allowlist.js +5 -0
- package/dist/identity/auth-facts.controller.d.ts +31 -4
- package/dist/identity/auth-facts.controller.d.ts.map +1 -1
- package/dist/identity/auth-facts.controller.js +46 -11
- package/dist/identity/identity-actions.d.ts +2 -2
- package/dist/identity/identity-actions.d.ts.map +1 -1
- package/dist/identity/module-registry.bridge.d.ts.map +1 -1
- package/dist/identity/module-registry.bridge.js +3 -6
- package/dist/identity/permission-facts.adapter.d.ts +22 -0
- package/dist/identity/permission-facts.adapter.d.ts.map +1 -1
- package/dist/identity/permission-facts.adapter.js +26 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -11
- package/dist/internal.d.ts +27 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +36 -1
- package/dist/module/shield.module.d.ts +27 -0
- package/dist/module/shield.module.d.ts.map +1 -1
- package/dist/module/shield.module.js +10 -0
- package/dist/request-auth/request-principal.d.ts +8 -1
- package/dist/request-auth/request-principal.d.ts.map +1 -1
- package/dist/request-auth/request-principal.js +11 -4
- package/dist/request-auth/session-token-binder.d.ts +82 -0
- package/dist/request-auth/session-token-binder.d.ts.map +1 -1
- package/dist/request-auth/session-token-binder.js +203 -1
- package/dist/session/mfa-requirement-service.d.ts +168 -0
- package/dist/session/mfa-requirement-service.d.ts.map +1 -0
- package/dist/session/mfa-requirement-service.js +461 -0
- package/dist/session/session-restriction-store.d.ts +36 -0
- package/dist/session/session-restriction-store.d.ts.map +1 -1
- package/dist/session/session-restriction-store.js +57 -6
- package/dist/session/session-restriction.d.ts +22 -0
- package/dist/session/session-restriction.d.ts.map +1 -0
- package/dist/session/session-restriction.js +23 -0
- package/package.json +10 -5
package/dist/index.js
CHANGED
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
*/
|
|
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
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
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.SHIELD_REDIS = exports.mariadbSslOption = exports.reservedOperationPrincipal = exports.RESERVED_OPERATION_PRINCIPALS = exports.assertNoReservedRootId = exports.ORG_BOOTSTRAP_PRINCIPAL_ID = exports.rootIdsFromEnv = 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.PendingMfaStore = exports.AuthController = exports.SHIELD_SCOPE_SUBTREE_RESOLVER = 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 = 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 = void 0;
|
|
23
24
|
// Framework authz migrations (shield_authz DDL — permission / role_permission /
|
|
24
25
|
// authz_permission_version). Absolute path a consumer's `@astram/migrate` setup merges in.
|
|
25
26
|
var migrations_dir_js_1 = require("./migrations-dir.js");
|
|
@@ -153,6 +154,12 @@ var s3_object_store_js_1 = require("./storage/s3-object-store.js");
|
|
|
153
154
|
Object.defineProperty(exports, "S3ObjectStore", { enumerable: true, get: function () { return s3_object_store_js_1.S3ObjectStore; } });
|
|
154
155
|
var node_sha256_digest_js_1 = require("./storage/node-sha256-digest.js");
|
|
155
156
|
Object.defineProperty(exports, "NodeSha256Digest", { enumerable: true, get: function () { return node_sha256_digest_js_1.NodeSha256Digest; } });
|
|
157
|
+
// Durable audit chain (audit-chain-store SPEC §5.F, §5.I): the chain hash adapter and the
|
|
158
|
+
// `AUDIT_SEAL_*` loader. The sealer itself is wired by `ShieldModule.forRoot({ auth: true })`.
|
|
159
|
+
var node_sha256_hash_js_1 = require("./audit/node-sha256-hash.js");
|
|
160
|
+
Object.defineProperty(exports, "NodeSha256Hash", { enumerable: true, get: function () { return node_sha256_hash_js_1.NodeSha256Hash; } });
|
|
161
|
+
var audit_seal_config_js_1 = require("./audit/audit-seal-config.js");
|
|
162
|
+
Object.defineProperty(exports, "loadAuditSealConfig", { enumerable: true, get: function () { return audit_seal_config_js_1.loadAuditSealConfig; } });
|
|
156
163
|
var object_store_boot_check_js_1 = require("./storage/object-store-boot-check.js");
|
|
157
164
|
Object.defineProperty(exports, "ObjectStoreBootCheck", { enumerable: true, get: function () { return object_store_boot_check_js_1.ObjectStoreBootCheck; } });
|
|
158
165
|
var file_intake_interceptor_js_1 = require("./storage/file-intake.interceptor.js");
|
|
@@ -375,6 +382,9 @@ Object.defineProperty(exports, "rootIdsFromEnv", { enumerable: true, get: functi
|
|
|
375
382
|
var reserved_principal_ids_js_1 = require("./config/reserved-principal-ids.js");
|
|
376
383
|
Object.defineProperty(exports, "ORG_BOOTSTRAP_PRINCIPAL_ID", { enumerable: true, get: function () { return reserved_principal_ids_js_1.ORG_BOOTSTRAP_PRINCIPAL_ID; } });
|
|
377
384
|
Object.defineProperty(exports, "assertNoReservedRootId", { enumerable: true, get: function () { return reserved_principal_ids_js_1.assertNoReservedRootId; } });
|
|
385
|
+
// KI #140 (additive): reserved operation principals, labelled by the audit viewer.
|
|
386
|
+
Object.defineProperty(exports, "RESERVED_OPERATION_PRINCIPALS", { enumerable: true, get: function () { return reserved_principal_ids_js_1.RESERVED_OPERATION_PRINCIPALS; } });
|
|
387
|
+
Object.defineProperty(exports, "reservedOperationPrincipal", { enumerable: true, get: function () { return reserved_principal_ids_js_1.reservedOperationPrincipal; } });
|
|
378
388
|
// Phase 16: the driver `ssl` option every framework pool uses (identity's pools build on it).
|
|
379
389
|
var connections_js_1 = require("./auth/connections.js");
|
|
380
390
|
Object.defineProperty(exports, "mariadbSslOption", { enumerable: true, get: function () { return connections_js_1.mariadbSslOption; } });
|
|
@@ -417,6 +427,28 @@ Object.defineProperty(exports, "SHIELD_TOTP_VERIFIER_OVERRIDE", { enumerable: tr
|
|
|
417
427
|
// The credential-store contract (skeleton — Team A implements the SELECT).
|
|
418
428
|
var mariadb_credential_resolver_js_1 = require("./authentication/mariadb-credential-resolver.js");
|
|
419
429
|
Object.defineProperty(exports, "MariaDbCredentialResolver", { enumerable: true, get: function () { return mariadb_credential_resolver_js_1.MariaDbCredentialResolver; } });
|
|
430
|
+
var sign_in_with_js_1 = require("./authentication/sign-in-with.js");
|
|
431
|
+
Object.defineProperty(exports, "resolveSignInWith", { enumerable: true, get: function () { return sign_in_with_js_1.resolveSignInWith; } });
|
|
432
|
+
Object.defineProperty(exports, "DEFAULT_SIGN_IN_WITH", { enumerable: true, get: function () { return sign_in_with_js_1.DEFAULT_SIGN_IN_WITH; } });
|
|
433
|
+
var tokens_js_5 = require("./auth/tokens.js");
|
|
434
|
+
Object.defineProperty(exports, "SHIELD_SIGN_IN_WITH", { enumerable: true, get: function () { return tokens_js_5.SHIELD_SIGN_IN_WITH; } });
|
|
435
|
+
var captcha_config_js_1 = require("./config/captcha-config.js");
|
|
436
|
+
Object.defineProperty(exports, "loadCaptchaConfig", { enumerable: true, get: function () { return captcha_config_js_1.loadCaptchaConfig; } });
|
|
437
|
+
Object.defineProperty(exports, "CAPTCHA_ENDPOINTS", { enumerable: true, get: function () { return captcha_config_js_1.CAPTCHA_ENDPOINTS; } });
|
|
438
|
+
Object.defineProperty(exports, "CAPTCHA_MODES", { enumerable: true, get: function () { return captcha_config_js_1.CAPTCHA_MODES; } });
|
|
439
|
+
Object.defineProperty(exports, "CAPTCHA_FAIL_MODES", { enumerable: true, get: function () { return captcha_config_js_1.CAPTCHA_FAIL_MODES; } });
|
|
440
|
+
Object.defineProperty(exports, "DEFAULT_CAPTCHA_THRESHOLD", { enumerable: true, get: function () { return captcha_config_js_1.DEFAULT_CAPTCHA_THRESHOLD; } });
|
|
441
|
+
Object.defineProperty(exports, "DEFAULT_CAPTCHA_MIN_SCORE", { enumerable: true, get: function () { return captcha_config_js_1.DEFAULT_CAPTCHA_MIN_SCORE; } });
|
|
442
|
+
Object.defineProperty(exports, "DEFAULT_CAPTCHA_TIMEOUT_MS", { enumerable: true, get: function () { return captcha_config_js_1.DEFAULT_CAPTCHA_TIMEOUT_MS; } });
|
|
443
|
+
Object.defineProperty(exports, "MAX_CAPTCHA_TIMEOUT_MS", { enumerable: true, get: function () { return captcha_config_js_1.MAX_CAPTCHA_TIMEOUT_MS; } });
|
|
444
|
+
var turnstile_verifier_js_1 = require("./captcha/turnstile-verifier.js");
|
|
445
|
+
Object.defineProperty(exports, "TurnstileVerifier", { enumerable: true, get: function () { return turnstile_verifier_js_1.TurnstileVerifier; } });
|
|
446
|
+
Object.defineProperty(exports, "TURNSTILE_SITEVERIFY_URL", { enumerable: true, get: function () { return turnstile_verifier_js_1.TURNSTILE_SITEVERIFY_URL; } });
|
|
447
|
+
var recaptcha_verifier_js_1 = require("./captcha/recaptcha-verifier.js");
|
|
448
|
+
Object.defineProperty(exports, "RecaptchaVerifier", { enumerable: true, get: function () { return recaptcha_verifier_js_1.RecaptchaVerifier; } });
|
|
449
|
+
Object.defineProperty(exports, "RECAPTCHA_SITEVERIFY_URL", { enumerable: true, get: function () { return recaptcha_verifier_js_1.RECAPTCHA_SITEVERIFY_URL; } });
|
|
450
|
+
var tokens_js_6 = require("./auth/tokens.js");
|
|
451
|
+
Object.defineProperty(exports, "SHIELD_CAPTCHA_GATE", { enumerable: true, get: function () { return tokens_js_6.SHIELD_CAPTCHA_GATE; } });
|
|
420
452
|
// The composition module skeletons (Team B fills the factory bodies; the
|
|
421
453
|
// integration owner imports AuthModule into ShieldModule — see auth.module.ts /
|
|
422
454
|
// DONE.md).
|
|
@@ -454,10 +486,10 @@ var recipient_mask_js_1 = require("./messaging/recipient-mask.js");
|
|
|
454
486
|
Object.defineProperty(exports, "maskPhone", { enumerable: true, get: function () { return recipient_mask_js_1.maskPhone; } });
|
|
455
487
|
var profile_writer_js_1 = require("./auth/ports/profile-writer.js");
|
|
456
488
|
Object.defineProperty(exports, "ProfileNameTakenError", { enumerable: true, get: function () { return profile_writer_js_1.ProfileNameTakenError; } });
|
|
457
|
-
var
|
|
458
|
-
Object.defineProperty(exports, "SHIELD_SESSION_FACTS_PROJECTOR", { enumerable: true, get: function () { return
|
|
459
|
-
var
|
|
460
|
-
Object.defineProperty(exports, "SHIELD_SCOPE_SUBTREE_RESOLVER", { enumerable: true, get: function () { return
|
|
489
|
+
var tokens_js_7 = require("./auth/tokens.js");
|
|
490
|
+
Object.defineProperty(exports, "SHIELD_SESSION_FACTS_PROJECTOR", { enumerable: true, get: function () { return tokens_js_7.SHIELD_SESSION_FACTS_PROJECTOR; } });
|
|
491
|
+
var tokens_js_8 = require("./auth/tokens.js");
|
|
492
|
+
Object.defineProperty(exports, "SHIELD_SCOPE_SUBTREE_RESOLVER", { enumerable: true, get: function () { return tokens_js_8.SHIELD_SCOPE_SUBTREE_RESOLVER; } });
|
|
461
493
|
// The framework-owned `/auth/*` HTTP controller (Team C) + its pending-MFA store.
|
|
462
494
|
// The controller CONSUMES SHIELD_AUTHENTICATOR / SHIELD_SESSION_AUTHORITY and the
|
|
463
495
|
// PendingMfaStore. It is EXPORTED so AuthModule (Team B) / the integration owner
|
|
@@ -474,10 +506,10 @@ var mfa_step_up_js_1 = require("./auth/mfa-step-up.js");
|
|
|
474
506
|
Object.defineProperty(exports, "CredentialMfaStepUp", { enumerable: true, get: function () { return mfa_step_up_js_1.CredentialMfaStepUp; } });
|
|
475
507
|
Object.defineProperty(exports, "credentialFingerprint", { enumerable: true, get: function () { return mfa_step_up_js_1.credentialFingerprint; } });
|
|
476
508
|
Object.defineProperty(exports, "challengeMatches", { enumerable: true, get: function () { return mfa_step_up_js_1.challengeMatches; } });
|
|
477
|
-
var
|
|
478
|
-
Object.defineProperty(exports, "SHIELD_MFA_LIMITER", { enumerable: true, get: function () { return
|
|
479
|
-
Object.defineProperty(exports, "SHIELD_MFA_STEP_UP", { enumerable: true, get: function () { return
|
|
480
|
-
Object.defineProperty(exports, "SHIELD_LOGIN_TOTP_VERIFIER", { enumerable: true, get: function () { return
|
|
509
|
+
var tokens_js_9 = require("./auth/tokens.js");
|
|
510
|
+
Object.defineProperty(exports, "SHIELD_MFA_LIMITER", { enumerable: true, get: function () { return tokens_js_9.SHIELD_MFA_LIMITER; } });
|
|
511
|
+
Object.defineProperty(exports, "SHIELD_MFA_STEP_UP", { enumerable: true, get: function () { return tokens_js_9.SHIELD_MFA_STEP_UP; } });
|
|
512
|
+
Object.defineProperty(exports, "SHIELD_LOGIN_TOTP_VERIFIER", { enumerable: true, get: function () { return tokens_js_9.SHIELD_LOGIN_TOTP_VERIFIER; } });
|
|
481
513
|
// The pure TOTP-enrollment helpers (Phase 4 MFA). Re-exported for consumers/tests
|
|
482
514
|
// that need them; the multi-device MFA routes (Phase 3) reuse them to mint a device
|
|
483
515
|
// secret + provisioning URI + recovery codes. (The old in-memory
|
package/dist/internal.d.ts
CHANGED
|
@@ -20,4 +20,31 @@ export { AttemptLimiter } from './auth/rate-limit/attempt-limiter.js';
|
|
|
20
20
|
export { SHIELD_REDIS } from './auth/tokens.js';
|
|
21
21
|
export { SHIELD_ATTEMPT_LIMITER_FACTORY } from './auth/tokens.js';
|
|
22
22
|
export type { AttemptLimiterFactory } from './auth/auth.module.js';
|
|
23
|
+
/**
|
|
24
|
+
* For `@astram/identity` only (R12.1, B-3): the token identity binds its default auth audit sink
|
|
25
|
+
* under, so guard's auth surface records to `audit_log` when the app supplies no `auditSink`.
|
|
26
|
+
*/
|
|
27
|
+
export { SHIELD_DEFAULT_AUTH_AUDIT_SINK } from './auth/tokens.js';
|
|
28
|
+
/**
|
|
29
|
+
* For `@astram/identity` only (auth capabilities R2): the token identity binds `true` when its
|
|
30
|
+
* security-policy feature is registered, which turns guard's mandatory-2FA evaluation on.
|
|
31
|
+
*/
|
|
32
|
+
export { SHIELD_MFA_POLICY_FEATURE } from './auth/tokens.js';
|
|
33
|
+
/** Test surface (auth capabilities R2): the guard's mandatory-2FA service token (`null` when off). */
|
|
34
|
+
export { SHIELD_MFA_REQUIREMENT } from './auth/tokens.js';
|
|
35
|
+
/**
|
|
36
|
+
* For `@astram/identity` only (auth capabilities R11.3): the guard's MariaDB mandatory-2FA source
|
|
37
|
+
* token; identity's users list falls back to its batched confirmed-device read when the policy
|
|
38
|
+
* feature is off.
|
|
39
|
+
*/
|
|
40
|
+
export { SHIELD_MFA_REQUIREMENT_SOURCE } from './auth/tokens.js';
|
|
41
|
+
/**
|
|
42
|
+
* For `@astram/identity` only (auth capabilities R11, B-5): the admin sign-in controls. The step-up
|
|
43
|
+
* (the admin's own TOTP on their `mfa:pid` budget), the account unlocker (login, MFA, recovery and
|
|
44
|
+
* CAPTCHA account counters) and the MFA resetter identity builds over its runtime pool.
|
|
45
|
+
*/
|
|
46
|
+
export { SHIELD_ADMIN_STEP_UP, SHIELD_ACCOUNT_UNLOCKER } from './auth/tokens.js';
|
|
47
|
+
export { AdminControlUnavailableError, accountUnlockKeys, type AccountUnlocker, type AdminStepUp, type AdminStepUpOutcome, } from './auth/admin-signin-controls.js';
|
|
48
|
+
export { MariaDbMfaResetter, type MfaResetQuery, type MfaResetRequest, type MfaResetResult, type MfaResetter, } from './authentication/mariadb-mfa-resetter.js';
|
|
49
|
+
export type { MfaAdminStatus, MfaStatusBatchSource, MfaStatusSubject, } from './session/mfa-requirement-service.js';
|
|
23
50
|
//# sourceMappingURL=internal.d.ts.map
|
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,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,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"}
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,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.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_DB_POOL = exports.PersistenceModule = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* @astram/guard/internal — framework-composition and test surface (Phase 8 #5).
|
|
6
6
|
*
|
|
@@ -28,3 +28,38 @@ var tokens_js_2 = require("./auth/tokens.js");
|
|
|
28
28
|
Object.defineProperty(exports, "SHIELD_REDIS", { enumerable: true, get: function () { return tokens_js_2.SHIELD_REDIS; } });
|
|
29
29
|
var tokens_js_3 = require("./auth/tokens.js");
|
|
30
30
|
Object.defineProperty(exports, "SHIELD_ATTEMPT_LIMITER_FACTORY", { enumerable: true, get: function () { return tokens_js_3.SHIELD_ATTEMPT_LIMITER_FACTORY; } });
|
|
31
|
+
/**
|
|
32
|
+
* For `@astram/identity` only (R12.1, B-3): the token identity binds its default auth audit sink
|
|
33
|
+
* under, so guard's auth surface records to `audit_log` when the app supplies no `auditSink`.
|
|
34
|
+
*/
|
|
35
|
+
var tokens_js_4 = require("./auth/tokens.js");
|
|
36
|
+
Object.defineProperty(exports, "SHIELD_DEFAULT_AUTH_AUDIT_SINK", { enumerable: true, get: function () { return tokens_js_4.SHIELD_DEFAULT_AUTH_AUDIT_SINK; } });
|
|
37
|
+
/**
|
|
38
|
+
* For `@astram/identity` only (auth capabilities R2): the token identity binds `true` when its
|
|
39
|
+
* security-policy feature is registered, which turns guard's mandatory-2FA evaluation on.
|
|
40
|
+
*/
|
|
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
|
+
var tokens_js_6 = require("./auth/tokens.js");
|
|
45
|
+
Object.defineProperty(exports, "SHIELD_MFA_REQUIREMENT", { enumerable: true, get: function () { return tokens_js_6.SHIELD_MFA_REQUIREMENT; } });
|
|
46
|
+
/**
|
|
47
|
+
* For `@astram/identity` only (auth capabilities R11.3): the guard's MariaDB mandatory-2FA source
|
|
48
|
+
* token; identity's users list falls back to its batched confirmed-device read when the policy
|
|
49
|
+
* feature is off.
|
|
50
|
+
*/
|
|
51
|
+
var tokens_js_7 = require("./auth/tokens.js");
|
|
52
|
+
Object.defineProperty(exports, "SHIELD_MFA_REQUIREMENT_SOURCE", { enumerable: true, get: function () { return tokens_js_7.SHIELD_MFA_REQUIREMENT_SOURCE; } });
|
|
53
|
+
/**
|
|
54
|
+
* For `@astram/identity` only (auth capabilities R11, B-5): the admin sign-in controls. The step-up
|
|
55
|
+
* (the admin's own TOTP on their `mfa:pid` budget), the account unlocker (login, MFA, recovery and
|
|
56
|
+
* CAPTCHA account counters) and the MFA resetter identity builds over its runtime pool.
|
|
57
|
+
*/
|
|
58
|
+
var tokens_js_8 = require("./auth/tokens.js");
|
|
59
|
+
Object.defineProperty(exports, "SHIELD_ADMIN_STEP_UP", { enumerable: true, get: function () { return tokens_js_8.SHIELD_ADMIN_STEP_UP; } });
|
|
60
|
+
Object.defineProperty(exports, "SHIELD_ACCOUNT_UNLOCKER", { enumerable: true, get: function () { return tokens_js_8.SHIELD_ACCOUNT_UNLOCKER; } });
|
|
61
|
+
var admin_signin_controls_js_1 = require("./auth/admin-signin-controls.js");
|
|
62
|
+
Object.defineProperty(exports, "AdminControlUnavailableError", { enumerable: true, get: function () { return admin_signin_controls_js_1.AdminControlUnavailableError; } });
|
|
63
|
+
Object.defineProperty(exports, "accountUnlockKeys", { enumerable: true, get: function () { return admin_signin_controls_js_1.accountUnlockKeys; } });
|
|
64
|
+
var mariadb_mfa_resetter_js_1 = require("./authentication/mariadb-mfa-resetter.js");
|
|
65
|
+
Object.defineProperty(exports, "MariaDbMfaResetter", { enumerable: true, get: function () { return mariadb_mfa_resetter_js_1.MariaDbMfaResetter; } });
|
|
@@ -16,8 +16,10 @@ import type { MembershipChecker } from '../auth/ports/membership-checker.js';
|
|
|
16
16
|
import type { CoreDecisionAuthority } from '../enforcement/core-seam.js';
|
|
17
17
|
import { type AppConfig } from '../config/app-config.js';
|
|
18
18
|
import { SHIELD_DECISION_AUTHORITY, SHIELD_RECORD_AUTHORIZATION } from './shield-tokens.js';
|
|
19
|
+
import type { SignInMethod } from '../authentication/sign-in-with.js';
|
|
19
20
|
export { SHIELD_DECISION_AUTHORITY, SHIELD_RECORD_AUTHORIZATION };
|
|
20
21
|
import { type ShieldStorageOption } from '../storage/storage.providers.js';
|
|
22
|
+
import type { ShieldCaptchaOption } from '../captcha/captcha.providers.js';
|
|
21
23
|
export type { RecordAuthorizationInputs } from '../authz/wire-record-authorization.js';
|
|
22
24
|
/**
|
|
23
25
|
* Options for {@link ShieldModule.forRoot}. Intentionally minimal (ADR-0023 §7 —
|
|
@@ -199,6 +201,25 @@ export interface ShieldModuleOptions {
|
|
|
199
201
|
* loopback (`localhost`, `127.0.0.1`, `::1`, `0.0.0.0`), unless `emailSender: 'disabled'`.
|
|
200
202
|
*/
|
|
201
203
|
readonly emailChangeLinkBaseUrl?: string;
|
|
204
|
+
/**
|
|
205
|
+
* R15.1 / D-9: require proof for `POST /auth/logout` — see
|
|
206
|
+
* {@link AuthModuleOptions.logoutRequiresProof}. Default `false` in this release (an unproven
|
|
207
|
+
* logout still revokes, counted `auth.logout.unproven`); `true` from the next guard major. Only
|
|
208
|
+
* consulted when `auth: true`.
|
|
209
|
+
*/
|
|
210
|
+
readonly logoutRequiresProof?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* R1.8: sign-in forms accepted by `POST /auth/login` — see {@link AuthModuleOptions.signInWith}.
|
|
213
|
+
* Default `['email']`; `['email', 'username']` adds the login name. An unknown value throws at
|
|
214
|
+
* registration. Only consulted when `auth: true`.
|
|
215
|
+
*/
|
|
216
|
+
readonly signInWith?: readonly SignInMethod[];
|
|
217
|
+
/**
|
|
218
|
+
* Auth capabilities R7 (D-6): `'env'` turns CAPTCHA on for login, forgot-password and
|
|
219
|
+
* reset-password from `CAPTCHA_*` (see {@link AuthModuleOptions.captcha}). Omitted ⇒ off, every
|
|
220
|
+
* route as today. Only consulted when `auth: true`.
|
|
221
|
+
*/
|
|
222
|
+
readonly captcha?: ShieldCaptchaOption;
|
|
202
223
|
/**
|
|
203
224
|
* OPTIONAL object storage (FILE_STORAGE SPEC §6): an `ObjectStore` instance, or `'env'` to build
|
|
204
225
|
* an `S3ObjectStore` from `OBJECT_STORAGE_*` (`loadObjectStorageConfig`; storage stays off when
|
|
@@ -313,6 +334,12 @@ export interface ShieldModuleAsyncOptions {
|
|
|
313
334
|
readonly membershipChecker?: MembershipChecker;
|
|
314
335
|
/** See {@link ShieldModuleOptions.emailChangeLinkBaseUrl}. STATIC here (registration-time). */
|
|
315
336
|
readonly emailChangeLinkBaseUrl?: string;
|
|
337
|
+
/** See {@link ShieldModuleOptions.logoutRequiresProof}. STATIC here (registration-time). */
|
|
338
|
+
readonly logoutRequiresProof?: boolean;
|
|
339
|
+
/** See {@link ShieldModuleOptions.signInWith}. STATIC here (registration-time). */
|
|
340
|
+
readonly signInWith?: readonly SignInMethod[];
|
|
341
|
+
/** See {@link ShieldModuleOptions.captcha}. STATIC here (registration-time). */
|
|
342
|
+
readonly captcha?: ShieldCaptchaOption;
|
|
316
343
|
/** See {@link ShieldModuleOptions.storage}. STATIC here (registration-time, like `auth`). */
|
|
317
344
|
readonly storage?: ShieldStorageOption;
|
|
318
345
|
}
|
|
@@ -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,EAAoB,MAAM,cAAc,CAAC;AAQzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAA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
282
|
? { emailChangeLinkBaseUrl: options.emailChangeLinkBaseUrl }
|
|
283
283
|
: {}),
|
|
284
|
+
...(options.logoutRequiresProof !== undefined
|
|
285
|
+
? { logoutRequiresProof: options.logoutRequiresProof }
|
|
286
|
+
: {}),
|
|
287
|
+
...(options.signInWith !== undefined ? { signInWith: options.signInWith } : {}),
|
|
288
|
+
...(options.captcha !== undefined ? { captcha: options.captcha } : {}),
|
|
284
289
|
})
|
|
285
290
|
: undefined;
|
|
286
291
|
return {
|
|
@@ -417,6 +422,11 @@ let ShieldModule = ShieldModule_1 = class ShieldModule {
|
|
|
417
422
|
...(options.emailChangeLinkBaseUrl
|
|
418
423
|
? { emailChangeLinkBaseUrl: options.emailChangeLinkBaseUrl }
|
|
419
424
|
: {}),
|
|
425
|
+
...(options.logoutRequiresProof !== undefined
|
|
426
|
+
? { logoutRequiresProof: options.logoutRequiresProof }
|
|
427
|
+
: {}),
|
|
428
|
+
...(options.signInWith !== undefined ? { signInWith: options.signInWith } : {}),
|
|
429
|
+
...(options.captcha !== undefined ? { captcha: options.captcha } : {}),
|
|
420
430
|
})
|
|
421
431
|
: undefined;
|
|
422
432
|
return {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { Principal, ServiceAuthenticator } from '@astram/core';
|
|
16
16
|
import type { SessionTokenBinder, BoundPrincipalClaims } from './session-token-binder.js';
|
|
17
|
+
import type { MfaRequirementService } from '../session/mfa-requirement-service.js';
|
|
17
18
|
/** Extract a bearer token from an `Authorization: Bearer <token>` header. */
|
|
18
19
|
export declare function extractBearerToken(authorizationHeader: unknown): string | null;
|
|
19
20
|
/**
|
|
@@ -43,7 +44,13 @@ export declare function resolveRequestPrincipal(authorizationHeader: unknown, bi
|
|
|
43
44
|
* uses this so it can read `claims.mustReenroll` to apply the enforced-re-enroll gate
|
|
44
45
|
* while still attaching the resolved `Principal` for `decide()`.
|
|
45
46
|
*/
|
|
46
|
-
export declare function resolveRequestAuth(authorizationHeader: unknown, binder: SessionTokenBinder, serviceAuth?: ServiceAuthenticator
|
|
47
|
+
export declare function resolveRequestAuth(authorizationHeader: unknown, binder: SessionTokenBinder, serviceAuth?: ServiceAuthenticator,
|
|
48
|
+
/**
|
|
49
|
+
* Auth capabilities R2.5 (self-authenticating routes): the mandatory-2FA recompute. Given → the
|
|
50
|
+
* claims are re-evaluated when the tenant's permission version moved past the session's stamp
|
|
51
|
+
* (no DB query otherwise) before they are returned; a failure throws (503, fail closed).
|
|
52
|
+
*/
|
|
53
|
+
mfa?: Pick<MfaRequirementService, 'refresh'> | null): Promise<{
|
|
47
54
|
principal: Principal;
|
|
48
55
|
claims: BoundPrincipalClaims;
|
|
49
56
|
} | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-principal.d.ts","sourceRoot":"","sources":["../../src/request-auth/request-principal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"request-principal.d.ts","sourceRoot":"","sources":["../../src/request-auth/request-principal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAanF,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,mBAAmB,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAK9E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI,CAiClF;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/C;AA4BD;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,mBAAmB,EAAE,OAAO,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,WAAW,CAAC,EAAE,oBAAoB,GACjC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAU3B;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,mBAAmB,EAAE,OAAO,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,WAAW,CAAC,EAAE,oBAAoB;AAClC;;;;GAIG;AACH,GAAG,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,CAAC,GAAG,IAAI,GAClD,OAAO,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,GAAG,IAAI,CAAC,CAiBxE"}
|
|
@@ -132,7 +132,13 @@ async function resolveRequestPrincipal(authorizationHeader, binder, serviceAuth)
|
|
|
132
132
|
* uses this so it can read `claims.mustReenroll` to apply the enforced-re-enroll gate
|
|
133
133
|
* while still attaching the resolved `Principal` for `decide()`.
|
|
134
134
|
*/
|
|
135
|
-
async function resolveRequestAuth(authorizationHeader, binder, serviceAuth
|
|
135
|
+
async function resolveRequestAuth(authorizationHeader, binder, serviceAuth,
|
|
136
|
+
/**
|
|
137
|
+
* Auth capabilities R2.5 (self-authenticating routes): the mandatory-2FA recompute. Given → the
|
|
138
|
+
* claims are re-evaluated when the tenant's permission version moved past the session's stamp
|
|
139
|
+
* (no DB query otherwise) before they are returned; a failure throws (503, fail closed).
|
|
140
|
+
*/
|
|
141
|
+
mfa) {
|
|
136
142
|
const token = extractBearerToken(authorizationHeader);
|
|
137
143
|
if (token === null)
|
|
138
144
|
return null;
|
|
@@ -145,11 +151,12 @@ async function resolveRequestAuth(authorizationHeader, binder, serviceAuth) {
|
|
|
145
151
|
return null; // uniform fail-closed (malformed/unknown/expired/revoked/outage).
|
|
146
152
|
return { principal: res.principal, claims: claimsFromServicePrincipal(res.principal) };
|
|
147
153
|
}
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
154
|
+
const bound = await binder.resolve(token);
|
|
155
|
+
if (bound === null)
|
|
150
156
|
return null;
|
|
151
|
-
const principal = principalFromClaims(
|
|
157
|
+
const principal = principalFromClaims(bound);
|
|
152
158
|
if (principal === null)
|
|
153
159
|
return null;
|
|
160
|
+
const claims = mfa !== undefined && mfa !== null ? await mfa.refresh(token, bound) : bound;
|
|
154
161
|
return { principal, claims };
|
|
155
162
|
}
|
|
@@ -94,6 +94,36 @@ export interface BoundPrincipalClaims {
|
|
|
94
94
|
* failed) → the next gate-5 reload re-derives once and stamps.
|
|
95
95
|
*/
|
|
96
96
|
readonly scopeSubtreeVersion?: number;
|
|
97
|
+
/**
|
|
98
|
+
* The restricted-session REASON (auth capabilities D-2, R2.3). `'mfa_enrollment'`: a mandatory
|
|
99
|
+
* 2FA policy applies and the user has no confirmed factor, so the session reaches only the
|
|
100
|
+
* enrolment routes (`REENROLL_ALLOWED`) and everything else answers 403 `mfa_enrollment_required`.
|
|
101
|
+
* The re-enrol reason is still carried as `mustReenroll: true` (old bindings and old readers keep
|
|
102
|
+
* working); the effective reason is read with `restrictionOf` (`session/session-restriction.ts`):
|
|
103
|
+
* `restriction ?? (mustReenroll ? 'reenroll' : none)`, plus a passed grace deadline.
|
|
104
|
+
*
|
|
105
|
+
* Like `mustReenroll`, AUTHORITATIVE on the SESSION-CLAIMS entry: `resolve()` overlays it from
|
|
106
|
+
* there, so a change keyed by session id reaches every live access token at once.
|
|
107
|
+
*/
|
|
108
|
+
readonly restriction?: 'reenroll' | 'mfa_enrollment';
|
|
109
|
+
/**
|
|
110
|
+
* The mandatory-2FA grace deadline (R2.4), epoch ms, while the user is required but not enrolled
|
|
111
|
+
* and still inside the grace. Once `now >= deadline` the session counts as `'mfa_enrollment'`
|
|
112
|
+
* restricted (compared on every request, no DB read). Session-claims entry is authoritative.
|
|
113
|
+
*/
|
|
114
|
+
readonly mfaEnrollmentDeadlineMs?: number;
|
|
115
|
+
/**
|
|
116
|
+
* The permission version of `tenantId` the mandatory-2FA requirement was last evaluated at
|
|
117
|
+
* (R2.5). The request path re-evaluates only when the tenant's current version is NEWER (or this
|
|
118
|
+
* stamp is absent); an unchanged version makes no DB query. Session-claims entry is authoritative.
|
|
119
|
+
*/
|
|
120
|
+
readonly mfaRequirementVersion?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Compare-and-set counter for the mandatory-2FA state (absent = 0). Every write of the state
|
|
123
|
+
* (a recompute, a device-confirm clear) increments it, and a recompute writes only when the
|
|
124
|
+
* counter still holds the value it read, so a slow recompute can never undo a device confirm.
|
|
125
|
+
*/
|
|
126
|
+
readonly mfaStateEpoch?: number;
|
|
97
127
|
}
|
|
98
128
|
/**
|
|
99
129
|
* The `cachedFacts` slot a binding stores (ADR-0035): the version, the keys and the optional time
|
|
@@ -103,6 +133,19 @@ export interface BoundPrincipalClaims {
|
|
|
103
133
|
export declare function factsSlot(grants: CoarseGrants): CoarseGrants;
|
|
104
134
|
/** The projection's live roles when it reported them (a string array), else `undefined`. */
|
|
105
135
|
export declare function liveRoleIds(grants: CoarseGrants | null | undefined): string[] | undefined;
|
|
136
|
+
/** The mandatory-2FA state a session-claims entry carries, validated. */
|
|
137
|
+
export interface StoredMfaState {
|
|
138
|
+
restriction?: 'reenroll' | 'mfa_enrollment';
|
|
139
|
+
mfaEnrollmentDeadlineMs?: number;
|
|
140
|
+
mfaRequirementVersion?: number;
|
|
141
|
+
mfaStateEpoch?: number;
|
|
142
|
+
}
|
|
143
|
+
/** The new state a recompute writes ({@link SessionTokenBinder.updateMfaRequirement}). */
|
|
144
|
+
export interface MfaRequirementState {
|
|
145
|
+
readonly restriction?: 'mfa_enrollment';
|
|
146
|
+
readonly mfaEnrollmentDeadlineMs?: number;
|
|
147
|
+
readonly mfaRequirementVersion: number;
|
|
148
|
+
}
|
|
106
149
|
/** Lifetimes the binder applies (security hardening #8). Both optional for back-compat. */
|
|
107
150
|
export interface SessionTokenBinderOptions {
|
|
108
151
|
/**
|
|
@@ -307,6 +350,45 @@ export declare class SessionTokenBinder {
|
|
|
307
350
|
* token simply has no key.
|
|
308
351
|
*/
|
|
309
352
|
resolve(accessToken: string): Promise<BoundPrincipalClaims | null>;
|
|
353
|
+
/**
|
|
354
|
+
* MANDATORY-2FA RECOMPUTE write (R2.5, D-2): store a re-evaluated requirement on the
|
|
355
|
+
* session-claims entry (authoritative for every live token of the session; see `resolve()`).
|
|
356
|
+
* Compare-and-set, so a slow recompute never undoes a newer change:
|
|
357
|
+
* - the entry must still belong to `sessionId` + `tenantId` (a scope-switch moved it → refused);
|
|
358
|
+
* - its `mfaStateEpoch` (absent = 0) must equal `expectedEpoch`, the value the evaluation started
|
|
359
|
+
* from (a device confirm or another recompute since → refused);
|
|
360
|
+
* - a stored stamp NEWER than `state.mfaRequirementVersion` wins (nothing written, refused).
|
|
361
|
+
* The write is ONE script that compares the exact entry it read (review round 1, item A), so of N
|
|
362
|
+
* concurrent recomputes exactly one writes; it keeps the remaining TTL (never extends the
|
|
363
|
+
* session) and increments the epoch. The re-enrol flag is never touched. Returns `false` when
|
|
364
|
+
* refused, gone, or Redis failed — the caller then re-reads the stored state with
|
|
365
|
+
* {@link mfaRequirementOf} and enforces it, or denies (fail closed).
|
|
366
|
+
*/
|
|
367
|
+
updateMfaRequirement(sessionId: string, tenantId: string, expectedEpoch: number, state: MfaRequirementState): Promise<boolean>;
|
|
368
|
+
/**
|
|
369
|
+
* The mandatory-2FA state stored on the session-claims entry, for a recompute whose
|
|
370
|
+
* compare-and-set was refused (review round 1, item A): `null` when the entry is gone, belongs to
|
|
371
|
+
* another node, or Redis failed. A Redis error yields `null` (the caller denies).
|
|
372
|
+
*/
|
|
373
|
+
mfaRequirementOf(sessionId: string, tenantId: string): Promise<StoredMfaState | null>;
|
|
374
|
+
/**
|
|
375
|
+
* R2.7 defence in depth: restrict the session NOW (`restriction: 'mfa_enrollment'`, any grace
|
|
376
|
+
* deadline dropped) after a removal left the user with no confirmed factor while a policy applies.
|
|
377
|
+
* Unconditional rather than compare-and-set (restricting is always the safe direction), and it
|
|
378
|
+
* increments the epoch, so an in-flight recompute that read the old state cannot lift it. The
|
|
379
|
+
* re-enrol flag and the requirement stamp are kept. Returns `false` when the entry is gone or Redis
|
|
380
|
+
* failed.
|
|
381
|
+
*/
|
|
382
|
+
restrictMfaEnrollment(sessionId: string): Promise<boolean>;
|
|
383
|
+
/**
|
|
384
|
+
* DEVICE CONFIRM clear (R2.3, AC-7): the user now has a confirmed factor, so lift BOTH reasons
|
|
385
|
+
* (`mustReenroll` and `restriction`) and any grace deadline on the session-claims entry, keeping
|
|
386
|
+
* its remaining TTL and the requirement stamp, and increment the epoch so an in-flight recompute
|
|
387
|
+
* that started before the confirm cannot write its stale result back. The live token's next
|
|
388
|
+
* request is unrestricted (it is not re-minted). Best-effort: a gone entry or a Redis error leaves
|
|
389
|
+
* the session as it is (still restricted: the safe direction).
|
|
390
|
+
*/
|
|
391
|
+
clearRestriction(sessionId: string): Promise<void>;
|
|
310
392
|
/**
|
|
311
393
|
* Clear the ENFORCED-RE-ENROLL flag for a session — the re-secure is complete
|
|
312
394
|
* (a fresh device was confirmed, spec §4.3). Rewrites the session-claims entry with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-token-binder.d.ts","sourceRoot":"","sources":["../../src/request-auth/session-token-binder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAKjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,oFAAoF;AACpF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CA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