apps(farrisilk): close the metabase_ro schema-CREATE hole + README
metabase_ro could create tables in public: default_transaction_read_only is a role default the role can lift (SET ... = off), and PG16 keeps CREATE on schema public for PUBLIC when the database was created by a non-superuser (Odoo creates its own). Revoke CREATE from PUBLIC and ALL from metabase_ro, grant USAGE only, in both the first-boot script and the per-start grant pass. README documents the stack, list_db/workers=0 rationale, module loading, filestore, the DB-only backup gap (filestore is not covered; follow-up t_8bdd3708) and the Shopify blank.
This commit is contained in:
parent
4891694f6f
commit
f658bfabe9
3 changed files with 291 additions and 0 deletions
|
|
@ -116,6 +116,14 @@ data:
|
|||
# Read-only BI grants + credential-table revokes.
|
||||
gconn = connect(DB, SUPER_USER, SUPER_PW)
|
||||
gcur = gconn.cursor()
|
||||
# PostgreSQL 16 leaves CREATE on schema public granted to PUBLIC in a
|
||||
# database created by a NON-SUPERUSER (Odoo creates its own database as
|
||||
# `odoo`), so `default_transaction_read_only` is the only thing stopping
|
||||
# metabase_ro from creating tables — and a role may lift its own default
|
||||
# with `SET default_transaction_read_only = off`. Privileges are the real
|
||||
# guard: PUBLIC loses CREATE, metabase_ro gets USAGE only.
|
||||
gcur.execute("REVOKE CREATE ON SCHEMA public FROM PUBLIC")
|
||||
gcur.execute("REVOKE ALL ON SCHEMA public FROM metabase_ro")
|
||||
gcur.execute("GRANT USAGE ON SCHEMA public TO metabase_ro")
|
||||
gcur.execute("GRANT SELECT ON ALL TABLES IN SCHEMA public TO metabase_ro")
|
||||
gcur.execute(
|
||||
|
|
|
|||
Loading…
Reference in a new issue