feat(desktop): #159 task 9.3 — panic lock (DUR-04) #164

Closed
amiryahaya wants to merge 2 commits from feat/decoy-passphrase-layer into main
Owner

User-initiated account freeze (DUR-04, task 9.3).

Server: migration adds users.PanicLockedAt. POST /api/account/panic-lock (authenticated): sets the flag, revokes ALL sessions (Id / mfa-prefixed / wallet-DID forms via InvalidateSessionsForValues), audits security.panic_locked. Login-path gates: TotpVerify blocks with uniform 401 while locked (email+TOTP has no IdP factor, cannot satisfy re-verification); IdpCallback and OidcCallback clear the lock only on an IdP MFA-factor re-auth (identity re-verification per threat model §11); CompleteRecovery also clears. Matrix row added.

Desktop: panic_lock command; UnlockScreen panic-lock trigger (behind confirm) + frozen panel per F-DUR4.

Known pre-existing: AuthzMatrixTests.Sweep_Member_PassesCentralGates fails on main before this PR (authz sweep 401 cascade; unrelated to this PR — confirmed by running main directly).

User-initiated account freeze (DUR-04, task 9.3). **Server**: migration adds users.PanicLockedAt. POST /api/account/panic-lock (authenticated): sets the flag, revokes ALL sessions (Id / mfa-prefixed / wallet-DID forms via InvalidateSessionsForValues), audits security.panic_locked. Login-path gates: TotpVerify blocks with uniform 401 while locked (email+TOTP has no IdP factor, cannot satisfy re-verification); IdpCallback and OidcCallback clear the lock only on an IdP MFA-factor re-auth (identity re-verification per threat model §11); CompleteRecovery also clears. Matrix row added. **Desktop**: panic_lock command; UnlockScreen panic-lock trigger (behind confirm) + frozen panel per F-DUR4. **Known pre-existing**: AuthzMatrixTests.Sweep_Member_PassesCentralGates fails on main before this PR (authz sweep 401 cascade; unrelated to this PR — confirmed by running main directly).
feat(desktop): #159 task 9.1 — decoy passphrase layer (DUR-01/03)
All checks were successful
Security CI / security-scan (pull_request) Successful in 3m52s
7f66487e71
The M9 STRIDE gate (threat model §11.1, PR #161) is satisfied; this lands
the decoy passphrase layer per its binding decision.

MasterKeyService (8 new tests):
- Decoy layer: a SECOND independent passphrase wrap holding a DIFFERENT
  random master key (own salt, Argon2id at KEY-13 floors), stored as
  unlock.decoy.* keychain entries alongside the real layer.
- set_decoy_passphrase: floor check + same-as-real rejection (client
  trial-decrypts the real wrap with the new passphrase - identical =>
  rejected). set_unlock_passphrase gains the symmetric check: the real
  passphrase must not open the decoy layer. The two layers stay
  independent wraps with independent salts.
- unlock_with_passphrase: trial-decrypt REAL layer first, then DECOY
  layer - whichever matches loads its key and becomes the active tree
  (ActiveTree::Real/Decoy, tracked on the service). A passphrase that
  matches a layer always succeeds even mid-lockout (STRIDE 11.2: a
  correct duress passphrase must never read as evasion under coercion);
  the ladder counts only attempts matching NO layer.
- Memory isolation (DUR-01 invariant): real and decoy keys are never
  loaded simultaneously - a lock cycle clears key material and resets
  the tree; each unlock loads exactly one tree's key. AppState::lock()
  now clears the master key (security improvement on its own: no key
  lingers in memory while locked).
- change/remove decoy passphrase (requires current decoy passphrase).

Commands: set/change/remove_decoy_passphrase; unlock_passphrase_status
gains decoy_enabled. Frontend bindings + mocks (Settings UI is task
9.2's decoy-workspace UX).

cargo 40/40 (8 new decoy tests incl. cross-layer independence,
ladder-always-allows-correct-match mid-lockout, memory isolation across
lock cycles); vitest 1301/1skip; typecheck + lint clean.
feat(identity): #159 task 9.3 — panic lock (DUR-04)
Some checks failed
API CI / build-and-test (pull_request) Failing after 1m35s
Security CI / security-scan (pull_request) Successful in 2m29s
4998b26f97
Server: user-initiated account freeze. Migration adds users.PanicLockedAt
(timestamp nullable). POST /api/account/panic-lock (authenticated): sets
the flag, revokes ALL sessions (Id / mfa-prefixed / wallet-DID forms),
audits security.panic_locked. Login-path gates: TotpVerify blocks with
uniform 401 while locked (email+TOTP has no IdP factor); IdpCallback and
OidcCallback clear the lock only on an IdP MFA-factor re-auth (identity
re-verification per threat model §11). CompleteRecovery also clears.

Tests: 5 server tests — lifecycle (flag + audit), second-call conflict,
TOTP block with valid code, gate clear/deny branches.

AuthzMatrixTests Sweep_Member_PassesCentralGates fails pre-existing on
main (unrelated — authz sweep 401 cascade, not this PR's changes).
amiryahaya closed this pull request 2026-11-11 18:11:37 +01:00
Some checks failed
API CI / build-and-test (pull_request) Failing after 1m35s
Security CI / security-scan (pull_request) Successful in 2m29s
Required
Details

Pull request closed

Sign in to join this conversation.
No description provided.