Supabase database

Is using (true) safe in a Supabase RLS policy?

Only for data you would happily publish, such as a product list, or as an insert-only rule on a contact form. Anywhere rows belong to someone it is a leak, because true approves every row for every role the policy applies to, and “authenticated” includes any stranger who signs up.

TL;DR

  • using (true) with no to clause applies to everyone, logged-out visitors included. In our lab a visitor read every email and phone number in profiles.
  • to authenticated using (true) kept visitors out, but a stranger who had just signed up read every booking, clinic notes included.
  • for update using (true) let a visitor change another user’s email.
  • Fine uses we tested: a public product list, and a contact form with an insert-only with check (true) and no read access.

What true means in a policy

A policy’s using expression is asked once per row: may this user see (or change) this row? true answers yes for every row. The to clause says which roles the policy is for. Leave it out and the policy is for public, meaning every role, including anon, the logged-out visitor. Supabase’s RLS guide says a policy that reads to anon using (true) grants every unauthenticated visitor read access, and to use it only for data meant to be public.

AI builders write these policies because they make permission errors go away. They often name them “Enable read access for all users”, which is accurate.

Four tables, tested

We called each through real PostgREST with only the public key, then as a stranger who had signed up and owned nothing.

lab output, 5 Dec 2026 (Postgres 17.11 and 18.6, PostgREST 12.2.12)
-- 1. products: for select to anon, authenticated using (true)       (meant to be public)
anon GET /products: [{"id":1,"name":"Mug","price":800}] [HTTP 200]
-- 2. profiles: for select using (true)   (no "to")
anon GET /profiles: [{"email":"alice@example.com","phone":"07700 900111"},
                     {"email":"bob@example.com","phone":"07700 900222"}] [HTTP 200]
-- 3. bookings: for select to authenticated using (true)
anon GET /bookings: [] [HTTP 200]
stranger who just signed up GET /bookings: [{"clinic":"physio","notes":"knee, 2nd visit"},
                                            {"clinic":"dental","notes":"root canal"}] [HTTP 200]
-- 4. messages: for insert to anon, authenticated with check (true), insert-only grant
anon POST /messages: [HTTP 201]
anon GET /messages:  {"code":"42501","message":"permission denied for table messages"} [HTTP 401]
-- 5. profiles: for update using (true), next to the public read policy
anon PATCH alice's email: [{"id":"11111111-…","email":"attacker@example.com"}] [HTTP 200]

Rows 1 and 4 are fine. Rows 2, 3 and 5 are leaks. Row 3 is the one people miss: “signed in” sounds private, but unless you turned off “Allow new users to sign up”, anyone can create an account in seconds. Supabase’s docs add that anonymous sign-ins, if you enable them, also use the authenticated role.

When it is fine, and when it is not

PolicyFine forA leak on
for select using (true)Products, blog posts, opening hours, public listingsProfiles with emails or phones, orders, bookings, messages, anything with a user_id
for select to authenticated using (true)Content every member may see, in an app where you approve who signs upAnything per-user, in an app anyone can join
for insert with check (true)Contact forms and waitlists, with no read policy for visitorsTables where the inserted row decides access (roles, team members, orders)
for update or for delete using (true)Almost neverEverything: anyone it applies to can change or wipe every row

Supabase’s Security Advisor flags always-true INSERT, UPDATE and DELETE policies as “RLS Policy Always True”. Its code skips SELECT on purpose, so rows 2 and 3 above get no warning. See Security Advisor warnings explained.

Check your project (read-only)

always-true-policies.sql (read-only)
select tablename, policyname, cmd, roles,
       coalesce(qual, '-') as using_expr, coalesce(with_check, '-') as with_check
from pg_policies
where schemaname = 'public' and (qual = 'true' or with_check = 'true')
order by tablename, cmd;
lab output
messages | Anyone can send a message                 | INSERT | {anon,authenticated} | -    | true
products | Products are public                       | SELECT | {anon,authenticated} | true | -
profiles | Public profiles are viewable by everyone. | SELECT | {public}             | true | -

For every row, ask: should a stranger see, add or change every row of this table? {public} in roles means the policy has no to clause.

The fix

supabase/migrations/…_replace_always_true.sql
-- Rows that belong to a user: owner only
drop policy "Signed-in users can read bookings" on public.bookings;
create policy "read own bookings" on public.bookings
  for select to authenticated using ((select auth.uid()) = user_id);

-- Writes: never true
drop policy if exists "Enable update for all users" on public.profiles;
create policy "update own profile" on public.profiles
  for update to authenticated
  using ((select auth.uid()) = id) with check ((select auth.uid()) = id);

-- Keep true only where the data is public, and name the roles
-- create policy "Products are public" on public.products for select to anon, authenticated using (true);
lab output after the fix
stranger GET /bookings: [] [HTTP 200]
alice GET /bookings:    [{"clinic":"physio"}] [HTTP 200]

If a public profile page needs a name and an avatar but not the email, keep the read policy and move the private columns: see can RLS hide a column?

Ask your AI builder to fix it

Prompt for your AI builder
List every Supabase RLS policy in my project whose using or with check is true. For each one, tell me the table, the command and the roles. Keep true only for tables that are meant to be public (like products) and for insert-only contact forms with no read access. Replace every other one with an owner condition ((select auth.uid()) = user_id, or = id for profiles), always with a to clause naming the role. Never use true on update or delete. Write it as one new migration and show me the SQL before you apply it.

Questions people ask

Is using (true) safe in Supabase?

Only on data meant to be public, or as an insert-only rule on a form nobody reads back through the API. On tables where rows belong to users it exposes every row. In our lab it let a logged-out visitor read every email and phone number in a profiles table.

Is "to authenticated using (true)" safe?

Not in an app anyone can sign up to. It lets every signed-in user read every row. In our lab a stranger who had just signed up read every booking. Anonymous users, if enabled, also use the authenticated role.

What happens if a policy has no "to" clause?

It applies to the public role, which means every role, including anon, the logged-out visitor. Supabase's RLS guide says to always name the role with to.

Does Supabase warn about using (true)?

For INSERT, UPDATE and DELETE policies, yes: the Security Advisor shows "RLS Policy Always True". For SELECT policies, no. The linter's code excludes them on purpose because public reads are often deliberate.

Sources and lab

  • Supabase: Row Level Security, read 5 Dec 2026: to anon using (true) grants every visitor read access; always name the role.
  • Supabase: Anonymous sign-ins: anonymous users use the authenticated role.
  • Supabase: lint 0024 and its code at cc529aa (17 Nov 2026), which excludes SELECT.
  • Lab: Postgres 17.11 and 18.6 with PostgREST 12.2.12 and a Supabase role shim, real HTTP requests as a logged-out visitor, an owner and a signed-in stranger, 5 Dec 2026. Synthetic data only. Same results on both versions.

The checks behind this guide, each with example code, a self-check and the fix.

Free check

Check your migrations for this, free.

Paste a public GitHub repo. The free RLS check reads its supabase/migrations and flags tables with RLS off or no policies, always-true policies, update policies with no WITH CHECK, SECURITY DEFINER functions anyone can call or with no fixed search_path, views that skip RLS and public buckets. It never connects to your database.

Free, no sign-upReads migration files onlyHow it works

Written by Manraj Singh Dhillon. Last checked 5 Dec 2026. Code samples are synthetic and run against your own project; nothing here names a real app. Spotted a mistake? Tell us.