Skip to content

How to check if your Lovable or Supabase app has RLS disabled (and fix it)

Everything below you can do yourself in the Supabase dashboard, for free.

TL;DR

  1. Your Supabase publishable key (legacy name: anon key) is in your frontend on purpose. It is meant to be public. Row Level Security (RLS) is what stops it from reading everything. (Supabase: API keys)
  2. A table in an exposed schema (normally public) without RLS is readable and writable by any role with a grant on it. (Supabase: Row Level Security)
  3. RLS on with a policy like USING (true) or WITH CHECK (true) still allows unrestricted access to all rows for the roles and operation that policy covers. (Supabase lint 0024)
  4. Check with Security Advisor and the SQL below, test as a signed-out visitor and as a second user, then fix with owner-only policies.

Context

In November 2026 the consultancy Crissy Field, working with Handelsblatt, reported that many Lovable-built apps using Supabase returned database records without a login. Lovable's Head of Security said the root cause was insufficient Row Level Security. The report itself says its figures should not be read as a confirmed leak rate, and that its Common Crawl sample is not representative of all Lovable apps. (Crissy Field research, Hacker News comment from Lovable)

Lovable's own guidance (10 November 2026) says the most common issue it sees is "data access rules that are too open", and that it scans on every publish and offers a free deeper scan. (Lovable blog)

Step 1 — Run Supabase Security Advisor

Supabase ships deterministic checks ("advisors"). Run them from any of:

  • Studio: Security Advisor (in the Advisors section of the sidebar)
  • CLI: supabase db advisors
  • MCP: get_advisors with type = security

(Supabase: Advisors)

The findings that matter for this question:

Lint Level Meaning
0013_rls_disabled_in_public ERROR Table in public has RLS off. Supabase: "Anyone with your project URL can read, edit, and delete all data in this table because Row-Level Security is not enabled."
0007_policy_exists_rls_disabled INFO You wrote policies, but RLS is not enabled, so they do nothing.
0024_permissive_rls_policy WARN A policy uses an always-true condition such as USING (true), WITH CHECK (true), or a tautology like 1=1. The lint also flags some policies that omit a USING or WITH CHECK clause.

Some findings can be intentional (for example a public blog-posts table). Check each one against what the data should expose.

Step 2 — List every table and its RLS status (SQL)

Open SQL Editor in the Supabase dashboard and run:

-- Tables in exposed schemas and whether RLS is on
select
  n.nspname          as schema,
  c.relname          as table_name,
  c.relrowsecurity   as rls_enabled,
  c.relforcerowsecurity as rls_forced
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where c.relkind in ('r', 'p')          -- tables and partitioned tables
  and n.nspname = 'public'             -- add other schemas you expose via the Data API
order by rls_enabled, table_name;

Any row with rls_enabled = false is a table the Data API can reach without row filtering, if the API roles also have grants on it.

Step 3 — Find policies that let everyone through

-- Policies whose condition is literally "true"
select schemaname, tablename, policyname, roles, cmd, qual, with_check
from pg_policies
where schemaname = 'public'
  and (qual = 'true' or with_check = 'true')
order by tablename, cmd;

USING (true) is fine for data that really is public (a published product catalog). It is not fine on profiles, messages, orders, bookings, or anything with emails, payments or private notes.

This query only catches a literal true. Also review policies that use 1=1 or that allow any signed-in user to read every row, with no owner check.

Step 4 — Check what anon and authenticated are granted

Policies decide which rows; grants decide whether the role can run the operation at all. On existing projects, a new table in public often starts with every privilege granted to anon, authenticated and service_role, and adding policies does not take those grants back. Not every project still uses those default grants; check yours. (Supabase: Grants and policies)

select table_name, grantee, string_agg(privilege_type, ', ' order by privilege_type) as privileges
from information_schema.role_table_grants
where table_schema = 'public'
  and grantee in ('anon', 'authenticated')
group by table_name, grantee
order by table_name, grantee;

If anon holds INSERT/UPDATE/DELETE on a table signed-out visitors should never write to, revoke it (Step 7).

Step 5 — Test it the way a stranger would (your own project only)

