Bug: Admin-bootstrap race (first-user admin assignment) #79

Closed
opened 2026-07-08 02:40:30 +00:00 by icub3d · 0 comments
Owner

Severity: High (correctness) — found in code review 2026-07-07.

Problem

server/src/auth/handlers.rs:98: the first user becomes admin via list_users().len() == 1. Two concurrent registrations can interleave (A creates, B creates, then both list → 2) so that no one receives the admin role, leaving the server without an administrator.

Fix

  • Perform the bootstrap (first-user → admin) atomically — a transaction with a guard, or a dedicated one-time bootstrap step / config-driven owner pubkey.

Acceptance

  • Concurrent first-registrations deterministically produce exactly one admin (test)
**Severity: High (correctness)** — found in code review 2026-07-07. ## Problem `server/src/auth/handlers.rs:98`: the first user becomes admin via `list_users().len() == 1`. Two concurrent registrations can interleave (A creates, B creates, then both list → 2) so that **no one** receives the admin role, leaving the server without an administrator. ## Fix - [ ] Perform the bootstrap (first-user → admin) atomically — a transaction with a guard, or a dedicated one-time bootstrap step / config-driven owner pubkey. ## Acceptance - [ ] Concurrent first-registrations deterministically produce exactly one admin (test)
Sign in to join this conversation.
No milestone
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
icub3d/decentcom#79
No description provided.