critical severity · fix guide

How to Fix a Publicly Readable Supabase Database (RLS)

Your database tables can be read by anyone, not just logged-in users. Someone could open your app's data — customer emails, orders, private records — without ever creating an account.

Why AI tools cause it

Supabase only protects a table once you turn on Row Level Security (RLS) and write access rules for it. AI tools frequently build a working app without doing that, so the tables are wide open by default.

The goal

Row Level Security is enabled on every table, with policies so a table only returns rows to users allowed to see them; no table returns private data to an anonymous request.

The steps

  1. Enable Row Level Security (RLS) on every table, especially the spot the scan shows
  2. Add a policy per table so only authenticated users can read/write their own rows (keep intentionally-public tables public on purpose)
  3. Re-check that an anonymous request no longer returns private rows

Fix it with your AI coding tool

Pick your tool and paste the instruction. It is written to make the goal above true, and to never print any secret values back to you.

Paste this to Any AI tool:
In my app (the spot the scan shows): anyone can read this database table. Please make this true: Row Level Security is enabled on every table, with policies so a table only returns rows to users allowed to see them; no table returns private data to an anonymous request. Steps: Enable Row Level Security (RLS) on every table, especially the spot the scan shows; Add a policy per table so only authenticated users can read/write their own rows (keep intentionally-public tables public on purpose); Re-check that an anonymous request no longer returns private rows. Then tell me exactly what you changed, and do not print any secret values back to me.

Then verify it worked

After you deploy the policies, xlogs repeats the same anonymous read test and confirms the table no longer returns data without a login.

Check your app for this issue

Free, read-only. Confirm the issue is present, then re-scan to prove your fix worked.