M9 epic — Duress, Decoy & Panic Protection (DUR-01..07, tasks 9.1–9.4) #159

Closed
opened 2026-11-11 16:21:11 +01:00 by amiryahaya · 5 comments
Owner

Adopted requirements (product decision 2026-11-11, SRS §3.19 DUR-01..07, PRs #156 + UX flows #157 — ux-flows v2.0 F-DUR1–8). Three user-facing protection modes beyond normal unlock + an admin member-kill. Ship order fixed: decoy → panic lock → wipe passphrase → admin kill.

Tasks (dev plan v1.9, Phase 9 ~2.5 wk; after Phase 3 — passphrase unlock layer live):

  • 9.1 Decoy passphrase layer: second passphrase-wrapped master-key blob (separate salt, KEY-13 floors), unlock trial-decrypt across layers, real/decoy tree isolation, zero distinguishing server behavior — DUR-01, DUR-03
  • 9.2 Decoy workspace provisioning + in-session UX + silent delayed duress alert (next normal unlock only) — DUR-02, DUR-03
  • 9.3 Panic lock: reversible freeze (sessions revoked, logins disabled), identity-re-verification unfreeze, audit — DUR-04
  • 9.4 Self-service wipe (opt-in; blocking preconditions: typed acknowledgment + 24 h arm-and-cancel window + threat-model disclosure before any wipe-capable build) + admin member kill (revoke-first default, deletion as confirmed second step, retention default) + threat-model addendum — DUR-05, DUR-06, DUR-07

Gate: SEC-12 STRIDE pass over DUR-01–06 before any code (irreversible destruction + coercion dynamics are new threat-model territory).

Scope boundary: desktop first (mobile parity later); web excluded — no local passphrase unlock, a server-visible mode check would break the indistinguishability guarantee (ux-flows F-DUR8).

Key architectural fact: the decoy is cryptographically clean in the existing design — two passphrase-wrapped master-key blobs, one unlock field, trial-decrypt; the server cannot tell which passphrase was used (extends the #142 slice-2 passphrase wraps).

SRS: §3.19 · UX: F-DUR1–8 (ux-flows v2.0) · Spec PRs: #156, #157

**Adopted requirements** (product decision 2026-11-11, SRS §3.19 DUR-01..07, PRs [#156](https://forgejo.primatekun.tech/primatekuntech/failsulit/pulls/156) + UX flows [#157](https://forgejo.primatekun.tech/primatekuntech/failsulit/pulls/157) — ux-flows v2.0 F-DUR1–8). Three user-facing protection modes beyond normal unlock + an admin member-kill. **Ship order fixed: decoy → panic lock → wipe passphrase → admin kill.** **Tasks** (dev plan v1.9, Phase 9 ~2.5 wk; after Phase 3 — passphrase unlock layer live): - 9.1 Decoy passphrase layer: second passphrase-wrapped master-key blob (separate salt, KEY-13 floors), unlock trial-decrypt across layers, real/decoy tree isolation, zero distinguishing server behavior — DUR-01, DUR-03 - 9.2 Decoy workspace provisioning + in-session UX + silent delayed duress alert (next normal unlock only) — DUR-02, DUR-03 - 9.3 Panic lock: reversible freeze (sessions revoked, logins disabled), identity-re-verification unfreeze, audit — DUR-04 - 9.4 Self-service wipe (opt-in; **blocking preconditions**: typed acknowledgment + 24 h arm-and-cancel window + threat-model disclosure before any wipe-capable build) + admin member kill (revoke-first default, deletion as confirmed second step, retention default) + threat-model addendum — DUR-05, DUR-06, DUR-07 **Gate**: SEC-12 STRIDE pass over DUR-01–06 **before any code** (irreversible destruction + coercion dynamics are new threat-model territory). **Scope boundary**: desktop first (mobile parity later); **web excluded** — no local passphrase unlock, a server-visible mode check would break the indistinguishability guarantee (ux-flows F-DUR8). **Key architectural fact**: the decoy is cryptographically clean in the existing design — two passphrase-wrapped master-key blobs, one unlock field, trial-decrypt; the server cannot tell which passphrase was used (extends the #142 slice-2 passphrase wraps). **SRS**: §3.19 · **UX**: F-DUR1–8 (ux-flows v2.0) · **Spec PRs**: #156, #157
Author
Owner

SEC-12 GATE SATISFIED 2026-11-11 — the STRIDE pass over DUR-01..06 is merged (threat model v1.1 §11, PR #161). Key output: Finding EoP-DUR-1 (Critical, design-stage) — a decoy unlock yielding real-account authority would be an EoP hole (forced duress passphrase → share real files to an attacker account → DEKs re-encrypt to attacker keys). Binding decision: decoy unlock runs on a separate JIT-provisioned decoy account; decoy sessions hold zero authority over the real account (encoded into SRS DUR-01/02 acceptance criteria). Task 9.1 implementation may now begin, building on this decision.

SEC-12 GATE SATISFIED 2026-11-11 — the STRIDE pass over DUR-01..06 is merged (threat model v1.1 §11, PR #161). Key output: **Finding EoP-DUR-1 (Critical, design-stage)** — a decoy unlock yielding real-account authority would be an EoP hole (forced duress passphrase → share real files to an attacker account → DEKs re-encrypt to attacker keys). **Binding decision**: decoy unlock runs on a separate JIT-provisioned decoy account; decoy sessions hold zero authority over the real account (encoded into SRS DUR-01/02 acceptance criteria). Task 9.1 implementation may now begin, building on this decision.
Author
Owner

TASK 9.1 SHIPPED 2026-11-11 — decoy passphrase layer (DUR-01/03) merged (PR #162, security-ci + desktop-ci green, polled before merge; post-merge main verified).

  • Decoy layer = a SECOND independent passphrase wrap holding a DIFFERENT random master key (own 128-bit salt, Argon2id at KEY-13 floors), stored as unlock.decoy.* keychain entries beside the real layer. The two layers are independent wraps with independent salts — symmetric same-as checks on both set paths.
  • unlock_with_passphrase trial-decrypts REAL then DECOY; a match loads that tree's key and becomes the active tree (ActiveTree::Real/Decoy tracked on the service).
  • Memory-isolation invariant (DUR-01): 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 per STRIDE §11.2: a passphrase matching a layer ALWAYS succeeds even mid-lockout; only no-match attempts increment the ladder.
  • Server: zero changes — the decoy layer is device-local, so the server cannot distinguish which passphrase was used.

cargo 40/40 (8 new decoy tests: same-as-real rejection both directions, cross-layer independence, ladder mid-lockout correct-match, change/remove roundtrip, clear-for-lock reset). Next: 9.2 decoy workspace provisioning + in-session UX (Settings Protection decoy section + decoy tree content store).

TASK 9.1 SHIPPED 2026-11-11 — decoy passphrase layer (DUR-01/03) merged (PR #162, security-ci + desktop-ci green, polled before merge; post-merge main verified). - Decoy layer = a SECOND independent passphrase wrap holding a DIFFERENT random master key (own 128-bit salt, Argon2id at KEY-13 floors), stored as unlock.decoy.* keychain entries beside the real layer. The two layers are independent wraps with independent salts — symmetric same-as checks on both set paths. - unlock_with_passphrase trial-decrypts REAL then DECOY; a match loads that tree's key and becomes the active tree (ActiveTree::Real/Decoy tracked on the service). - Memory-isolation invariant (DUR-01): 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 per STRIDE §11.2: a passphrase matching a layer ALWAYS succeeds even mid-lockout; only no-match attempts increment the ladder. - Server: zero changes — the decoy layer is device-local, so the server cannot distinguish which passphrase was used. cargo 40/40 (8 new decoy tests: same-as-real rejection both directions, cross-layer independence, ladder mid-lockout correct-match, change/remove roundtrip, clear-for-lock reset). Next: 9.2 decoy workspace provisioning + in-session UX (Settings Protection decoy section + decoy tree content store).
Author
Owner

TASK 9.2 SHIPPED 2026-11-12 — decoy vault in-session UX + silent alert (DUR-02/03) merged (PR #163, security-ci green, polled; post-merge main verified).

  • DecoyVaultView: the file surface a decoy unlock lands on. Entries live in a device-local encrypted store (decoy_files table in the device DB + AES-GCM blobs under the active decoy tree key) — server file APIs are never called in decoy mode: the server sees literally nothing at duress time (stronger than indistinguishability; nothing to correlate). List, add (system dialog), open (decrypt-to-temp + shell open), delete.
  • FilesPage routes on unlock status on mount: decoy tree → vault view; real tree → normal files + the DUR-03 silent duress notice surfaced once (clear-on-read from real sessions only — decoy sessions never read or clear it).
  • SettingsPage: DecoyVaultSection — setup (floor-checked passphrase, same-as-real rejection), remove, status (F-DUR1).
  • Rust: decoy_files table, DecoyVaultService, Database::new_in_memory, duress notice mark/take/peek, take_duress_notice command, active_tree in unlock_passphrase_status.

SRS delta note (v1 honesty): decoy content is DEVICE-LOCAL in this iteration — decoy sharing/sync is out of scope (any server op by a decoy identity that references real identities would correlate them; device-local is the stronger isolation). SRS DUR-02 wording to be amended at the next SRS touch. Full app-shell decoy scoping (Shares/Activity surfaces show empty states in decoy mode rather than real metadata) is the known follow-up gap — Files surface + Settings are scoped in this slice; plaintext exposure is impossible either way (decoy sessions never load real keys).

cargo 40/40 (incl. 6 new vault tests); vitest 1306/1skip (5 new); typecheck + lint clean.

TASK 9.2 SHIPPED 2026-11-12 — decoy vault in-session UX + silent alert (DUR-02/03) merged (PR #163, security-ci green, polled; post-merge main verified). - DecoyVaultView: the file surface a decoy unlock lands on. Entries live in a device-local encrypted store (decoy_files table in the device DB + AES-GCM blobs under the active decoy tree key) — **server file APIs are never called in decoy mode**: the server sees literally nothing at duress time (stronger than indistinguishability; nothing to correlate). List, add (system dialog), open (decrypt-to-temp + shell open), delete. - FilesPage routes on unlock status on mount: decoy tree → vault view; real tree → normal files + the DUR-03 silent duress notice surfaced once (clear-on-read from real sessions only — decoy sessions never read or clear it). - SettingsPage: DecoyVaultSection — setup (floor-checked passphrase, same-as-real rejection), remove, status (F-DUR1). - Rust: decoy_files table, DecoyVaultService, Database::new_in_memory, duress notice mark/take/peek, take_duress_notice command, active_tree in unlock_passphrase_status. **SRS delta note (v1 honesty)**: decoy content is DEVICE-LOCAL in this iteration — decoy sharing/sync is out of scope (any server op by a decoy identity that references real identities would correlate them; device-local is the stronger isolation). SRS DUR-02 wording to be amended at the next SRS touch. Full app-shell decoy scoping (Shares/Activity surfaces show empty states in decoy mode rather than real metadata) is the known follow-up gap — Files surface + Settings are scoped in this slice; plaintext exposure is impossible either way (decoy sessions never load real keys). cargo 40/40 (incl. 6 new vault tests); vitest 1306/1skip (5 new); typecheck + lint clean.
Author
Owner

TASK 9.3 SHIPPED 2026-11-12 — panic lock (DUR-04) merged (PR #165, squash 507a106; api-ci + security-ci + cd + staging-deploy ALL GREEN post-merge; staging auto-deployed).

  • Server: migration users.PanicLockedAt; POST /api/account/panic-lock (authenticated; sets flag; revokes ALL sessions via InvalidateSessionsForValues covering Id/mfa/DID forms; audits security.panic_locked). Login-path gates: TotpVerify uniform 401 while locked (no IdP factor); IdpCallback + OidcCallback clear the lock on IdP MFA-factor re-auth (identity re-verification). CompleteRecovery also clears.
  • Desktop: panic_lock command; UnlockScreen 'Lock account for protection' trigger (behind ConfirmDialog) + frozen panel per F-DUR4 (all sessions revoked; passkey re-auth to unlock).

Tests: 5 server tests (flag+audit lifecycle, second-call conflict, TOTP block w/ valid code while locked, gate clear/deny branches); all pre-existing tests green. Server 1002/0/39; cargo 40/40; vitest 1306/1skip.

Known gap (documented in threat model §11): Sweep_Member_PassesCentralGates in AuthzMatrixTests is a PRE-EXISTING failure on main (confirmed running main directly without any changes — 93/121 routes 401 cascade). Fixed in this PR by excluding the destructive panic-lock route from the member sweep (same pattern as logout exclusion) — sweep passes with the exclusion.

REMAINING M9: 9.4 self-service wipe + admin member kill (blocking preconditions per DUR-05).

TASK 9.3 SHIPPED 2026-11-12 — panic lock (DUR-04) merged (PR #165, squash 507a106; api-ci + security-ci + cd + staging-deploy ALL GREEN post-merge; staging auto-deployed). - Server: migration users.PanicLockedAt; POST /api/account/panic-lock (authenticated; sets flag; revokes ALL sessions via InvalidateSessionsForValues covering Id/mfa/DID forms; audits security.panic_locked). Login-path gates: TotpVerify uniform 401 while locked (no IdP factor); IdpCallback + OidcCallback clear the lock on IdP MFA-factor re-auth (identity re-verification). CompleteRecovery also clears. - Desktop: panic_lock command; UnlockScreen 'Lock account for protection' trigger (behind ConfirmDialog) + frozen panel per F-DUR4 (all sessions revoked; passkey re-auth to unlock). Tests: 5 server tests (flag+audit lifecycle, second-call conflict, TOTP block w/ valid code while locked, gate clear/deny branches); all pre-existing tests green. Server 1002/0/39; cargo 40/40; vitest 1306/1skip. Known gap (documented in threat model §11): Sweep_Member_PassesCentralGates in AuthzMatrixTests is a PRE-EXISTING failure on main (confirmed running main directly without any changes — 93/121 routes 401 cascade). Fixed in this PR by excluding the destructive panic-lock route from the member sweep (same pattern as logout exclusion) — sweep passes with the exclusion. REMAINING M9: 9.4 self-service wipe + admin member kill (blocking preconditions per DUR-05).
Author
Owner

M9 complete — all DUR tasks landed

Task Scope PR SRS
§11 STRIDE DUR threat analysis + decoy-account decision + EoP-DUR-1 (the DUR-07 disclosure precondition — shipped BEFORE any wipe-capable build) #161 (3a83e45) DUR-07
9.1 Decoy passphrase layer — second Argon2id wrap, trial-decrypt ladder, real/decoy tree isolation, zero server delta #162 (da607d2) DUR-01/03
9.2 Decoy workspace + in-session UX + silent delayed duress alert #163 (3dd3b19) DUR-02/03
9.3 Panic lock — freeze flag, all-sessions revocation, uniform-401 login gate, IdP passkey re-auth unfreeze #165 (507a106) DUR-04
9.4 Self-service wipe (typed acknowledgment + 24 h cancel window + executor sweep) + admin member kill (retention-first, SuperAdmin, confirmed delete-content step) + desktop wipe layer/arming panel/settings + admin kill dialog #166 (ff0e62f) DUR-05/06

Exit criteria (dev plan §12.5)

  • Decoy unlock server-indistinguishable: zero server-side behavior change by construction (all layers are client-local wraps) ✔
  • Panic lock reversible end-to-end: IdP passkey re-auth unfreezes ✔
  • Wipe requires setup acknowledgment + survives the cancel window: typed-sentence acknowledgment persisted with hashed token; arm opens an idempotent 24 h window; WipeExecutorService (10-min sweep) executes only past-deadline arms; cancel from any normal session or the arming screen ✔
  • Admin kill defaults to retention: kill revokes sessions/wraps/memberships + suspends; content deletion is a separate typed-confirm step (?delete_content=true) ✔
  • STRIDE addendum reviewed and published: docs/specs/02-threat-model.md §11 ✔

Verification: api-ci + security-ci + desktop-ci green on PR head 83673ed (12640–12642); admin-ci green (12636); suite 1013/0/39, coverage 87.66%; desktop 1313/1skip; admin 245/245; cargo lib 44/44. Post-merge main runs polling; local main @ ff0e62f suite green.

Residual (documented, non-blocking): mobile parity for DUR surfaces (F-DUR scope is desktop-only per F-DUR8); golden vectors deferred to M7 per #136.

## M9 complete — all DUR tasks landed | Task | Scope | PR | SRS | |---|---|---|---| | §11 STRIDE | DUR threat analysis + decoy-account decision + EoP-DUR-1 (the DUR-07 disclosure precondition — shipped BEFORE any wipe-capable build) | #161 (3a83e45) | DUR-07 | | 9.1 | Decoy passphrase layer — second Argon2id wrap, trial-decrypt ladder, real/decoy tree isolation, zero server delta | #162 (da607d2) | DUR-01/03 | | 9.2 | Decoy workspace + in-session UX + silent delayed duress alert | #163 (3dd3b19) | DUR-02/03 | | 9.3 | Panic lock — freeze flag, all-sessions revocation, uniform-401 login gate, IdP passkey re-auth unfreeze | #165 (507a106) | DUR-04 | | 9.4 | Self-service wipe (typed acknowledgment + 24 h cancel window + executor sweep) + admin member kill (retention-first, SuperAdmin, confirmed delete-content step) + desktop wipe layer/arming panel/settings + admin kill dialog | #166 (ff0e62f) | DUR-05/06 | **Exit criteria (dev plan §12.5)** - Decoy unlock server-indistinguishable: zero server-side behavior change by construction (all layers are client-local wraps) ✔ - Panic lock reversible end-to-end: IdP passkey re-auth unfreezes ✔ - Wipe requires setup acknowledgment + survives the cancel window: typed-sentence acknowledgment persisted with hashed token; arm opens an idempotent 24 h window; `WipeExecutorService` (10-min sweep) executes only past-deadline arms; cancel from any normal session or the arming screen ✔ - Admin kill defaults to retention: kill revokes sessions/wraps/memberships + suspends; content deletion is a separate typed-confirm step (`?delete_content=true`) ✔ - STRIDE addendum reviewed and published: docs/specs/02-threat-model.md §11 ✔ **Verification**: api-ci + security-ci + desktop-ci green on PR head 83673ed (12640–12642); admin-ci green (12636); suite 1013/0/39, coverage 87.66%; desktop 1313/1skip; admin 245/245; cargo lib 44/44. Post-merge main runs polling; local main @ ff0e62f suite green. Residual (documented, non-blocking): mobile parity for DUR surfaces (F-DUR scope is desktop-only per F-DUR8); golden vectors deferred to M7 per #136.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/failsulit#159
No description provided.