feat(desktop): #159 task 9.1 — decoy passphrase layer (DUR-01/03) #162

Merged
amiryahaya merged 1 commit from feat/decoy-passphrase-layer into main 2026-11-11 16:56:16 +01:00
Owner

M9 task 9.1: the decoy passphrase layer (STRIDE gate satisfied by PR #161 - see threat model v1.1 §11).

MasterKeyService (8 new tests):

  • Decoy layer = a second independent passphrase wrap holding a DIFFERENT random master key (own 128-bit salt, Argon2id at KEY-13 floors m=64MiB/t=3/p=1), stored as unlock.decoy.* keychain entries beside the real layer.
  • set_decoy: floor check + same-as-real rejection via silent trial-decrypt of the real wrap. set_unlock_passphrase gains the symmetric check (real must not open decoy).
  • unlock_with_passphrase: trial-decrypt REAL then DECOY; a match loads that tree key and becomes the active tree (ActiveTree::Real/Decoy tracked on the service).
  • Memory isolation invariant: real and decoy keys never co-resident - AppState::lock() clears the master key and resets the tree; each unlock loads exactly one tree.
  • Ladder semantics (STRIDE §11.2): a passphrase matching a layer ALWAYS succeeds even mid-lockout; only no-match attempts increment the persistent ladder (5th arms the lockout).

Commands: set/change/remove_decoy_passphrase; unlock_passphrase_status carries decoy_enabled. Frontend bindings + mocks (Settings decoy UI is 9.2).

Server: zero changes - the decoy layer is device-local, so the server literally cannot distinguish which passphrase was used (stronger than the SRS wording already requires).

cargo 40/40; vitest 1301/1skip; typecheck + lint clean.

M9 task 9.1: the decoy passphrase layer (STRIDE gate satisfied by PR #161 - see threat model v1.1 §11). **MasterKeyService** (8 new tests): - Decoy layer = a second independent passphrase wrap holding a DIFFERENT random master key (own 128-bit salt, Argon2id at KEY-13 floors m=64MiB/t=3/p=1), stored as unlock.decoy.* keychain entries beside the real layer. - set_decoy: floor check + same-as-real rejection via silent trial-decrypt of the real wrap. set_unlock_passphrase gains the symmetric check (real must not open decoy). - unlock_with_passphrase: trial-decrypt REAL then DECOY; a match loads that tree key and becomes the active tree (ActiveTree::Real/Decoy tracked on the service). - **Memory isolation invariant**: real and decoy keys never co-resident - AppState::lock() clears the master key and resets the tree; each unlock loads exactly one tree. - Ladder semantics (STRIDE §11.2): a passphrase matching a layer ALWAYS succeeds even mid-lockout; only no-match attempts increment the persistent ladder (5th arms the lockout). **Commands**: set/change/remove_decoy_passphrase; unlock_passphrase_status carries decoy_enabled. Frontend bindings + mocks (Settings decoy UI is 9.2). Server: zero changes - the decoy layer is device-local, so the server literally cannot distinguish which passphrase was used (stronger than the SRS wording already requires). cargo 40/40; vitest 1301/1skip; typecheck + lint clean.
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.
amiryahaya deleted branch feat/decoy-passphrase-layer 2026-11-11 16:56:17 +01:00
Sign in to join this conversation.
No description provided.