How to check if your Lovable or Bolt app leaks Supabase data (RLS)
Updated 5 December 2026
If your app uses Supabase, its URL and public key are inside your JavaScript — that is by design. What keeps your data private is Row Level Security (RLS). If a table has RLS switched off, anyone who opens your site can read the whole table with that public key. Here is how to check it in a few minutes and how to fix it.
Why this happens so often with AI-built apps
AI builders create tables quickly while you iterate on features. RLS is a separate step: a table can be created, filled and used by the app without any policy, and everything still "works" — for you and for everyone else. Nothing in the app looks broken, so the problem is invisible until someone looks.
Step 1: find your project URL and public key
Open your live site, open DevTools (F12) → Network, reload and filter by supabase.co. Any request shows the project URL (https://<project-ref>.supabase.co) and the apikey header — the anon key (a long eyJ… token) or a new-style publishable key (sb_publishable_…). Both are meant to be public.
Step 2: ask Supabase how many rows a stranger can see
Use the table names from the same Network tab (requests to /rest/v1/<table>). This asks only for the row count — limit=0 means no rows are returned:
curl -s -o /dev/null -D - \
"https://<project-ref>.supabase.co/rest/v1/profiles?select=*&limit=0" \
-H "apikey: <public key>" \
-H "Authorization: Bearer <public key>" \
-H "Prefer: count=exact" | grep -i content-range
| Answer | What it means |
|---|---|
content-range: */0 | Anonymous visitors see no rows. Either RLS is on, or the table is empty. |
content-range: */1234 | Anyone can read 1,234 rows. Unless this is truly public data (blog posts, a product catalogue), fix it now. |
| 401 / 404 / permission denied | The table is not exposed to the anon role. Good. |
Step 3: see every table without RLS at once
In the Supabase dashboard, open the SQL Editor and run:
select schemaname, tablename, rowsecurity
from pg_tables
where schemaname = 'public'
order by rowsecurity, tablename;
Every row with rowsecurity = false is readable and writable through the API with the public key. Supabase's Security Advisor (Database → Advisors) flags the same problem.
Step 4: turn RLS on and add the policies you need
Turning RLS on without any policy blocks all access through the API — safe, but your app will stop seeing data until you add policies. A typical pattern for per-user data:
alter table public.profiles enable row level security;
-- each signed-in user can read and update only their own row
create policy "Read own profile" on public.profiles
for select to authenticated
using ((select auth.uid()) = user_id);
create policy "Update own profile" on public.profiles
for update to authenticated
using ((select auth.uid()) = user_id)
with check ((select auth.uid()) = user_id);
For data that really is public (published posts, a price list), allow read-only access explicitly: for select to anon, authenticated using (published = true). Never add insert, update or delete policies for anon unless you mean it.
Step 5: check the places RLS does not cover
- Views run with the permissions of their owner by default and can bypass RLS. On Postgres 15+ create them with
with (security_invoker = true). - Storage buckets marked public serve every file to anyone with the link. Uploaded user files belong in private buckets with storage policies.
- The service_role / sb_secret key ignores RLS entirely. It must never appear in frontend code — see anon key vs service_role.
- RPC functions declared
security definerrun with elevated rights; make sure they checkauth.uid()themselves.
A prompt for your AI builder
Audit Row Level Security in my Supabase project. List every table in the public
schema with RLS status and existing policies. Enable RLS on every table, then add
the minimum policies this app needs (users only see and change their own rows;
public read only where the data is meant to be public). Show me the SQL before
running it and explain what each policy allows.
Questions
Is it a problem that my Supabase anon key is visible in the browser?
No. The anon (or publishable) key is designed to be public. It only grants what your Row Level Security policies allow. The problem is a table without RLS, or a service_role key in the frontend.
If RLS is enabled with no policies, what happens?
All access through the API is denied for that table (the service_role key still works on the server). The app will see empty results until you add policies.
Does VibeCleared download my data when it checks Supabase?
No. It sends limit=0 with Prefer: count=exact and reads only the row count from the Content-Range header, and only after you verify the domain.
Related guides
- Supabase anon vs service_role: which key is safe in the browser
- Leaked API keys in JavaScript: find and fix
- Launch checklist for AI-built websites
Run all of these checks on your live site in under a minute — free, no signup.
Scan my site free