Skip to content
OwnlyPlans

Skill

Supabase RLS Review

A Claude skill that finds Supabase tables leaking data and hands you the SQL to fix each one, plus a two-account test plan.

Remix

Install

Terminal
mkdir -p ~/.claude/skills/supabase-rls-review && curl -fsSL "https://wonly.dhfm.in/builder-4392ac/supabase-rls-review/skill/?download=1" -o ~/.claude/skills/supabase-rls-review/SKILL.md

Saves SKILL.md to your Claude skills folder. Restart Claude Code to load it.

SKILL.md

Open the file

Supabase RLS review

You check that every table exposed through the Supabase API is protected, and you prove it with queries instead of guessing.

Steps

  1. List the tables in the public schema (and any other schema exposed in API settings). If the Supabase MCP is connected, use it read-only; otherwise ask for supabase/schema.sql or a pg_dump --schema-only.
  2. For each table, record:
    • Is RLS enabled? (select relname, relrowsecurity from pg_class where relnamespace = 'public'::regnamespace and relkind = 'r';)
    • Which policies exist, for which command (select, insert, update, delete) and role.
  3. Flag, highest risk first:
    • RLS disabled on a table with user data. This is a leak: anyone with the anon key can read it.
    • A select policy of using (true) on personal data.
    • update policies without a with check, so a user can move a row to someone else or change their own role.
    • Policies that trust columns the user can write, such as role on their own profile.
    • security definer functions without set search_path = ''.
    • Views that bypass RLS (missing security_invoker = true on Postgres 15+).
  4. For each finding, write the fix as SQL the user can review, for example:
   alter table public.notes enable row level security;
   create policy "own notes" on public.notes
     for select using ((select auth.uid()) = user_id);
  1. Give a test plan with two accounts, A and B: what A must not be able to read or change of B's data, through the app and through direct API calls with A's token.

Rules

  • Never print or ask for the service role key. Never run write queries yourself; hand over SQL.
  • Prefer (select auth.uid()) over auth.uid() in policies, so it is evaluated once per query.
  • If you are unsure whether a column is personal data, ask.

Output

A table of findings (table, problem, risk, fix), then the SQL, then the two-account test plan.

About

Most Supabase leaks are one missing line: RLS switched off, or a policy that trusts a column the user can change. This skill checks every table, ranks the problems and writes the fix as SQL you review.

Works best with the Supabase MCP connected read-only.

Files and links

  • SKILL.md 2 KB Save to ~/.claude/skills/supabase-rls-review/SKILL.md
  • Supabase MCP (read-only) MCP config Optional. Lets Claude read your schema without changing data.

    Check it before you connect it. This server runs with your permissions: npx -y @supabase/mcp-server-supabase@latest --read-only --project-ref=YOUR_PROJECT_REF It needs SUPABASE_ACCESS_TOKEN. Use your own and never share them.

    Claude Code
    claude mcp add-json supabase '{"command":"npx","args":["-y","@supabase/mcp-server-supabase@latest","--read-only","--project-ref=YOUR_PROJECT_REF"],"env":{"SUPABASE_ACCESS_TOKEN":"YOUR_PERSONAL_ACCESS_TOKEN"}}'

Your AI tool
Starter prompt

		

Download the plan