Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Supabase Production & RLS Security Pack

    1

    Eight agent skills plus an RLS auditor and key-leak scanner that find and fix the Supabase mistakes behind most vibe-coded data leaks, tested on a real stack.

    $29

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Supabase Production & RLS Security Pack

    Supabase Production & RLS Security Pack

    Example session with this skill installed

    Before we launch, check our Supabase database. We have profiles and invoices tables and an invoice_summary view for the dashboard.

    • Read your context and instructions
    • Compiled the supabase production

    Summary

    Anyone with the publishable key from your website could read, change or delete every profile (including is_admin), write any invoice, and read every customer's totals through the view. Fixed with one migration, proved with pgTAP, re-audited clean.

    Audit (real output, trimmed)

    $ node audit-rls.mjs "$SUPABASE_DB_URL"
    Exposed schemas audited: public
    
    HIGH (3)
      [policy_allows_all_writes] public.invoices policy "Enable all for users"
          Permissive all policy for public with WITH CHECK (true): any row can be written
      [rls_disabled] public.profiles
          RLS is off. Client roles can reach every row: anon:select, anon:insert, anon:update, anon:delete, ...
      [view_bypasses_rls] public.invoice_summary
          View runs with its owner's rights, so RLS on its base tables does not apply.
    
    Summary: 3 high, 2 medium, 2 low, 6 info
    

    Fix migration

    alter table public.profiles enable row level security;
    revoke all on table public.profiles, public.invoices from anon, authenticated;
    grant select, update (full_name) on table public.profiles to authenticated;
    grant select on table public.invoices to authenticated;
    
    create policy "profiles_select_own" on public.profiles for select to authenticated
      using ((select auth.uid()) = id);
    create policy "profiles_update_own" on public.profiles for update to authenticated
      using ((select auth.uid()) = id)
      with check ((select auth.uid()) = id);
    
    drop policy "Enable all for users" on public.invoices;
    create policy "invoices_select_own" on public.invoices for select to authenticated
      using ((select auth.uid()) = user_id);
    create index invoices_user_id_idx on public.invoices using btree (user_id);
    
    alter view public.invoice_summary set (security_invoker = true);
    revoke all on public.invoice_summary from anon, authenticated;
    grant select on public.invoice_summary to authenticated;
    

    Invoices become read-only for customers (the billing backend writes them with the secret key), and the column grant lets users rename themselves but not set is_admin.

    Proof

    set local role authenticated;
    set local request.jwt.claims = '{"sub": "22222222-2222-2222-2222-222222222222", "role": "authenticated"}';
    select is_empty($$select * from public.invoice_summary$$, 'other user sees no totals through the view');
    select throws_ok($$update public.profiles set is_admin = true$$, '42501', null, 'user cannot make themselves admin');
    
    $ supabase test db
    All tests successful.  Files=1, Tests=5  Result: PASS
    $ node audit-rls.mjs "$SUPABASE_DB_URL"
    Summary: 0 high, 0 medium, 0 low, 5 info
    

    Next steps

    • Run scan-key-leaks.mjs over the production build.
    • Review Auth URLs and SMTP, Edge Function verify_jwt, bucket settings and backups.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Agents build Supabase apps fast and leave the doors open: tables without RLS, using (true) on writes, policies that trust user_metadata, views that bypass RLS, SECURITY DEFINER functions callable by anyone at /rest/v1/rpc, the service role key in a client component, getSession() used for server auth, public buckets anyone can list, Edge Functions with verify_jwt off and no check in code. Most training data also predates the publishable and secret keys, opt-in Data API exposure and Next.js 16's proxy.ts, so agents keep writing SUPABASE_ANON_KEY and deprecated auth-helpers code.

    This pack gives the agent current rules for each of those, checked against the Supabase docs and source, and two tools that look at your real project.

    What's inside

    • supabase-production: entry point, pre-flight checklist, versions, the platform changes that invalidate older advice.
    • supabase-rls: per-operation policies, (select auth.uid()), teams via private definer helpers, recursion, security_invoker views, MFA aal2, anonymous users, custom claims, column privileges, indexes, and two pgTAP test files.
    • supabase-security-audit: audit-rls.mjs connects to a database URL, runs 21 checks and prints a fix for each finding.
    • supabase-api-keys: publishable/secret vs anon/service_role, the retirement timeline, migration, leak response, and scan-key-leaks.mjs for source, .env files and build output.
    • supabase-auth-production: Next.js 16 @supabase/ssr setup, getClaims, safe callback routes, redirect URLs, SMTP, rate limits, CAPTCHA, TOTP MFA.
    • supabase-storage-realtime: bucket limits, the policy each storage call needs, owner folders, private Realtime channels.
    • supabase-edge-functions: verify_jwt, @supabase/server auth modes, webhooks, CORS, secrets, a 401 decoder.
    • supabase-migrations-backups: CLI migrations without drift, CI, branching, backups and PITR, restore drills.

    Verified, not just written

    Every SQL block runs in an automated test against a local Supabase stack, the policy tests pass under supabase test db, TypeScript typechecks under --strict, and the Storage, Realtime and Edge Function patterns were exercised with real requests. It also caught a policy in Supabase's own MFA docs that fails with permission denied for table mfa_factors; the pack ships the working version.

    Versions

    supabase-js 2.117, @supabase/ssr 0.12, @supabase/server 1.9, Supabase CLI 2.120, Postgres 17, Next.js 16.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scanned

    Verified clean 6 days ago

    • Passed all security checks, Safe to install

    Requires

    Supabase

    Listed6 days ago

    What's inside

    Frequently Asked Questions