Skip to content

Supabase RLS using (true): what the policy really allows

Supabase

View as MarkdownOpen in ClaudeOpen in ChatGPTOpen in Perplexity

The question is copied too. If the chat opens empty, paste it.

On this page
  1. What does using (true) mean in a Supabase policy?
  2. What did each policy allow in my test?
  3. Why can an open insert policy look safe?
  4. How do you find these policies?
  5. How do you fix it?
  6. When is using (true) fine?
  7. My similar case

TL;DR

using (true) matches every row for every role the policy names. In my local test, a select policy with it gave the public key all 3 of 3 rows, and a for all policy let one signed-in user change and delete another user’s orders. RLS was on the whole time. Replace true with a condition on the caller, and treat a green Advisor as no proof for reads: its lint for this skips select policies.

My Supabase security checker has a rule called “Policies that allow every row”. It exists because this is what usually comes right after someone enables RLS. The app goes empty, because RLS with no policy returns nothing, and the quickest policy that brings the data back is using (true). The screen works again and RLS still shows as on, so it looks finished.

What does using (true) mean in a Supabase policy?

A policy is a condition Postgres checks for each row. using decides which existing rows a role can see, update or delete. with check decides which new or changed rows it can write. true is a condition every row passes, so the policy stops separating anyone’s rows from anyone else’s.

If the policy has no to clause, it applies to every role, and that includes anon, the role behind the publishable key that anyone can copy from your page.

What did each policy allow in my test?

I made a table orders on a local Supabase stack (CLI 2.109.1, Postgres 17.6) with two users: Alice owns 2 fake orders and Bob owns 1. RLS was on in every row of this table. I called the Data API as a browser does.

RLS on every time, three different results. Local Supabase, 3 rows of fake orders. Read, signed out: Publishable key → select using (true) → 3 of 3 rows; Write, signed in as Bob: Bob's token → for all using (true) → Alice's row changed; Same write, owner policy: Bob's token → auth.uid() = user_id → 0 rows changed.
My reproduction on a local Supabase stack, 2 November 2026.
Policy on orders Publishable key, signed out Bob, signed in
No policy 0 rows 0 rows
for select using (true) 3 of 3 rows 3 of 3 rows
for all to authenticated using (true) with check (true) 0 rows 3 of 3 rows, changed 1 of Alice’s, deleted 1 of Alice’s
Owner policies with (select auth.uid()) = user_id 0 rows His 1 row, changed 0 of Alice’s, deleted 0 of Alice’s

The third row is the one people miss. Adding to authenticated feels like the safe version, and the signed-out test passes. But sign-up is usually open, so anyone can become authenticated in a minute.

Why can an open insert policy look safe?

I also tried for insert to anon with check (true) with no select policy, the setup of a contact form. The same insert gave two different answers depending on one header:

Header on the POST Answer Row written?
Prefer: return=minimal 201 Created Yes
Prefer: return=representation 401, code 42501 No

With return=representation the request also has to read the new row back, and no select policy allows that. So a test that uses that header reports a refusal, and a script that leaves the header out writes the row. Test the write itself, then count the rows in the table.

How do you find these policies?

Run this in the SQL editor:

select tablename, policyname, cmd, roles, qual, with_check
from pg_policies
where schemaname = 'public'
  and (qual = 'true' or with_check = 'true');

It finds the literal form only. In my test, a policy written with check (1 = 1) was stored as (1 = 1) and this query did not match it, so read the rest of pg_policies too.

Supabase’s Security Advisor has a lint for this, rls_policy_always_true. Per the pull request for a related lint it covers write commands only, so a read policy with using (true) will not show up there. My checker’s rule looks at the same risk from the write side. For reads, check that query’s results yourself.

How do you fix it?

Replace true with a condition on the caller, one policy per command. These are the policies from the last row of my test:

create policy own_read on public.orders
for select to authenticated
using ((select auth.uid()) = user_id);

create policy own_upd on public.orders
for update to authenticated
using ((select auth.uid()) = user_id)
with check ((select auth.uid()) = user_id);

create policy own_del on public.orders
for delete to authenticated
using ((select auth.uid()) = user_id);

When is using (true) fine?

For data that really is public, such as a list of published articles or a price table. Then write it as narrowly as you can: for select to anon using (true), no write grants, and no column in that table you wouldn’t put on the home page. A contact form can keep with check (true) on insert with no select policy, and the Advisor will keep listing it. Note the reason in the migration.

To prove the real policies hold, run each one as two different users. The steps are in how to test Supabase RLS, and more patterns are in Supabase RLS policy examples.

If you want a person to go through the whole app rather than one setting, I do a Supabase security audit with a keep, fix or rewrite verdict for each part.

My similar case

I applied the migrations of 1,170 public Supabase projects to fresh databases: of the 568 that ran cleanly, 134 (23.6%) had a table with RLS off that the public key could read and change. The method and queries are in the open-source Supabase study.

Not sure your policies really restrict anything? Write to me and we’ll test them.

Do your policies restrict anything?

Tell me what you have now and what you need. I'll reply with the option I'd pick.

Write to me

© 2026 Denys Zaichenko. Original article: https://madsalt.tech/notes/supabase-rls-using-true/