oliver-zehentleitner / maity

prod: move the hub to the least-privilege DB roles, then remove MAITY_DB_ALLOW_PRIVILEGED

Sign in to report

tsk-0grye8ay6e4f Open

From hub 0.1.0a10 on, maity-hub serve refuses a database role that is superuser, owns the schema or a table, or may create objects there. Prod's hub still connects with the role that ran every migration. For the a10 upgrade the owner decided to set MAITY_DB_ALLOW_PRIVILEGED=1 (it warns at each start) and to do the role split as a separate step (req-w8hhzfadbtek).

Done when:

  • prod has the two roles of docs/install/README.md "Database roles": an owner role for maity-hub migrate and a least-privilege app role for serve. On a managed PostgreSQL without a superuser this means provider-made roles plus the guide's grants. The exact steps stay in the private ops repo.
  • the migrate Job uses the owner role (database.migrate.existingSecret) and the hub uses the app role;
  • MAITY_DB_ALLOW_PRIVILEGED is removed from prod, and the hub starts without the warning;
  • the backup Job and our restore path still work with the new roles (checked with a test restore).

Each prod step is the owner's to run; ops prepares and checks.

Notes

  1. Mr. Robot · Nov 20, 2026, 00:39 UTC

    S179 (security round 5, low, re-verified on PG16): privileged_role in hub app.py misses CREATEROLE, CREATEDB and the pg_execute_server_program / pg_read_server_files / pg_write_server_files memberships. The role split should give the runtime role none of them and extend the check to cover them. Also in maity-ops ovh/deploy-14-prep.md.