Skip to content
All rules

SB-POLICY-OPEN

Row Level Security policy open to everyone

Severity
High
Confidence
High
Stack
Supabase
Runs
On by default

What the CLI looks for

A policy with USING (true) or WITH CHECK (true) that is not limited TO authenticated, or that targets anon.

Why it matters

USING (true) makes every row visible, or writable, to every role the policy applies to. Without a TO clause that excludes the anonymous role, anyone with your anon key can read or change the table.

How to fix it

Limit the policy to the authenticated role and to the owner of each row.

drop policy if exists "Public read" on public.profiles;

create policy "Owners read their profile" on public.profiles
  for select to authenticated
  using ((select auth.uid()) = user_id);