This repository has been archived on 2026-05-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
app/apps
groombook-ci[bot] 1e417eccb1 fix(api): add FOR UPDATE lock to super user claim transaction
CRITICAL race condition: two concurrent POST /api/setup requests could both
read "no super user exists" before either acquired a lock, allowing two
super users to be created.

Added .for("update") to the staff SELECT query inside the transaction.
PostgreSQL FOR UPDATE serializes concurrent claims — the second transaction
blocks on the lock until the first commits, then sees the existing super user
and returns 409.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-29 03:16:24 +00:00
..