Skip to content

v1.3.0: Supabase policies

Latest

Choose a tag to compare

@azank1 azank1 released this 31 Oct 20:40
· 5 commits to main since this release

Supabase policies that never check whose row it is. Row-level security protects a table only if each policy compares the row with the user. The usual next step after fixing permission denied for table is a policy such as for all using (true), which switches row-level security on and opens every row anyway. The new rule rls-policy-always-true flags a permissive policy whose condition is true, or only checks that the user is signed in (auth.uid() is not null, auth.role() = 'authenticated'):

  • critical when the migrations grant anon a write and the policy lets anyone with the app's public key change or delete every row;
  • high when any signed-in user can, or when anyone can on a table whose grants come from Supabase's defaults before 30 October 2026;
  • low for an insert-only policy open to anon, which is fine for a contact form and worth a look anywhere else.

Read-only policies are not flagged, since public data needs them, and restrictive policies never are. The table's grants bound what a policy can open. Policies created inside DO blocks, and later drops, alters and renames, are replayed.

Every grade was reproduced in Supabase's Postgres 17 image: under for all using (true), anon read, changed and deleted every row; an update policy limited to signed-in users let any of them change every row and anon none; a select-only grant stopped the update with Postgres's own hint to GRANT UPDATE … TO anon. The fix, in docs/fixes.md, was checked the same way.