[medium] Open registration by default; first-user admin logic re-promotes #12
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?
Severity: medium
Affects: main
Files: lib/fuzzy_catalog/admin_settings.ex:77 (registration_enabled default true), lib/fuzzy_catalog/accounts.ex:151-163
A freshly deployed instance lets anyone register, and the first registrant becomes admin. ensure_first_user_is_admin runs on every registration and re-promotes the oldest user if an admin demoted them. The email-registration path promotes an unconfirmed user.
Fix: only promote when the user count is 1, inside the insert transaction; consider defaulting registration off (env var REGISTRATION_ENABLED, settings UI as fallback).
Found by Nye's audit, 2026-10-18 (static review of main @
1d89af4and jtk/ebook-management @43a849e).jfro referenced this issue2026-10-18 17:22:25 +00:00