Audit an Existing PostgreSQL Database with Safegres
Dan Lynch
Use this guide if you already have a PostgreSQL database. You don't need PGPM or a new database.
Run a direct audit
Run the audit from a clean directory outside the PGPM workspace so it doesn't pick up the lab's Safegres config.
Use a read-only account. If it requires a password, set PGPASSWORD in your environment; .pgpass alone won't work.
bashexport PGHOST=localhost PGPORT=5432 PGUSER=auditor PGDATABASE=my_database npx safegres audit --database "$PGDATABASE" --report-only
Safegres reads the catalog without changing the database or running application queries. Start with the grants and row-level security findings. Without an exposure config, Safegres assumes the whole database is reachable and reports W1.
Working from migrations instead? Install Safegres and audit a PGPM workspace.

