Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 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.

    Requires Supabase CLI 2.120+ and @supabase/ssr. Does not support legacy auth-helpers or versions of Next.js older than 15. Standardized for Postgres 17.11.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by 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 scan

    Security scan passed 1 month ago

    Requires

    Supabase

    Permissions

    Terminal / Shell
    Network Access
    Environment Variables
    Read Files

    Allowed Hosts

    api.supabase.com
    Listed1 month ago

    What's inside

    Frequently Asked Questions

    This skill is specifically tuned for the 2026 Supabase ecosystem, addressing the deprecation of legacy keys and the shift to Postgres 17, which general-purpose AI models often overlook or hallucinate.

    It targets supabase-js 2.117, @supabase/ssr 0.12, Supabase CLI 2.120, Postgres 17 (15+ for security_invoker views) and Next.js 16, with notes for Next.js 15. Projects still on the deprecated auth-helpers get a migration path to @supabase/ssr. The scripts need Node.js 20+ and nothing else.

    The skill provides a specialized hardening framework, including multi-point security audit checklists, leak detection for build outputs, and migration paths for the latest publishable/secret key systems.

    Yes. The API keys guide has a leak response: rotate to the new secret keys, revoke the leaked one, find where it was exposed with scan-key-leaks.mjs, then run audit-rls.mjs to close the RLS gaps that made the leak damaging.

    Ask your agent to audit the Supabase project. It runs audit-rls.mjs against your database connection string (local, direct or pooler), explains each finding, writes a fix migration and pgTAP tests, then re-runs the audit to confirm.

    New in Data & Databases