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. 1create policy "Admins manage invoices" on public.invoices
  2. 2 for all to authenticated
  3. 3 using ((auth.jwt() -> 'user_metadata' ->> 'role') = 'admin');
  4. 4
  5. 5create table public.feedback (
  6. 6 id bigint generated always as identity primary key,
  7. 7 message text not null
  8. 8);
  9. 9alter table public.feedback enable row level security;
  10. 10create policy "Anyone can send feedback" on public.feedback
  11. 11 for insert to anon, authenticated
  12. 12 with check (true);
  13. 14create table public.audit_log (
  14. 15 id bigint generated always as identity primary key,
  15. 16 event text not null
  16. 17);
  17. 18alter table public.audit_log enable row level security;
  18. 20create view public.note_counts as
  19. 21 select user_id, count(*) as notes from public.notes group by user_id;
  20. 23create or replace function public.is_admin()
  21. 24returns boolean
  22. 25language sql
  23. 26security definer
  24. 27as $$
  25. 28 select coalesce((select is_admin from public.profiles where id = auth.uid()), false);
  26. 29$$;