RLS Doctor
A read-only Postgres and Supabase auditor. It finds RLS policies, roles, and grants that can expose rows across tenants without changing your database.
TypeScript · Node.js · PostgreSQL · Supabase RLS · Vitest · GitHub Actions
Try it
- Prove a leak on a disposable Postgres instance:
npx rls-doctor demo - Audit the database in DATABASE_URL or SUPABASE_DB_URL:
npx rls-doctor check
Problem
Small policy mistakes can expose rows through disabled RLS, broad roles, missing write checks, or overlooked privilege paths. Normal application tests rarely explain the catalog state behind those failures.
What I built
The CLI reads PostgreSQL catalog metadata, models policies, roles, memberships, and grants together, and reports structural risks. A read-only probe impersonates app roles in a rolled-back transaction; shadow, prove, and fix add disposable-world verification and repair.
Decisions
- Analyze policy composition and reachable roles instead of counting policies in isolation.
- Keep suggested remediation conservative because ownership and tenant models vary.
Evidence
- A static audit of 60 open-source Supabase repos found at least one high or critical RLS pattern in 63%; median RLS Score 38/100.
- Probe mode impersonates application roles in rolled-back transactions to prove cross-tenant reads without changing data.
- Published on npm with install-free npx usage, stable JSON, and CI coverage.
Limits
- Catalog inspection cannot prove application-level authorization behavior.
- Hosted platform settings, views, and functions require separate review.