Bootstrapping an admin
There is no HTTP path to grant is_admin = TRUE. The first admin (and every subsequent admin) must be set via direct DB access. This is intentional — keeping the promotion path narrow makes social engineering harder and forces the trail to land in the Postgres-level audit log.
Granting
Section titled “Granting”UPDATE publishers SET is_admin = TRUE WHERE name = 'your-handle';What happens automatically:
- The
publishers_mfa_sticky_trgtrigger from migration 033 setsmfa_required = TRUEon the same row. - The next time that user attempts to log in, the auth flow refuses to issue a session until they’ve enrolled a TOTP or WebAuthn factor at
/dashboard/settings/mfa. - The MFA flag is sticky — even if you later set
is_admin = FALSE, the user must keep using MFA to log in.
Demoting
Section titled “Demoting”UPDATE publishers SET is_admin = FALSE WHERE name = 'your-handle';Operational requirements
Section titled “Operational requirements”Configure Postgres to log every promotion:
# postgresql.conflog_statement = 'mod' # logs INSERT/UPDATE/DELETElog_min_duration_statement = 0Optional but recommended:
- Enable
pg_auditand addpublishersto the audit set so promotions write to the cluster-level audit log in addition toaudit_logs. - Send a webhook to a dedicated #security Slack channel whenever a row in
publishershasis_adminflip. A LISTEN/NOTIFY-driven worker is the simplest path. - Restrict the
singularity_approle fromUPDATE publishers SET is_admin = …. Promotions should come from a DBA role with separate credentials.
Verifying after promotion
Section titled “Verifying after promotion”SELECT id, name, is_admin, mfa_required FROM publishers WHERE is_admin = TRUE;Then verify the application-level state:
# As the newly-promoted admin, after enrolling MFA + logging in:curl -H "Cookie: singularity_session=..." \ https://api.singularitymarketplace.com/api/v1/admin/statsIf this returns 401 they aren’t logged in; 403 means they haven’t enrolled MFA yet; 200 means they’re a fully-fledged admin.
Related
Section titled “Related”- Admin Console — what admins can do once promoted.