Supabase is a popular backend for apps built quickly with AI coding tools. It is safe when set up properly, but one setting decides whether your data is protected: Row Level Security, or RLS.
Why it matters
A Supabase app usually talks to the database straight from the browser, using a public "anon" key. That key is meant to be visible. What keeps your data safe is RLS: rules on each table that decide which rows a user may read or change.
If RLS is switched off on a table, anyone with your public key, which anyone can find in your website's code, can read and change every row in that table.
The two common mistakes
- Tables created without RLS. Tables created with SQL do not have RLS turned on unless you enable it.
- The service role key in the browser. The service role key bypasses RLS completely. It belongs only in server code, never in frontend code or a public environment variable such as
NEXT_PUBLIC_.
How to fix it
Turn RLS on for every table in your public schema:
alter table public.profiles enable row level security;Then add policies that allow only what each user needs, for example letting people read and update only their own profile:
create policy "Users read their own profile"
on public.profiles for select
using (auth.uid() = id);Move any use of the service role key into server-side code, such as an API route or an edge function, and rotate the key if it was ever deployed to the browser.
Check your code
Our code scan looks for tables created without RLS, migrations that switch it off, and service role keys in browser code. Upload a ZIP or link your Git repository; each email address gets one free scan.