You asked an AI tool to build your app and it works. The login works, the data shows up, the buttons do what they should. What you cannot see is whether the database behind it is locked down or standing open.
This happens more than people admit. An AI builder writes the app, wires up Supabase, and ships it with row level security off on a table, or with a policy that lets everyone through. The app looks finished. The database is not.
Eight queries
The check is eight read-only SQL queries you paste into the Supabase SQL Editor. They list every table with RLS off, every policy that lets everyone through, every SELECT grant to anonymous visitors, and every SECURITY DEFINER function that skips RLS entirely. Read-only means the audit cannot change or leak anything itself. It only reads the catalogue.
I ran all eight against a local Postgres 16 database with a dummy schema built to hold the common mistakes: a table with RLS off, a table with RLS on and no policy at all, a policy that lets anon through with USING (true), and a SECURITY DEFINER function that reads a secrets table. The audit caught every one of them. The run also caught a real bug in my first draft of the queries, which is fixed in the shipped file.
The MCP half
The second half is a small Node script. You point it at an MCP server and it lists the server's tools and saves a baseline. Run it again later and it reports what changed: tools added, inputs widened, descriptions rewritten. I ran it against the official filesystem MCP server, 16 tools, and a test server built to change. It caught the added tool and the widened input both times.
One thing the kit is honest about: the RLS audit was not run on a Supabase cloud project, because no login was available. The guide says so in three places. The queries are standard Postgres and run unchanged in the Supabase SQL Editor, but the cloud run itself is yours to do, and the guide tells you exactly how.
The one-page pre-flight checklist is free: MCP pre-flight checklist. The full kit, guide plus SQL plus script plus checklist, is $29: AI-App Security Audit Kit.
The full numbers behind this one are in the AI-App Security Audit Kit. Everything I write here stays free, that part doesn't change. — Salam
More from AheadKit: programming books, packs and AI tools. Each page lists exactly what's inside before you pay.
Top comments (4)
For the SECURITY DEFINER query, listing them isn't quite the test. What matters is
has_function_privilege('anon', fn, 'execute'). On PG17,revoke execute ... from anonstill left it true and anon read the secrets table, because EXECUTE is granted to PUBLIC by default. Only revoking from public turned it false.Listing them only says they exist, it doesn't say anon can run one — the privilege check is the real test. The PUBLIC default is the nasty bit, revoke from anon looking like it worked while nothing changed. Going to run the privilege version against the same dummy schema and see if revoke-from-public is what actually closes it. Was that a real Supabase project or a local PG17?
Local PG17, not a real project. One thing to watch on Supabase though: as far as I know the public schema there has default privileges that grant execute on new functions straight to anon, so it's not only via PUBLIC. I mimicked that locally and revoke from public alone left has_function_privilege true for anon. Only after revoking from anon as well did it go false, so I'd do both.
Local PG17 makes it cleaner, no real project to worry about breaking. The Supabase default-privilege bit is the part I missed. Revoke from public alone still leaves anon with execute, so the run has to test both revokes side by side. Going to run it that way. Is that default privilege written down anywhere on Supabase's side, or just something you found by poking at it?