Security
Supabase Row Level Security: The Setting That Protects (or Exposes) Your AI-Built App
Why Row Level Security is the single most important configuration in Lovable and Supabase-backed apps, the common misconfigurations, and how to verify yours.
By AI Production Partner · · 3 min read
Why RLS is everything in a Supabase app
Supabase-backed apps — including most Lovable output — let the browser talk to the database directly. There's no API layer to enforce permissions, so Row Level Security policies are the only thing standing between any user and every row in your tables. RLS disabled or misconfigured doesn't mean 'less secure'; it means every user can read and write everyone's data with a few lines of JavaScript.
This isn't theoretical: researchers keep finding production apps with hundreds of thousands of exposed records, all traceable to missing RLS.
The three standard misconfigurations
RLS never enabled on a table (everything exposed); policies that check authentication but not ownership (any logged-in user reads all rows); and service-role keys shipped in client code (bypassing RLS entirely). AI builders produce all three, because a permissive database makes the demo work on the first try.
How to verify yours today
In the Supabase dashboard, confirm RLS is enabled on every table containing user data. Then test as a real attacker would: sign in as user A and query user B's rows via the client library. If data comes back, you have a breach in waiting. Finally, grep your client bundle for the service-role key — it should exist only in server environments.
Our AI Security Audit runs this verification (and about forty others) systematically — worth doing before your user count makes the stakes real.