B-4 Bootstrap race admits a second SuperAdmin (deploy-window takeover) #35
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#35
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Bootstrap.cs:49-52, 83-84, 104-109: public unauthenticated setup→confirm guarded by check-then-write AnyAsync(SuperAdmin exists). Two concurrent /setup calls with different emails both persist; HandleConfirm's guard only blocks once a SuperAdmin has TotpEnabled=true — an attacker watching a fresh deployment inside the setup→confirm window self-promotes to SuperAdmin (all /api/admin/*). Rate limit only 20/min/IP.
Fix: partial unique index on SystemRole (WHERE SystemRole IS NOT NULL) or transactional INSERT…WHERE NOT EXISTS; on successful confirm, disable/delete other SuperAdmin candidates. Add concurrency regression test. Full findings + evidence: docs/redesign/2026-11-onboarding-passkey/08-code-baseline-review.md