How to check RLS is actually protecting your tables after shipping with AI
Run a free check: FlowWatch signs up, logs in and runs a Stripe test checkout on your app, then scans for exposed keys. You get a shareable report. Run the free check at flowwatch.org
You shipped a vibe-coded app on Supabase (often via Lovable, Bolt, Cursor or a similar tool). Auth seems fine. Then you wonder: can a logged-out visitor, or another user's session, read or write rows they should not see? That question is about Row Level Security (RLS). AI builds often create tables with RLS off, or with policies that look right but do not match how the app actually queries data.
What RLS is supposed to do
With the browser's anon / publishable key, every request to Postgres still hits your tables. RLS policies decide which rows that request can see or change. If RLS is disabled, or a policy is missing for a role, the anon key can return more than you expect.
The Supabase service_role key bypasses RLS entirely. It must never ship in front-end code. If you already found a secret in the client bundle, rotate it first; this guide assumes you are checking policies with the anon key only.
A 10-minute check on the live app
- Confirm RLS is on. In the Supabase dashboard, open Authentication is not enough: go to Table Editor or Database → Tables, pick each user-facing table (
profiles,subscriptions,projects, etc.), and confirm RLS enabled is on. If it is off, turn it on before you ship more traffic. - List the policies. For each table, open Policies. You want at least: a
SELECTpolicy for the roles your app uses, and matchingINSERT/UPDATE/DELETEpolicies if the client writes. A table with RLS on and zero policies blocks everyone by default (safe but breaks the app). A table with RLS off and no policies is the dangerous case. - Probe as a logged-out visitor. Open your production URL in a private window. In DevTools → Network, trigger whatever loads "your" data (dashboard fetch, list endpoint, realtime). If rows come back with no
Authorizationsession, RLS is not protecting that path (or the API is not going through Supabase with the anon key). - Probe as user A vs user B. Sign up two test accounts. As user A, create a private row. Log out, sign in as user B, and try to read or update A's row through the same UI or the same client query. If B can see or edit A's data, the policy is too open (for example
USING (true)with noauth.uid()check). - Watch for service_role in the browser. While you are in DevTools → Sources, search the loaded JS for
service_role,sk_live,sk_testandwhsec_. None of these belong in the client. The anon key is expected; a secret key means rotate and move the call server-side.
Policies that look fine but fail
USING (true)on SELECT for authenticated users. Every logged-in user can read every row.- Policy only for
authenticated, nothing for edge cases. Some AI snippets add a policy for one operation and leaveUPDATEopen or missing. - Client filters that are not policies.
.eq('user_id', userId)in your React code is not security. Anyone can call the same table without that filter unless RLS enforcesauth.uid() = user_id(or equivalent). - Server path that uses
service_rolefor normal reads. Convenient for the model that generated it; it skips RLS for every caller of that function. Prefer the user's JWT for user-scoped data.
After every deploy that touches auth or schema
A later prompt can add a table without RLS, weaken a policy, or put a privileged key back into the client. Re-run the logged-out and two-user checks after those changes, not only at launch.
Automating the related checks
FlowWatch runs a real signup, login and Stripe test-mode checkout on your app on a schedule, and includes a light scan for exposed keys (including Supabase service_role in the client). It only runs test-mode checkouts and refuses to run if it finds live keys. It does not replace reading your RLS policies in the dashboard, but it catches the leak and broken-auth cases that often show up next to weak RLS. Start with the free check: flowwatch.org.
Contact: hello@flowwatch.org