More screenshots
Works with the AI Agents you already use
AI App Security Check: Supabase RLS & Leaked Keys
by Mike Dufour
This skill makes your agent check for all of them before you launch, the way a security reviewer would: 1.
Free
What it does
- Finds API keys, tokens and the Supabase service-role key in client code, shipped .env files, prompts and logs
- Checks every Supabase table and policy for missing RLS, using (true) and write grants to anon
- Flags open CORS, XSS sinks, string-built SQL, debug routes and client-only admin checks
- Reviews AI agent, MCP and n8n tools for prompt injection and dangerous actions
- Writes a P1 to P3 report with copy-paste SQL and code fixes
- Re-tests after your fixes and reports fixed, still open and new
Who it's for
Founders building with AI app builders
Make sure your app is safe before you share the link with the world.
Try asking: “Check my Lovable app for any leaked API keys or open database tables before I launch.”
Developers using AI agents and MCP servers
Find dangerous tools or prompt holes that could let someone control your agent.
Try asking: “Review my agent's tools and system prompt for security risks.”
Small shop owners using Supabase or Bolt
Verify that only your customers can see their own data.
Try asking: “Audit my Supabase RLS policies to make sure my customer data is private.”
AI App Security Check: Supabase RLS & Leaked Keys
Example session with this skill installed
I'm launching my Lovable app with Supabase next week. Check the project for leaked keys, missing row-level security and anything else that could get us hacked, then tell me exactly what to fix.
- Read your context and instructions
- Compiled the ai app security
Summary
Static review of the sample app 1-voor-herstel (5 files: dist bundle, server/api.js, supabase/migrations, prompts, .env). Network: none.
12 findings: 5 P1, 4 P2, 3 P3. All start as needs_validation; secrets are redacted to type + fingerprint.
Findings
| ID | Priority | Status | Finding | Location |
|---|---|---|---|---|
| F001 | P1 | needs_validation | Supabase service-role JWT in bundle | .env:2 |
| F002 | P1 | needs_validation | Supabase service-role JWT in bundle | dist/assets/index-8c1f.js:1 |
| F006 | P1 | needs_validation | Secret in a prompt template or log | prompts/support.txt:2 |
| F009 | P1 | needs_validation | SQL built from interpolated strings | server/api.js:3 |
| F012 | P1 | needs_validation | Table created without row-level security | supabase/migrations/001_init.sql:1 |
| F004 | P2 | needs_validation | Raw HTML injection sink | dist/assets/index-8c1f.js:3 |
| F007 | P2 | needs_validation | Permissive CORS | server/api.js:1 |
| F008 | P2 | needs_validation | Debug route or debug mode | server/api.js:2 |
| F010 | P2 | needs_validation | Sensitive value written to logs | server/api.js:5 |
| F003 | P3 | needs_validation | Admin or internal route | dist/assets/index-8c1f.js:5 |
| F005 | P3 | needs_validation | Role check in client code | dist/assets/index-8c1f.js:4 |
| F011 | P3 | needs_validation | Public read policy | supabase/migrations/001_init.sql:4 |
Evidence (secrets redacted)
- F002
dist/assets/index-8c1f.js:1→const SERVICE_KEY = "[REDACTED:jwt:cddfa8f97499]";decoded role =service_role: anyone who opens the site can read and write every table. - F012
001_init.sql:1→create table klanten (id uuid primary key, email text, plan text);with noenable row level security. - F009
server/api.js:3→"SELECT * FROM klanten WHERE email='" + req.body.email + "'": SQL injection. - F008
server/api.js:2→/api/debug/envreturnsprocess.envto anyone.
Fix these three first
- Rotate the service-role key in Supabase now (it has shipped), remove it from the bundle and
.envindist/, and call privileged actions from an edge function that holds the key server-side. - Turn on RLS with owner-only policies:
alter table public.klanten enable row level security;
create policy "owner reads own row" on public.klanten for select using (auth.uid() = id);
create policy "owner updates own row" on public.klanten for update using (auth.uid() = id) with check (auth.uid() = id);
- Parameterise the query and delete the debug route:
db.query("select * from klanten where email = $1", [req.body.email]); remove/api/debug/env; set CORS to your own origin.
Then: strip the key from prompts/support.txt, log user IDs instead of authorization headers, replace dangerouslySetInnerHTML with escaped text, and enforce the admin role in RLS instead of localStorage.
Re-test after the fixes
python3 scripts/scan_bundle.py 2-na-herstel --out r2 --compare r1/findings.json
Fixed: 12 · still open: 0 · new: 0
Next steps
- Reproduce each P1 once in a local test project with fake data before you close it.
- Add the scan to CI so a new key or table without RLS fails the build.
Connects securely to your tools. The creator never sees your data.
About this skill
Most AI-built apps ship with the same handful of holes: a Supabase service-role key in the browser bundle, a table without row-level security, a policy that says using (true), CORS open to every site, or an agent tool that can send email or run SQL on whatever a web page tells it.
This skill makes your agent check for all of them before you launch, the way a security reviewer would:
- Maps the project: client code, server code, SQL migrations, agent tools and n8n exports.
- Secrets first: Anthropic, OpenAI, Stripe, AWS, Google, GitHub and Slack keys, private keys, and Supabase JWTs (it decodes the role:
service_roleis critical,anonis fine). Secrets are shown only as type, file:line, first 4 characters and length. - Supabase / Postgres: tables without RLS, disabled RLS, always-true policies, grants to
anon,security definerwithout a fixedsearch_path, and SQL built from strings. - Web surface: wildcard CORS,
dangerouslySetInnerHTML/innerHTML/v-html, debug and admin routes, client-only role checks, JWT verification switched off, secrets in logs. - AI agents: shell, SQL, file, email and payment tools without allow-lists or human confirmation, and untrusted text placed in the system prompt.
- Report and fix: a prioritised report with why it matters, how to validate safely, and the exact fix (RLS policies scoped to
auth.uid(), server-side proxy for keys, deny-by-default tool gate). - Re-test: after your fixes it runs again and reports fixed / still open / new.
Static and offline: it reads your files and never calls your production system or a third-party site. Every finding starts as needs_validation, so you get evidence, not alarm.
The checks match the open-source, MIT-licensed scanner bundled as scripts/scan_bundle.py (23 rules, Python standard library only), so you can also run it in CI.
This is a static code review, not a live attack. It cannot find bugs in live servers or third-party platforms you use.
Works in any agent that loads SKILL.md (Claude Code, Codex CLI, Cursor, Gemini CLI, Copilot). The agent does the review with its own file tools; no install needed. Optional deterministic run (Python 3.8+, standard library only, no network): python3 scripts/scan_bundle.py <project-or-dist> --out security-report/ python3 scripts/scan_bundle.py <project> --out security-report-2/ --compare security-report/findings.json Outputs findings.json, REPORT.md, scope-manifest.json and RETEST.md. Secret values are never stored: only type, location and a one-way fingerprint. reference/rules.md lists all 23 rules with why, how to validate and the fix. Source and tests: the public ai-app-security-check repository (MIT).
How to use
- 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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
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
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 1 day ago
- Free with an Agensi account
Nothing to install. It runs in your AI agent.
- Optional
Python 3.8+ (only for the scripted scan)
Permissions
Reads your project files to find issues and writes security-report.md. The optional scanner runs locally with python3 and makes no network calls; secret values are never stored or printed.
What's inside
Frequently Asked Questions
New in Security
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.