Rules

Supabase table has no Row Level Security

SR-SUPA-001 · Medium

Supabase serves tables in the public schema through its Data API, and the anon key in your frontend can call it. A table without Row Level Security can be read or changed by anyone who has that key, as far as the table's grants allow. The fix is to run enable row level security on every table in your migrations, then add a policy for each thing users are allowed to do. With RLS on and no policies, the anon key gets no rows at all, so you can turn it on first and open access one policy at a time.

The fix

Before · supabase/migrations/0001_profiles.sql
create table public.profiles (
  id uuid primary key references auth.users (id),
  display_name text
);
After · supabase/migrations/0001_profiles.sql
create table public.profiles (
  id uuid primary key references auth.users (id),
  display_name text
);

alter table public.profiles enable row level security;

create policy "Users can read their own profile"
on public.profiles for select
to authenticated
using ((select auth.uid()) = id);

How ShipReady finds it

ShipReady reads every .sql file in the repo, collects each create table and each enable row level security, and reports tables that never get the second statement. Findings carry rule ID SR-SUPA-001.

Run the check

Terminal
npx @shipmate-agency/shipready check .
GitHub Action
# .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.0

Want a person to check every area and send the fixes as pull requests? Launch Lockdown, $950 once.