Row Level Security off or too permissive
Supabase's own database linter flags tables in the public schema without RLS, noting that anyone with the project URL can then read and write them. Enabling RLS without policies blocks access; enabling it with a policy like using (true), or one that checks auth.role() = 'authenticated' but not ownership, still exposes every row to any signed-up user. The 2025 Lovable disclosure (CVE-2025-48757, CVSS 9.3) concerned exactly this: insufficient RLS on Supabase backends of generated apps let unauthenticated users read and write tables.
Keys and privileged paths
- The service_role (secret) key bypasses RLS entirely. If it appears in a client bundle, environment file or mobile app, the database is open.
- Postgres functions exposed via /rest/v1/rpc run with the caller's rights unless declared SECURITY DEFINER, in which case they bypass RLS and need their own checks.
- Views in the public schema can bypass RLS on underlying tables unless created with security_invoker.
- Edge Functions deployed with JWT verification turned off are public endpoints.
Auth and storage settings
- Open sign-up with email confirmation disabled means 'authenticated' is a role anyone can obtain in seconds.
- Storage buckets marked public, or with policies that do not scope object paths to the user, expose uploaded files.
- User-editable metadata (raw_user_meta_data) should never be used in policies for authorisation decisions.
- Rate limits on auth endpoints and OTPs deserve a check on self-hosted projects.
How to test RLS from outside
The method is direct: take the project URL and anon key from the frontend, query each table through /rest/v1 with no session, then as user A trying to read and update user B's rows, then with filters and select parameters that pull related tables. Every request should return only what the policies intend.
Testing a Supabase-backed app with Pentest-Swarm
Pentest-Swarm tests your app and its Supabase API endpoints over HTTP, as an outside user would. It does not log into your Supabase dashboard or read your policies.
- Scope the run to your app's domain and your project's supabase.co host so both the frontend and the data API are in bounds; anything else is refused.
- Use
--browserso recon observes the REST, RPC and storage calls the frontend makes, including the endpoints and keys it uses. - Pass a test user's session token with
--auth, then repeat with a second user, so the api-security playbook can attempt cross-user reads and writes. - Findings it proves come with request and response evidence that maps directly to the table or policy to fix.
Where it falls short
A black-box run proves what is reachable with the keys and accounts it has, but it cannot read your SQL policies, so a table it never discovers will go untested. Use Supabase's Security Advisor and database linter alongside it, and write policy tests in your migrations. Rotate any key that has been exposed, even after the leak is fixed.
Questions
Is it safe to expose the Supabase anon key?
Yes, that is its purpose, provided RLS is enabled with correct policies on every exposed table. The service_role key must never be exposed.
Does enabling RLS fix everything?
Enabling it with no policies denies access. Security then depends on the policies you write, and permissive ones are the usual problem.
Can a pentest find RLS problems without database access?
Yes. Querying the public API with the anon key and different user sessions shows exactly which rows each caller can read or change.