Debug Ninjas
Security8 Oct 2026 · 4 min read

Anyone can read your users' data: the Supabase setting most apps miss

Without row level security, the public Supabase key lets anyone read every row in your tables. Here is how to check and fix it.

Admin

Founder, Debug Ninjas

If your app runs on Supabase, there is a key sitting in your website's code right now that anyone can copy. That is normal. Supabase designs it that way. The problem starts when one setting is switched off, because then that public key opens every table in your database to anyone who asks.

This is the most common serious issue we find when we audit apps built with Lovable, Bolt, Cursor or v0. It is also one of the easiest to fix.

What is actually going on

Supabase gives your app two keys:

  • The anon (public) key. Your website uses it to talk to the database. It ships to every visitor's browser, so you should assume everyone has it.
  • The service role key. This one can do anything. It must only live on a server, never in your frontend code.

The anon key is safe only because of a feature called row level security (RLS). RLS is a set of rules on each table that says who can read or change which rows. For example: "a user can only see their own orders."

When RLS is turned off on a table, there are no rules. Anyone with the anon key can read, and often edit or delete, every row. No login needed.

Why AI-built apps miss it

AI tools are good at getting features working fast. When a query fails because of a missing permission, the quickest way to make the error go away is to turn RLS off or add a rule that allows everything. The feature works, the demo looks great, and nobody notices that the door is open.

Tables created with raw SQL also do not always get RLS switched on automatically, so it is easy to end up with a mix of protected and unprotected tables.

How to check in five minutes

  1. 01Open your project in the Supabase dashboard.
  2. 02Go to Advisors and open the Security Advisor. It flags tables in the public schema that have RLS disabled.
  3. 03Go to the Table Editor and look at each table. Tables without RLS are marked clearly.
  4. 04For every table that has RLS on, open its policies and read them. A policy that says true for everyone is the same as having no lock at all.

If you see anything holding user data, such as profiles, messages, orders or uploaded files, with RLS off or an "allow all" policy, treat it as urgent.

How to fix it

  1. 01Turn RLS on for every table in the public schema. Your app will probably break in places. That is expected, and it shows you exactly which queries were relying on open access.
  2. 02Add the narrowest policy that makes each feature work. The usual starting point is "users can read and update rows where user_id matches their own ID."
  3. 03Check storage buckets too. Uploaded files have their own policies. A public bucket full of invoices or ID photos is the same problem in a different place.
  4. 04Search your frontend for the service role key. If it is there, move that logic to a server or an edge function and rotate the key in the dashboard.
  5. 05Test as a stranger. Log out, or use a second test account, and try to load another user's data. If you can see it, a policy is still too loose.

What it costs if you skip it

An open table rarely breaks anything you can see, so it can sit unnoticed for months. The cost shows up later: leaked customer data, emails to every user explaining what happened, and in many countries a legal duty to report it. Fixing RLS before launch usually takes hours. Cleaning up after a leak takes much longer.

The short version

  • The public Supabase key is fine to expose. Missing RLS is not.
  • Turn RLS on for every table, then write the smallest rules that keep features working.
  • Use the Security Advisor to check, and test by trying to read someone else's data.

If you would rather have someone else check every table, policy and bucket for you, that is a standard part of a Ninja Audit. Book an Audit and we will tell you exactly what is open and how to close it.

Written by Admin

Founder of Debug Ninjas. Has audited dozens of AI-built apps and still double-checks who can see what data.

One useful fix a month.

Field Notes in your inbox. No spam, unsubscribe anytime.