Audit a Supabase app with squirrelscan (the squirrel CLI or hosted squirrelscan MCP server) in Claude Code, GitHub Copilot, Codex, Cursor, and other coding a…
Install the skill above, then run this in your AI tool:
/supabase-security-audit <your description>
About
Check whether a Supabase app lets the public anon key read tables it should not, and whether any secret key reached the browser.
Source
What gets added to your project
Preview every file this package writes on install before you run the command above.
Summary
Audit a Supabase app with squirrelscan (the squirrel CLI or hosted squirrelscan MCP server) in Claude Code, GitHub Copilot, Codex, Cursor, and other coding agents to see if the public anon key can read tables with Row Level Security off...
Skill instructions
Supabase Security Audit
Check whether a Supabase app lets the public anon key read tables it should not, and whether any secret key reached the browser.
A Supabase app ships its project URL and anon (publishable) key to every visitor on purpose. That is safe only when every table in an exposed schema has Row Level Security (RLS) turned on with policies that grant just what each role needs. Supabase's own docs warn that a table in an exposed schema without RLS is readable and writable by any role with a grant on it, and that a secret (service role) key bypasses RLS and must never leave your control.
Before the first audit
Run squirrel --version. If it fails, install the CLI from squirrelscan.com/download (the squirrelscan skill has references/install.md). Then run squirrel auth status:
Signed out, or --offline: the audit runs on this machine, is free, and nothing is published.
Signed in: the audit is billed in credits (50 plus 2 per audited page, plus 1 per distinct external link the cloud verifies), adds the site to the user's dashboard, can turn on recurring audits and publishes an unlisted report. Tell the user the cost (squirrel credits) and get a yes. Offer --offline or --no-publish. For a site the user does not own, add --ephemeral: nothing is added to the dashboard, scheduled or published.
Every flag below is checked against the squirrel CLI docs (https://docs.squirrelscan.com/cli/audit). Rule docs: https://docs.squirrelscan.com/rules/{category}/{rule_id}.
Confirm ownership first
The probe sends the site's public anon key to the site's Supabase project, from the user's machine. Ask: "Is this your Supabase project, or are you authorized to test it?" If not, stop: do not run the probe. You can still read the code and report leaked-secrets passively.
Step 1: read the code (no network)
If the repo is available, search it before auditing:
Secret keys in client code: service_role, sb_secret_, SUPABASE_SERVICE_ROLE_KEY used in a file that ships to the browser (NEXT_PUBLIC_*, Vite VITE_*, PUBLIC_*, anything under src/ of an SPA). A secret key in the browser is an incident: rotate it first.
Every table the client queries: .from("<table>"), /rest/v1/<table>. This is the list the audit will probe.
Migrations: alter table ... enable row level security for each of those tables, and create policy statements.
It finds the project URL and anon key in the scripts the crawl fetched, and probes only tables the site's own code names, up to 30 per project and 40 per audit, with one HEAD /rest/v1/<table> each and Prefer: count=exact. It never reads a row; it reads only the status and the Content-Range total.
It runs only at --aggressive, only online (not --offline, external link checking on) and inside the probe budget. A hosted audit of an unverified site stays passive and skips it.
A secret key is never used for probing. security/leaked-secrets reports those if they are in the scripts.
Step 3: read the answer
Result
Meaning
Action
Fail, table listed with a row count
The anon key can see that many rows: RLS is off, or a policy lets anyone read
Fix below, or waive if the table is public by design
Pass
Every table the code names got a definite answer and none reported rows
Not proof for tables the code never names, views or RPC functions
Skipped probe-incomplete
Some tables were throttled, capped or unanswered
Not clean. Say how many were unchecked and re-run narrower or later
A count of zero cannot tell RLS hiding every row from an empty table. An empty table with RLS off becomes exposed when rows arrive, so check the migration, not only the result.
Step 4: fix
Turn on RLS for every table in an exposed schema, then add policies:
sql
alter table public.profiles enable row level security;
create policy "Users read their own profile"
on public.profiles forselectusing (auth.uid() = id);
With RLS on and no policy, the anon key reads nothing. Check each exposed table in Supabase's dashboard Security Advisor for others. Then:
Treat exposed rows as already read: rotate anything sensitive they held and tell the user which tables were exposed and how many rows.
Move any secret key out of client code to a server, Edge Function or CI secret, then rotate it.
Check views and RPC functions by hand: the rule does not probe them.
A table that is meant to be public (a posts table) still fails, because a count cannot tell a deliberate policy from RLS left off. Confirm with the user, then waive it:
toml
[[ignore]]rule = "security/supabase-rls"items = ["posts"]
reason = "posts is public by design"
Where the fix lives
Supabase SQL editor or the repo's supabase/migrations/ folder (a fix applied only in the dashboard is lost on the next migration reset, so commit it), the Auth and API settings pages for keys, framework env files (Next.js .env*, Vite .env) for what ships to the browser, and AI app builders' generated code (Lovable, Bolt and similar), which often creates tables with no RLS.
Stop condition
Stop when a re-run shows security/supabase-rls passing or skipped only for reasons you explained, no secret key in any shipped script (security/leaked-secrets clean), exposed keys rotated (ask the user to confirm), and every waived table has a reason.
Hand off
Everything else on the site (headers, exposed files, cookies): security-audit. Non-security findings: audit-website.
Add this badge to a GitHub README so readers can open the package page and install the same version.
[](https://www.aipm-registry.com/skills/squirrelscan/supabase-security-audit/1.0.0?utm_source=github&utm_medium=readme&utm_campaign=package_badge)
This imported publisher has not claimed its AIPM account. A connected account confirms account control, but it does not guarantee that a package is safe.
AI assistant context
What this skill is for
@squirrelscan/supabase-security-audit@1.0.0 is an AIPM skill package for All tools. Use it when a project needs the reusable AI behavior described as: Audit a Supabase app with squirrelscan (the squirrel CLI or hosted squirrelscan MCP server) in Claude Code, GitHub Copilot, Codex, Cursor, and other coding agents to see if the public anon key can read tables with Row Level Security off...
Diagnose slow page loads with squirrelscan audit rules via the squirrel CLI or hosted squirrelscan MCP server in Claude Code, GitHub Copilot, Codex, Cursor, and other coding agents, checking the largest image, render-blocking resources,...
Evaluate your site's agent experience with squirrelscan audit rules via the squirrel CLI or hosted squirrelscan MCP server in Claude Code, GitHub Copilot, Codex, Cursor, and other coding agents, checking robots.txt bot access, content pr...
Add a squirrelscan CI check using the squirrel CLI in Claude Code, GitHub Copilot, Codex, Cursor, and other coding agents for GitHub Actions, GitLab, and preview deploys. It picks thresholds from a baseline run of squirrelscan audit rule...
Run aipm add @squirrelscan/supabase-security-audit@1.0.0 in a project that has AIPM initialized.
Supported tools
@squirrelscan/supabase-security-audit@1.0.0 supports All tools.
Before installing
AIPM skills can add files to your project. Review the package name, target, description, license, and publisher before installing. Use a clean branch when trying a new skill.