# AI App Security Check: Supabase RLS & Leaked Keys

> Audits your Lovable, Bolt, v0 or Supabase app before launch: finds leaked API and service-role keys, missing row-level security, open CORS, XSS and over-powered agent tools, then gives copy-paste fixes and a re-test. Runs offline; secrets are never printed.

AI App Security Check: Supabase RLS & Leaked Keys is a free AI agent skill on Agensi by Mike Dufour, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Mike Dufour](https://www.agensi.io/creators/mike-dufour)
- Category: [Security](https://www.agensi.io/skills/security)
- Version: 1.0.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/ai-app-security-check-supabase-rls-leaked-keys
- Tags: security, supabase, ai-agents, api, lovable

## 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: "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: "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: "Audit my Supabase RLS policies to make sure my customer data is private."

## 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:

1. **Maps the project**: client code, server code, SQL migrations, agent tools and n8n exports.
2. **Secrets first**: Anthropic, OpenAI, Stripe, AWS, Google, GitHub and Slack keys, private keys, and Supabase JWTs (it decodes the role: `service_role` is critical, `anon` is fine). Secrets are shown only as type, file:line, first 4 characters and length.
3. **Supabase / Postgres**: tables without RLS, disabled RLS, always-true policies, grants to `anon`, `security definer` without a fixed `search_path`, and SQL built from strings.
4. **Web surface**: wildcard CORS, `dangerouslySetInnerHTML` / `innerHTML` / `v-html`, debug and admin routes, client-only role checks, JWT verification switched off, secrets in logs.
5. **AI agents**: shell, SQL, file, email and payment tools without allow-lists or human confirmation, and untrusted text placed in the system prompt.
6. **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).
7. **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.

## Requires

- Optional: Python 3.8+ (only for the scripted scan)

## Known limitations

This is a static code review, not a live attack. It cannot find bugs in live servers or third-party platforms you use.

## Technical details

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 this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the AI App Security Check: Supabase RLS & Leaked Keys skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### What specific problems does this security check solve?

This skill acts as a safety inspector for apps built with AI tools. It scans your code and database settings to find hidden mistakes that hackers use, such as private keys left in the browser or database tables that are open for anyone to read.

### Do I need to install any special software or have an account to use this?

You just need to point your AI agent to your project folder or the files you downloaded from your app builder. The skill runs a local scan of your files and does not require you to sign up for any new accounts or send your data to the internet.

### What exactly do I get after the scan is finished?

You receive a detailed security report that lists every risk found, ranked by how serious it is. The skill also provides the exact code or database commands you need to copy and paste to fix those holes.

### Are there any types of security testing that this skill does not perform?

This skill is a static review of your code and files. It is not meant for scanning systems you do not own, performing live attacks on websites, or testing how a live app behaves while it is running.

### How should I ask my AI agent to start the security audit?

You can tell your agent to check your app before you launch it or ask if you have leaked any API keys. It is also helpful to ask for a review of your database rules or to check if your AI agent tools have too much power.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
