Supabase security · 8 minute read

How to test Supabase RLS policies before launch

A policy existing is not proof that tenant data is isolated. Test the forbidden paths: user A reading or changing user B's rows, a tenant member crossing into another tenant, and an unauthenticated request reaching data that should be private.

The minimum useful test matrix

For every protected table, exercise the operation and identity together:

Test negative cases, not only the happy path

A passing owner query proves that the application works for its owner. It does not prove isolation. Seed two users and two tenants, obtain a separate session for each, then deliberately request the other identity's row ID. Repeat for reads and writes.

userA can read rowA         // expected: yes
userA can read rowB         // expected: no rows
userA can update rowB       // expected: denied or no rows
tenantA user reads tenantB  // expected: no rows
anonymous reads private row // expected: no rows

Verify the database boundary

  1. Confirm RLS is enabled on every table exposed through the API.
  2. List policies by command and role; broad USING (true) rules deserve explicit review.
  3. Check both USING and WITH CHECK behavior for writes.
  4. Test through the same client and JWT roles the application uses.
  5. Keep the test deterministic so it can run again after schema or policy changes.

Supabase's official guide explains the underlying policy model in more detail: Row Level Security.

Run a public isolation fixture

The public Supabase RLS leak demo uses synthetic records and executable TypeScript tests. Its broken branch demonstrates a cross-user leak; the fixed branch applies the policy boundary and passes five isolation checks. No client or production data is included.

See the synthetic sample audit report for the finding, evidence, remediation and verification format used to communicate a result.

Copy the ready-to-adapt negative-test matrix into an issue, pull request or test plan to cover anonymous, cross-user, cross-tenant, ownership-change and removed-member cases.

Turn the workflow into a repeatable audit

Supabase RLS Audit Kit · $29 one-time

Run seven commented SQL audits and 60 checks, then verify cross-user and cross-tenant isolation with an optional two-user staging harness. The ZIP also includes report, remediation, safe-test and fix-SQL templates.

Use it only on projects you own or are authorized to test. It is a self-run toolkit, not a managed penetration test or security certification.

Get the kit - $29 ↗Review the files, scope and license →

When a focused audit is worth it

Use an independent review when several tables share tenant rules, the application mixes browser and server access, or a launch depends on proving that cross-user paths are closed. The review should produce reproducible evidence and prioritized fixes—not a generic security score.

Review the fixed-price Supabase RLS audit and its exact scope →

Lower-cost launch check

If you only need a broad pre-launch checklist, the Next.js + Supabase launch checklist covers RLS, secrets, authentication, performance and launch checks in an eight-page PDF with a public preview.

Review all 20 frontend starters in one bundle

20 editable frontend starters with live demos are $79 — one payment, no subscription.

View the Bundle — $79