fix(admin): #91 abandoned first-run bootstrap no longer bricks SuperAdmin setup #117
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!117
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/91-bootstrap-recovery"
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?
#91 (M1-closure audit): losing the TOTP QR before confirm permanently bricked first-run setup.
The brick: /setup creates an Active SuperAdmin candidate (TotpEnabled=false, no expiry). Operator closes the tab, QR lost → setup 403'd forever (the guard counted the candidate as 'a SuperAdmin exists'), confirm 401'd without the lost secret's code, /status reported required=false. Only DB surgery recovered a fresh install.
Fix:
Guards that survive (control tests): confirmed SuperAdmin → setup still 403 (no hijack); non-SuperAdmin email collision → 409; #35 single-slot race + unique index untouched; confirm flows unchanged.
Tests: 5 new (BootstrapRecoveryTests): same-email re-issue with old secret verified dead + confirm completes; different-email takeover; /status stays required with a candidate; confirmed-admin hijack guard; real-user email collision. 2 existing tests updated to the new contract (Setup_AbandonedCandidate_Reissues; concurrent-setup invariant is now 'at most one candidate ROW persists' — serialized re-issues legitimately overwrite the same row).
TDD RED x5 → green. Suite 932/0/39 (Release+Debug), coverage gate 87.12%. Closes #91.