Arslan Rehmani
Tools Suite/Access & Backup Self-Audit
Postgres & Supabase Security Checklist • Copy-Paste Report

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 verified
Row Level Security (RLS) enabled on all public schema tablesCRITICAL

If 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;
Service role / admin key NEVER exposed in client bundleCRITICAL

Ensure SUPABASE_SERVICE_ROLE_KEY or database superuser credentials do not have NEXT_PUBLIC_ prefixes.

Point-In-Time Recovery (PITR) enabled & activeHIGH

Standard nightly dumps lose up to 24 hours of operational journals. PITR enables restoration to any second.

Database restore drill verified within the last 90 daysHIGH

An untested backup is not a backup. You must prove the restore snapshot can boot and pass table balance checks.

Immutable append-only audit trail on financial / inventory mutationsHIGH

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;
SSL/TLS enforced on all incoming database connectionsMEDIUM

Unencrypted database connections expose passwords and sensitive business data to network sniffing.

SHOW ssl;
Least-privilege connection pooling (separate web vs worker roles)MEDIUM

Client API routes should connect using a restricted role; migrations and maintenance should use a separate DDL role.

Explicit policy test suite for tenant isolationHIGH

Automated tests verifying User A cannot query Organization B rows, even if they forge HTTP headers.

Audit Criteria & Sources
• Standards: CIS PostgreSQL Benchmark & Supabase Hardening Guide (v2026).
• Critical Rule: Any table exposed in the public schema without RLS or an explicit denial policy is an automatic data breach hazard.
Status: Static architectural evaluation tool. No remote DB credentials requested or accepted.
Posture Assessment

Database Security Index

Compliance Score:38%
Critical Vulnerabilities Detected
Exportable Audit Summary:
=====================================================
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
Inquire About Care & DrillsMonthly restore drills • Continuous access auditing