high · M3 · MASVS-AUTH-2 · PTKD-BACKEND-SUPABASE-OPEN-POLICY
Supabase policy that lets every row through
A Row Level Security policy uses `true` as its condition, so RLS is on but does nothing: every caller the policy covers can reach every row.
How it is exploited
To make an error go away, an AI assistant writes `create policy "allow all" on public.orders for all using (true) with check (true);`. RLS is technically on, so dashboards look green, but any visitor with the anon key can rewrite another customer's order or mark it paid.
Why it matters
Same as no RLS for the covered operations: other users' data can be read, changed or deleted.
How to fix it
- List policies with `select * from pg_policies where schemaname = 'public';`.
- Rewrite each `true` condition to check ownership, for example `(select auth.uid()) = user_id`.
- Split `for all` into separate select / insert / update / delete policies so each gets the right condition.
- If a table is genuinely public (a product catalogue), allow SELECT only, never write.
Does your app have this?
PTKD checks your build or your source project for PTKD-BACKEND-SUPABASE-OPEN-POLICY and every other check in this knowledge base.
Scan your appReferences
Related checks (M3)
- Permissive CORS with credentials
- State-changing request succeeded without authentication
- Weak JWT observed on the wire
- Biometric authentication not bound to a cryptographic key
- Premium access is stored on the phone and trusted (heuristic)
- Firebase rules trust an email address nobody verified
- Firebase security rules open to everyone
- Users can make themselves admin or premium in Firestore