Skip to content
SlashClone
Made by@shipcheck

Supabase rls audit

@shipcheck/supabase-rls-audit

Audit row level security in your Supabase migrations before you launch. Finds tables with RLS off, policies that let anyone write, policies that trust user_metadata, views that skip RLS, and risky SECURITY DEFINER functions, then drafts a fix migration for you to review. Reads .sql files only and never touches your database.

SkillDevOpsv1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1-- Example migrations for a small notes app. Several mistakes are on purpose.
  2. 2create table public.profiles (
  3. 3 id uuid primary key references auth.users (id) on delete cascade,
  4. 4 display_name text,
  5. 5 is_admin boolean default false
  6. 6);
  7. 7alter table public.profiles enable row level security;
  8. 8
  9. 9create policy "Profiles are viewable by everyone" on public.profiles
  10. 10 for select using (true);
  11. 12create policy "Users can update own profile" on public.profiles
  12. 13 for update to authenticated
  13. 14 using ((select auth.uid()) = id)
  14. 15 with check ((select auth.uid()) = id);
  15. 17create table public.notes (
  16. 18 id bigint generated always as identity primary key,
  17. 19 user_id uuid not null references auth.users (id),
  18. 20 body text not null,
  19. 21 created_at timestamptz default now()
  20. 22);
  21. 23alter table public.notes enable row level security;
  22. 25create policy "Signed in users can do anything" on public.notes
  23. 26 for all to authenticated
  24. 27 using (auth.role() = 'authenticated');
  25. 29create table public.invoices (
  26. 30 id bigint generated always as identity primary key,
  27. 31 user_id uuid not null,
  28. 32 amount_cents integer not null,
  29. 33 status text not null default 'open'
  30. 34);