Supabase RLS policy with USING (true) lets anyone write
A Row Level Security policy only protects a table if its condition checks who is asking. A policy for insert, update, delete or all with using (true) or with check (true) passes for every request, so anyone holding the anon key can write or remove rows through the Data API. Read policies with true can be fine for public data, which is why ShipReady skips for select. The fix is to scope each write policy to the signed-in user, usually by comparing (select auth.uid()) to the row's owner column, and to limit it to the authenticated role.
The fix
create policy "Anyone can update posts"
on public.posts for update
using (true);create policy "Authors can update their own posts"
on public.posts for update
to authenticated
using ((select auth.uid()) = author_id)
with check ((select auth.uid()) = author_id);How ShipReady finds it
ShipReady reads the create policy statements in your .sql files and reports each one that uses using (true) or with check (true) and is not limited to for select. Findings carry rule ID SR-SUPA-002.
Run the check
npx @shipmate-agency/shipready check .# .github/workflows/shipready.yml
name: ShipReady
on: [push, pull_request]
permissions:
contents: read
security-events: write
jobs:
shipready:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: deeflect/shipready@v0.2.0Want a person to check every area and send the fixes as pull requests? Launch Lockdown, $950 once.