Access & Backup Self-Audit
A self-audit checklist based on real PostgreSQL defense-in-depth principles. Check off the security controls currently verified in your database to generate an instant, copy-paste posture report and SQL remediation queries.
Database Defense Checklist (8 Controls)
3 verifiedIf RLS is disabled, anyone with an anon API key can query or mutate rows via REST endpoints.
SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND rowsecurity = false;Ensure SUPABASE_SERVICE_ROLE_KEY or database superuser credentials do not have NEXT_PUBLIC_ prefixes.
Standard nightly dumps lose up to 24 hours of operational journals. PITR enables restoration to any second.
An untested backup is not a backup. You must prove the restore snapshot can boot and pass table balance checks.
Every UPDATE and DELETE on accounting, order, or stock ledgers must record the actor, timestamp, and previous state.
SELECT event_id FROM audit_log LIMIT 1;Unencrypted database connections expose passwords and sensitive business data to network sniffing.
SHOW ssl;Client API routes should connect using a restricted role; migrations and maintenance should use a separate DDL role.
Automated tests verifying User A cannot query Organization B rows, even if they forge HTTP headers.
Database Security Index
=====================================================
POSTGRES / SUPABASE SECURITY & BACKUP AUDIT REPORT
Generated: 2026-10-27T13:15:18.824Z
Security Score: 38% (3/8 checks passed)
Status: Critical Vulnerabilities Detected
=====================================================
PASSED CONTROLS:
[PASS] [CRITICAL] Row Level Security (RLS) enabled on all public schema tables
[PASS] [CRITICAL] Service role / admin key NEVER exposed in client bundle
[PASS] [MEDIUM] SSL/TLS enforced on all incoming database connections
FAILED / UNCHECKED CONTROLS:
[FAIL] [HIGH] Point-In-Time Recovery (PITR) enabled & active
Remediation: Enable continuous Write-Ahead Log (WAL) archiving via cloud provider or pgBackRest.
[FAIL] [HIGH] Database restore drill verified within the last 90 days
Remediation: Schedule a quarterly drill: restore latest snapshot into an isolated sandbox and verify checksums.
[FAIL] [HIGH] Immutable append-only audit trail on financial / inventory mutations
Remediation: Attach an un-droppable PostgreSQL BEFORE/AFTER trigger writing to an append-only audit_logs table.
[FAIL] [MEDIUM] Least-privilege connection pooling (separate web vs worker roles)
Remediation: Create distinct database roles with GRANT SELECT, INSERT, UPDATE on specific tables only.
[FAIL] [HIGH] Explicit policy test suite for tenant isolation
Remediation: Write unit tests in pgTAP or integration tests executing queries under different user JWTs.
=====================================================
Audited via arslanrehmani.com/tools/access-audit