Pular para o conteúdo

// Security by tool

Supabase security: RLS, service_role and PostgREST

7 minUpdated July 25, 2026By Ler em português

Quick answer

Supabase is secure when configured, but the default leaks: RLS (Row Level Security) is OFF by default on every new table. CVE-2025-48757 (May 2025, Matt Palmer) measured it in the wild: 303 endpoints across 170 projects with tables read by anonymous requests using the public anon_key, one leak exposed 13,000 users, and 83% of Supabase exposures come from misconfigured RLS.

The anon_key is not a secret (it is public by design, living in the bundle), so the only thing protecting the database is each table’s RLS policy. Without it, an attacker extracts the anon_key from the JavaScript, lists tables via PostgREST introspection at /rest/v1/ and queries each one with no login. Password-reset token tables left open like that become account takeover.

The patterns that expose the most

It is not just "RLS off". Supabase has two keys with opposite powers, and confusing where each lives is the second most common hole after RLS.

Recurring holes in Supabase
HoleWhy it happensImpact
RLS off on the tableSupabase default is RLS offanon_key reads/writes the whole table with no login
service_role in the clientConfused with the anon_key and pasted in the frontA key that bypasses RLS exposed to the world
Weak policy (no owner check)RLS on but with `using (true)`Tenant isolation does not hold
Open PostgREST introspection/rest/v1/ lists the schema with no authAttacker enumerates every table

How RET reviews a Supabase project

RET tests what the anon_key actually reaches with no login, table by table, and confirms no service_role leaked to the client. It checks that each RLS policy verifies the OWNER of the record (not just `if true`), and that PostgREST introspection does not hand over the whole schema. Each finding ships with reproduction steps.

For the first pass, the Promptbook guides checking RLS, keys and policies. When there is sensitive data or a B2B sale, Risk Review reads the flows and says what to fix before it becomes an incident.

  • Test what the anon_key reaches without authentication, table by table.
  • Confirm the service_role lives only on the server.
  • RLS policy that checks the owner, not `using (true)`.

You may already be exposed if

Signals that call for an immediate review of a Supabase project.

  • You created a table and never wrote an RLS policy (it is born off).
  • The service_role appears somewhere in the front-end code.
  • Your policies use `using (true)` instead of checking request/auth.uid().
  • You do not know what /rest/v1/ returns for a request with no token.

Want to know whether this happens in your system?

Manual pentest for web applications, APIs and apps, from R$9,500, with the Sprint run within 7 business days. We refund 50% if we find no flaw.

See price and timeline for my case

Frequently asked questions

Does the anon_key need to be hidden?

No, it is public by design and lives in the front-end. What protects the database is RLS with a correct policy on each table. Hiding the anon_key does not help; enabling RLS and checking ownership does.

What is the difference between anon_key and service_role?

The anon_key respects RLS (it is the public client key). The service_role BYPASSES RLS (it is the server admin key). Pasting the service_role in the front-end is catastrophic: it grants full database access. It must never leave the server.

Does enabling RLS solve everything?

Enabling is the first step, but the policy must check the record owner (request.auth.uid()), not just exist. An RLS with `using (true)` is "on" and still leaks data between customers.

Who runs the review at RET?

Gabriel Lima Ferreira, founder and lead pentester, with an authorized scope, returning reproducible evidence and fix priority.

Keep reading