feat(keys): KEY-17 recovery-initiation anti-abuse (#136 slice 1, H-4) #137
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!137
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/136-key17-anti-abuse"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#136 slice 1 — KEY-17 (H-4) recovery-initiation anti-abuse, the server-side core of Phase 3 task 3.8:
Tests: 6 new (RED ×6): owner alerts on both paths, cancel by owner sets Cancelled + notifies trustees, cancel by non-owner 403, cool-down after cancel (429 with recovery_cooldown), stale-session approval rejected + fresh passes. Plus SEC-04 matrix row; TestFixture minted sessions now stamp LastLoginAt (they model real logins).
Suite 977/0/39 (Release+Debug), coverage gate 87.62%. Slice 1 of #136; slice 2 (H-4 trustee-only ServerShare removal) next.
- Owner alert on BOTH initiation paths (public DID + settings-screen session): in-app durable notification (recovery_alert — visible on every enrolled device) + best-effort email (new IEmailService.SendRecoveryAlertAsync; Null + Resend impls). An initiation the owner did not make is an attack signal with a visible cancel path. - Per-account cool-down (15 min, RecoveryConstants): an initiation is not immediately repeatable even after the owner cancels — 429 recovery_cooldown + security.recovery_cooldown audit on both paths. - Owner cancel endpoint: POST /requests/{id}/cancel — requester-only, Pending → new Cancelled status (enum member, string storage = no migration), trustees notified the request was withdrawn. - Trustee approval recent-auth gate (IDA-07): LastLoginAt older than 15 min (or absent) → 403 reauth_required + security audit — a phished long-lived session cannot approve a recovery. - SEC-04 matrix row for the cancel route; TestFixture session minting now stamps LastLoginAt (minted sessions model real logins). 6 new tests (RED ×6): owner alerts on both paths, cancel by owner/non-owner, cool-down after cancel, stale-session approval rejection. Suite 977/0/39 Release+Debug, coverage 87.62%.