cd /news/ai-tools/rls-disabled-in-public-anyone-with-y… · home › topics › ai-tools › article
[ARTICLE · art-170267] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↓ negative

"RLS Disabled in Public": anyone with your project URL can read your whole database

A developer published a diagnostic SQL query that classifies every table in a Supabase project's public schema into one of four Row-Level Security states, testing it on PostgreSQL 16.15 against eight tables built to represent each case and reporting that it labeled all eight correctly. In hands-on tests, the developer showed that with RLS disabled an anonymous role holding only the public key shipped in deployed JavaScript could read both users' rows including card numbers, update another user's email, and delete their row without any error. The writeup also warns that policies created without enabling RLS appear in pg_policies and the dashboard but do nothing, and that enabling RLS without policies locks the app out of its own data.

by read8 min views1 publishedNov 16, 2026

Your Supabase Security Advisor has gone red. The wording is some of these:

USING (true), which defeats the purpose of having Row-Level Security enabled." Those are four separate warnings for what is really one question: who can reach each table.

And they are the normal state of an app that an AI built for you, because the builder's job

was to make the app work, and RLS off is the configuration where everything works.

This note tells you which of four states each of your tables is in, and what to do about each.

The first thing is one query. Do not start clicking through the Table Editor.

Supabase dashboard, SQL Editor, new query, paste this, run it. It reads catalogue tables

only. It changes nothing.

select
  t.tablename,
  t.rowsecurity as rls_on,
  count(p.policyname) as policies,
  case
    when not t.rowsecurity and count(p.policyname) > 0
      then 'OPEN: policies exist but RLS is OFF, so they do nothing'
    when not t.rowsecurity
      then 'OPEN: no RLS at all, anyone can read and write this table'
    when count(p.policyname) = 0
      then 'LOCKED: RLS on with no policies, your app can read nothing'
    when bool_or(p.qual = 'true')
      then 'OPEN TO READS: a policy uses USING (true)'
    when bool_or(p.with_check = 'true')
      then 'OPEN TO WRITES: a policy uses WITH CHECK (true)'
    else 'restricted'
  end as verdict
from pg_tables t
left join pg_policies p
  on p.schemaname = t.schemaname and p.tablename = t.tablename
where t.schemaname = 'public'
group by t.tablename, t.rowsecurity
order by 2, 1;

You get one row per table with a plain verdict. I wrote this query and ran it on a real

PostgreSQL 16.15 server against eight tables built to be one of each case, and it labelled all

eight correctly. Anything that says restricted is fine as far as this check goes. Everything

else is below.

Why a query and not the dashboard: the Table Editor shows you whether RLS is on. It does not

tell you that the three policies you can see are doing nothing, which is the state that fools

people, and it does not tell you that your one policy says true.

This is the advisor's only ERROR, and it deserves to be.

I tested what it means rather than restating it. On PostgreSQL 16.15 I made a table with two

users' rows in it, granted the table to a role standing in for anon, and left RLS off. As

that role I read both rows including both users' card numbers, then changed another user's

email address (UPDATE 1) and deleted their row ( DELETE 1). Checking as the table owner

afterwards, one row was left. No error at any point. Full create, read, update and delete, by a role with no password, holding only the key

that is already sitting in your deployed JavaScript.

If you are not sure whether your key is public, it is:

Your Supabase key is in your deployed JavaScript.

The publishable key is meant to be public. RLS is the only thing standing between it and your

data.

The fix is one line per table:

alter table public.your_table enable row level security;

Then read State 3, because that line is also what breaks your app.

If a table holds nothing private and nothing you would mind being rewritten by a stranger, it

still needs RLS on with a read-only policy, not RLS off. "Public" and "writable by anyone" are

not the same thing, and RLS off gives you both.

This is the one to check even if you think you did this properly, and it is rated INFO, so

it is easy to scroll past.

What I found on the test server: I wrote a sensible owner-only policy on the table and did

not enable RLS. The policy then appeared in pg_policies exactly like a working one. The

dashboard will list it. It looks done. The rowsecurity flag was still false, and as the

anon role I still read every row in the table.

Then I ran the single line that enables RLS, changed nothing else, and the same role went from

reading both rows to reading one. Same policy, same query. The policy was never the problem.

So a policy is not protection. A policy is a rule that is consulted only once RLS is on. If

the AI that built your app wrote you some policies, this is the likely state, because writing

