provision-env-db: revoke PUBLIC connect on the owner database too #108
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Jinemi/thermograph#108
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/harden-owner-db-connect"
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?
Caught live during the vps1/vps2 cutover, by the runbook's own isolation check.
provision-env-db.sh betarevokedCONNECTfromPUBLICon beta's database and stopped there. But a fresh Postgres database carries=TcforPUBLIC—TEMPandCONNECT— so prod's database still had the default, and the newly createdthermograph_betarole could open a session against it:Revoking on the guest's own database is the half that doesn't matter; the half that does is the database you are trying to protect.
The fix hardens the owner environment's database as part of provisioning a guest, and orders it carefully: the owner's read-only role (
thermograph_ro, whichops/dbq.shconnects as) gets an explicitCONNECTgrant before the revoke, so hardening cannot strip the ad-hoc query path of its access. The owner's app role owns the database and is a superuser, so it is unaffected either way.Already applied by hand on vps2 — this makes the script reproduce that state rather than a false sense of it, which matters on any rebuild or re-run. Post-fix, live:
The runbook now records the incident next to the check that found it, so the check reads as load-bearing rather than ceremonial.