Run the app under a non-owner DB role (INSERT/SELECT only on audit_log) #5
Reference in New Issue
Block a user
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?
audit_logimmutability is enforced by triggers rejecting UPDATE/DELETE/TRUNCATE (crates/db/migrations/0001_audit_log.sql). Triggers are robust against the application's normal DML, but a table owner / superuser can bypass them via DDL —ALTER TABLE audit_log DISABLE TRIGGER,DROP TRIGGER, orSET session_replication_role = replica.To make the append-only guarantee hold even if the app connection is compromised, the application's runtime DB role should be a non-owner with only
INSERTandSELECTonaudit_log(and appropriate grants elsewhere) — so it cannot disable or drop the triggers. Fits naturally into the per-org provisioning model (a migration/owner role separate from the app role).INSERT, SELECTonaudit_log(noUPDATE/DELETE/TRUNCATE, not owner).Source: Plan 1 (audit spine) final review — non-blocking, security hardening.