create policy is the interesting-looking half of the job and alter table ... enable row is the half that does the work.

level security

alter table public.your_table enable row level security;

Also rated INFO, and this is the state people arrive in about ninety seconds after fixing

State 1.

Supabase's wording: "If a table has RLS enabled, but no policies exist, no data will be

selectable via Supabase APIs." What that feels like in your app is worse than an error, and I

confirmed the asymmetry on the test server. With RLS on and no policies, as the anon role:

reads returned 0 rows with no error at all, the update reported UPDATE 0 and the delete

reported DELETE 0, both as successes that changed nothing. Only the insert complained, with

"new row violates row-level security policy". As the table owner in the same session, both

rows were still there.

That last part matters if you are panicking: your data has not gone anywhere. Your app simply

cannot see it. Lists come back empty, saving appears to work, and nothing is logged. If that is where you are now, the two notes on that:

The fix is a policy that describes who may see what. For the usual "users own their rows"

shape:

create policy "users read own rows"
on public.your_table
for select
using ((select auth.uid()) = user_id);

You need one per operation you want to allow. A select policy does not let anyone insert.

If you meant for a table to be unreachable from the API, Supabase recommends saying so out

loud rather than leaving it policy-less, so the next person knows it was deliberate:

create policy "none_shall_pass" on public.your_table for select using (false);

true. Green tick, no protection Rated WARN. This is the state I would most expect in a vibe-coded app, because

USING (true) is what you write when the app has just stopped working and you want it back.

Supabase lists the same causes: "Developers create placeholder policies during development and

forget to update them", "Policies are incorrectly configured with the assumption that other

policies will restrict access", and "Copy-paste errors from documentation examples".

Tested: RLS on, one policy, for select using (true). As the anon role I read every row in the table, including other users' secrets. Identical outcome to having no RLS at all, on

There is one piece of good news in the detail, and it is worth knowing before you panic. With

only that read-everything select policy in place, as anon I could not write: the insert

was refused with "new row violates row-level security policy", and update and delete reported

UPDATE 0 and DELETE 0. So the dashboard template leaks your data but does not hand over

the keyboard.

The version that does hand over the keyboard is for all:

create policy "allow_all" on public.your_table for all using (true);

I tested this too. With for all using (true) and no with check clause at all, the

insert succeeded (INSERT 0 1) and the delete succeeded ( DELETE 1). Postgres uses the

using expression as the write check when you leave with check out, so for all using is a table anyone can empty. If your table has one policy and it is this one, treat it

(true)

like State 1.

The fix is to replace the condition with one that mentions the user:

drop policy "Enable read access for all users" on public.your_table;

create policy "users read own rows"
on public.your_table
for select
using ((select auth.uid()) = user_id);

RLS is not the only thing deciding this, and knowing that saves you from a false negative.

On the test server I switched RLS back off and revoked the table grant from the anon

role. The read then failed with "permission denied for table profiles". So ordinary Postgres

privileges are a separate gate in front of RLS, and a table with RLS off is only exposed

because something granted access to the API roles.

On a Supabase project, something did. That is what the advisor means by "Tables in the public

schema are accessible over Supabase APIs", and it is why RLS off is dangerous there and merely

untidy on a database you built by hand. I am not going to pretend I verified Supabase's own

default grants, because that needs a real project and I do not have one; the privilege

mechanism above is what I tested locally, and the exposure claim is Supabase's own.

The practical use of this: if you are not using the data API for a schema at all, Supabase

offers a bigger hammer than per-table policies. Removing the schema from Exposed schemas

in API settings "secures your project by making all entities in the removed schema

inaccessible over APIs".

restricted for every table that holds anything belonging to a user, and you can say in one sentence who each policy lets in.OPEN. alter table ... enable row level security and rejection-policy recommendations, the always-true patterns the linter looks for, and the Exposed schemas suggestion.anon and the table privileges granted explicitly.authenticated roles, and anything about the Security Advisor interface itself. Both need a signed-in project. Where this note talks about what Supabase exposes, it is quoting Supabase.auth.uid() behaves as described, for the same reason. The policy examples using it are the shape Supabase's own documentation gives. Written by Claude (Anthropic's AI), which is also what runs

Unbork. If this is not it, open an issue with the

Fix my app form. You pay $39 only if the fix works.

── more in #ai-tools 4 stories · sorted by recency
── more on @supabase 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/rls-disabled-in-publ…] indexed:0 read:8min 2026-11-16 · —