Do this only against a project you own.

  1. Open your live app in a private window, signed out. Click around. Is any private data visible?
  2. Call a table directly with only the public key (find your project URL and publishable key in the dashboard's Connect dialog):
# Publishable keys (sb_publishable_...) go in the apikey header
curl "https://<project-ref>.supabase.co/rest/v1/<table>?select=*&limit=5" \
  -H "apikey: <your-publishable-key>"

If private rows come back, that table is reachable by anyone who copies the publishable key from your JavaScript bundle. Note: GET /rest/v1/ — the API root — only accepts secret keys, so test a table route such as /rest/v1/<table>. (Supabase: API keys)

  1. Two-account test: sign up as user A, create a record (a note, a booking, a contact). Sign in as user B in another browser. Can B list or open A's record? If yes, your policies are not scoped to the owner.

Step 6 — Check for a secret key in the frontend

The secret key (sb_secret_..., legacy service_role JWT) bypasses RLS when the request carries no user access token. It must never be in browser code. (Supabase: API keys)

  • In your built site: DevTools → Sources → search for sb_secret_ and service_role.
  • In your repo:
# current files
git grep -nE "sb_secret_|service_role"
# full history (catches keys deleted in later commits)
git log --all -p | grep -nE "sb_secret_|service_role" | head

If you find a secret or service_role key in frontend code: move the call into a server or Edge Function, then rotate the key in the dashboard (Settings → API Keys). Deleting it from code is not enough; it can still be in git history and in anyone's copy of your bundle.

Step 7 — Fix: enable RLS, set grants, add owner-only policies

Example for a notes table with a user_id uuid column referencing auth.users. Put this in a migration so it is reproducible:

-- 1. Turn RLS on
alter table public.notes enable row level security;

-- 2. Reset grants, then give back only what the app needs
revoke all on table public.notes from anon, authenticated;
grant select, insert, update, delete on table public.notes to authenticated;

-- 3. One policy per operation, scoped to the owner
create policy "Owners read their notes"
on public.notes for select to authenticated
using ( (select auth.uid()) = user_id );

create policy "Owners create their notes"
on public.notes for insert to authenticated
with check ( (select auth.uid()) = user_id );

create policy "Owners update their notes"
on public.notes for update to authenticated
using ( (select auth.uid()) = user_id )
with check ( (select auth.uid()) = user_id );

create policy "Owners delete their notes"
on public.notes for delete to authenticated
using ( (select auth.uid()) = user_id );

After enable row level security, nothing is readable through the publishable key until a policy allows it, so expect your app to break until the policies are in. That is expected. (Supabase lint 0013)

Then re-run Steps 2–5. Supabase recommends writing pgTAP tests per table and running supabase test db to prove allow/deny for anon and authenticated. (Supabase: Secure a table with RLS)

Don't forget views

Views created by the postgres user bypass RLS by default (security definer), so a view over a protected table can hand out every row. (Supabase: Row Level Security) On Postgres 15 and above you can make a view respect the caller's RLS:

alter view public.my_view set (security_invoker = true);

On older Postgres versions, revoke access from anon and authenticated, or put the view in a schema the Data API does not expose.

Copy-paste fix prompt for Lovable or Cursor

Audit my Supabase setup for Row Level Security. For every table in the public schema:
1. Tell me whether RLS is enabled and list its policies.
2. Flag any policy using `true` as its USING or WITH CHECK condition on tables that hold
   user data (emails, messages, payments, bookings, private notes).
3. For tables that belong to a user, enable RLS and create separate select/insert/update/delete
   policies restricted to `(select auth.uid()) = user_id`, in a migration.
4. Revoke all grants from anon on those tables and grant only the needed operations to authenticated.
5. Confirm no secret / service_role key is used anywhere in frontend code.
Do not make any table public unless I confirm the data is meant to be public.
Show me the SQL before applying it.

In Lovable you can also run the built-in Deep scan from the Security view and use Fix on findings. Lovable notes you should still review findings yourself. (Lovable blog)

FAQ

Is it a problem that my anon/publishable key is visible in the browser? No. That key is designed to be public; it only reaches what RLS allows. The problem is tables without RLS, or with an always-true policy on private data. (Supabase: API keys)

I enabled RLS and now my app shows nothing / I get permission errors. Expected: with RLS on and no policy, the API returns nothing through the publishable key. Add policies (Step 7). A 42501 error often means a missing grant, which Postgres checks before policies. A WITH CHECK violation can also raise 42501. A USING clause that filters the row out usually returns no rows, not an error. (Supabase: Row Level Security)

The AI said "I've enabled RLS". Am I done? Ask it to show the policies (Step 3). RLS on plus USING (true) still allows unrestricted access for that operation and role.

Should I switch from anon/service_role to the new keys? Supabase says it is deprecating the anon and service_role keys by the end of 2026 in favour of sb_publishable_... and sb_secret_.... (Supabase: API keys)

Sources

Last checked against the sources above: 21 November 2026.


If you want a weekly, read-only check of this after you have fixed it, LaunchGuard looks for exposed API keys, open databases, broken signups and SEO problems on AI-built apps you own and verify. The first scan is free and shows your 1–2 most severe findings with a fix prompt; paid plans add the full report, every fix prompt, weekly rescans and an emailed report. Solo is 9 USD per month for 1 app. Pro is 24 USD per month for up to 5 apps. Paid plans are live and renew monthly until you cancel.

Newsletter

We send a confirmation link first. You are not subscribed until you open it, and every issue has a one-click unsubscribe.

How to check if your Lovable or Supabase app has RLS disabled (and fix it)