Skip to content

All posts

Is Your Lovable App's Data Public? How to Check in 2 Minutes

If any table in your Supabase database has Row Level Security turned off, anyone can read it using the public key that ships inside your website's code.

4 min read

Quick answer: If any table in your Supabase database has Row Level Security turned off, anyone can read it using the public key that ships inside your website's code. Run one SQL query to list unprotected tables. If rowsecurity is false on a table holding user data, that data is public right now.

This applies to apps built with Lovable, Bolt, Cursor, Replit or any tool that connects a frontend directly to Supabase.

Why this happens

Your app talks to Supabase with an "anon" key. That key is meant to be public. It sits in your JavaScript, and anyone can copy it from the browser. What protects your data is not the key. It is RLS. With RLS off, the anon key is a master key to that table.

This is not rare. One audit of 50 AI-built apps reported RLS disabled in 44 of them. The same weakness in Lovable-generated apps was catalogued as CVE-2025-48757.

Check 1: List tables with RLS off

Open the Supabase SQL Editor and run:

select tablename, rowsecurity
from pg_tables
where schemaname = 'public'
order by rowsecurity, tablename;

Every row showing false is readable and writable by anyone. Supabase's Security Advisor (Advisors in the dashboard sidebar) flags the same thing as "RLS Disabled in Public".

Check 2: Find policies that allow everything

RLS can be on and still useless if a policy says true:

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

Each result is a table open to everyone for that action. That is fine for a public blog table. It is not fine for profiles, orders or messages.

Check 3: Test it like an attacker would

Log out of your app. Copy your project URL and anon key from Project Settings, API, then run this in a terminal against your own project:

curl "https://YOUR-PROJECT.supabase.co/rest/v1/profiles?select=*" \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_ANON_KEY"

An empty [] means the table is protected. Real rows mean it is public.

The fix

For each exposed table, enable RLS and add owner-only policies:

alter table public.profiles enable row level security;

create policy "Owner can read" on public.profiles
for select to authenticated
using ((select auth.uid()) = user_id);

create policy "Owner can insert" on public.profiles
for insert to authenticated
with check ((select auth.uid()) = user_id);

create policy "Owner can update" on public.profiles
for update to authenticated
using ((select auth.uid()) = user_id)
with check ((select auth.uid()) = user_id);

create policy "Owner can delete" on public.profiles
for delete to authenticated
using ((select auth.uid()) = user_id);

Replace user_id with your owner column. On a profiles table it is often id. Then repeat Check 3 and confirm you get [].

Expect something to break. Once RLS is on, features that relied on open access will return empty data or insert errors. Posts 1 and 2 cover both.

3 more leaks to check while you are here

  • The service_role key in frontend code. Search your repo for service_role. This key bypasses RLS entirely. If it is in the browser bundle, rotate it today.
  • Public storage buckets. In Storage, any bucket marked Public serves its files to anyone with the link.
  • Other secret keys in the client. Search for sk_live_ and sk-. Stripe and OpenAI secret keys belong in an Edge Function, never in the browser.

The prompt to give your AI tool

Audit every table in the public schema. For each one, tell me whether RLS is enabled and list its policies. For any table with RLS disabled or a policy using true, write SQL to enable RLS and add owner-only policies using auth.uid(). Do not run anything until I approve.

FAQ

Is it safe that my anon key is visible in the browser? Yes, if RLS is enabled with correct policies on every table. The anon key is designed to be public.

Lovable showed a security warning before publish. Is that this? Most likely. Lovable's security scan flags tables with missing RLS. Do not publish past it.

Nobody knows my app exists. Does it matter? Yes. Automated scanners look for Supabase URLs in public sites. They do not need to know who you are.

My data was already exposed. What now? Enable RLS, rotate any leaked secret keys, and check whether you have a legal duty to notify users under the privacy law that applies to you.

Not sure what you are looking at?

Rayionyx fixes broken AI-built apps. Run the free scan at rayionyx.com, or book the $199 Rescue Audit for a full written report in 24 hours.

Can we watch how you use this site?

We use Microsoft Clarity to see where visitors click and scroll, so we can fix confusing pages. It sets cookies and records your visit. Nothing loads unless you say yes.

Read the privacy notice