Ship-Ready / Guides

Is my Lovable app's Supabase database exposed?

A 10-minute self-check you can run before launch. No tool needed: open the Supabase SQL editor for your own project and paste the queries below.

Why this matters

The anon key in your frontend is public on purpose. Every visitor gets it. Row Level Security (RLS) policies are the only thing deciding what that key can read. In November 2026 a Hamburg security firm checked 34,545 Lovable apps on Supabase. On 7,403 of them it could read tables holding email addresses with nothing but that public key (Crissy Field). Nobody broke in: the database rules let strangers through. The firm notes this is not a confirmed leak rate and its sample isn't representative of all Lovable apps.

1. Tables with RLS turned off

select tablename from pg_tables
where schemaname = 'public' and not rowsecurity;

Any row returned is readable and writable by anyone with your anon key, unless grants block it. Fix: alter table public.<name> enable row level security; then add policies. Also search your migrations for disable row level security: a later migration can switch it back off.

2. Policies that let everyone in

select tablename, policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'public'
  and (qual = 'true' or with_check = 'true');

using (true) means "every row, for every caller in these roles". That's fine for a public blog table and wrong for profiles, orders or messages. Scope it, for example using (auth.uid() = user_id).

3. Views that skip your policies

select c.relname as view_name
from pg_class c join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public' and c.relkind = 'v'
  and not coalesce(array_to_string(c.reloptions, ',') like '%security_invoker=true%', false);

By default a view runs as its owner, so it can return rows your RLS would hide. On Postgres 15+: alter view public.<name> set (security_invoker = true);

4. SECURITY DEFINER functions the browser can call

select p.proname
from pg_proc p join pg_namespace n on n.oid = p.pronamespace
where n.nspname = 'public' and p.prosecdef
  and has_function_privilege('anon', p.oid, 'execute');

These run with the owner's rights and are callable through /rest/v1/rpc/ with the anon key. Either check auth.uid() inside, or revoke execute on function public.<name> from anon, public; and pin set search_path = ''.

5. Secrets that ship to the browser

grep -rnE "service_role|sk_live_|SUPABASE_SERVICE" src/ app/ components/ 2>/dev/null
grep -rnE "(NEXT_PUBLIC|VITE|EXPO_PUBLIC)_[A-Z_]*(SECRET|SERVICE|PRIVATE)" . --include=*.env* 2>/dev/null

Anything prefixed NEXT_PUBLIC_, VITE_ or EXPO_PUBLIC_ is bundled into the page. The service_role key bypasses RLS entirely and must never be there. If it was, rotate it in the Supabase dashboard.

Then test it like a stranger, and like a second user

Logged out, against your own project only:

curl "https://<project-ref>.supabase.co/rest/v1/<table>?select=*&limit=1" \
  -H "apikey: <your anon key>"

An empty [] on private tables is what you want. Then sign up a second test account and check it can't read the first account's rows. Logged-out checks (including most URL scanners) never test this second case.

Rather not do it by hand?

Run the free quick scan

Ship-Ready Lite's quick scan runs 8 of these checks on your code, offline and read-only, and names the free skill that fixes each finding. The Crew ($39) runs the full 59-check scan plus a two-user test template.