fix(api): M9-audit batch B — auth gates + session revocation + robustness #186

Merged
amiryahaya merged 1 commit from fix/m9-audit-server-auth into main 2026-11-12 07:00:48 +01:00
Owner

Closes #168, closes #169, closes #180, closes #181, closes #182 (umbrella #167, batch B of the fix-all plan).

#168 recovery×panic-lock gate (send + verify, uniform 401, gate precedes burn)
#169 SuperAdmin in all four amr step-up predicates
#180 SessionRevocation.InvalidateAllForUser replaces 6 hand-rolled subsets (CompleteRecovery Id-form hole closed; PanicLock mfa-form closed); PanicLockSessionExtensions deleted
#181 FileActivityCleanup ID-select-then-delete (Postgres-translatable; retention actually runs now)
#182 SendOtpAsync rethrows; TotpEncryption.Decrypt length guard; lower(Email) one-time migration
Quota Tenant.StorageQuotaBytes enforced on both upload paths (null/0 = unlimited)

10 new tests; suite 1023/0/39 locally (one unrelated sweep flake seen once, green on rerun).

Closes #168, closes #169, closes #180, closes #181, closes #182 (umbrella #167, batch B of the fix-all plan). **#168** recovery×panic-lock gate (send + verify, uniform 401, gate precedes burn) **#169** SuperAdmin in all four amr step-up predicates **#180** SessionRevocation.InvalidateAllForUser replaces 6 hand-rolled subsets (CompleteRecovery Id-form hole closed; PanicLock mfa-form closed); PanicLockSessionExtensions deleted **#181** FileActivityCleanup ID-select-then-delete (Postgres-translatable; retention actually runs now) **#182** SendOtpAsync rethrows; TotpEncryption.Decrypt length guard; lower(Email) one-time migration **Quota** Tenant.StorageQuotaBytes enforced on both upload paths (null/0 = unlimited) 10 new tests; suite 1023/0/39 locally (one unrelated sweep flake seen once, green on rerun).
fix(api): M9-audit batch B — auth gates + session revocation + robustness (#168,169,180,181,182 + quota)
All checks were successful
Security CI / security-scan (pull_request) Successful in 3m4s
API CI / build-and-test (pull_request) Successful in 10m39s
97a98ec383
#168: TotpRecovery send + TotpRecoveryVerify now gate on PanicLockedAt —
the email recovery path can no longer bypass a panic lock (uniform
responses, gate precedes code burn).

#169: SuperAdmin included in the ADR-012 admin MFA step-up gate on all
four consumer surfaces (OidcCallback, OidcVerify x2, IdpCallback,
Authenticate) — the platform account no longer authenticates without
step-up.

#180: SessionRevocation.InvalidateAllForUser (Id / mfa:Id / DID forms)
replaces six hand-rolled subsets — CompleteRecovery was leaving live
IdP/email sessions after a compromised-wallet recovery; PanicLock was
leaving mfa-pending sessions. PanicLockSessionExtensions deleted.

#181: FileActivityCleanup selects IDs then deletes (Take+ExecuteDelete
does not translate on Postgres — 90-day retention silently never ran).

#182: SendOtpAsync surfaces failures (callers' 503 branches were dead);
TotpEncryption.Decrypt length-guards truncated blobs to Cryptographic-
Exception (500 loops -> 401+audit); one-time lower(Email) migration for
pre-#59 mixed-case rows.

Quota enforcement: Tenant.StorageQuotaBytes now gates both upload paths
via TenantQuota.CheckAsync (null/0 = unlimited, matching admin UI).

Tests: 10 new (M9AuditBatchBTests). Suite 1023/0/39.
Sign in to join this conversation.
No description provided.