The Supabase security checklist I run on every AI-built app (Lovable, Bolt, v0, Cursor) A developer published a read-only SQL checklist for auditing Supabase security in AI-generated apps from builders such as Lovable, Bolt, v0 and Cursor, arguing that these tools ship working logins and policies without deciding who can read which row. The checklist uses catalog queries and greps, never writes or requires service_role, to surface tables with RLS disabled, policies using USING (true), FOR ALL policies missing WITH CHECK, anon write grants, dangerous default privileges, SECURITY DEFINER functions without a pinned search_path, and views lacking security_invoker. An AI app builder will connect Supabase, create tables, generate policies and ship a working login in one session. What it will not do is sit down with your access model and decide who is allowed to read which row. That part is still yours — and the gap between "it works" and "it is closed" is measurable with read-only SQL. This is the order I run. Every step is a catalog read or a grep. None of them writes, deletes or needs service role , and all of them are safe to run on a production project. The key in your NEXT PUBLIC / VITE env is supposed to ship to the browser. The security boundary is not the key; it is what the key can touch. Fetch a table you believe is private with only the anon key and see whether rows come back. A populated response is the finding. public select n.nspname as schema, c.relname as table from pg class c join pg namespace n on n.oid = c.relnamespace where n.nspname = 'public' and c.relkind = 'r' and not c.relrowsecurity order by 1, 2; Every row is a table with RLS off. With the anon key and default grants, an RLS-off table in public is readable by anyone who has your project URL. true select schemaname, tablename, policyname, cmd, roles, qual, with check from pg policies where schemaname = 'public' and qual = 'true' or with check = 'true' ; USING true on a SELECT policy means every row is visible to every role the policy names — usually authenticated , which means every logged-in user. AI-generated schemas contain one of these surprisingly often so the demo works before anyone decides the access model. FOR ALL without WITH CHECK select tablename, policyname, cmd from pg policies where schemaname = 'public' and cmd = 'ALL' and with check is null; USING decides which existing rows a statement may touch. WITH CHECK decides which new row it may produce. Without it, a user can update a row they own into a state they should not reach — a different tenant, a different owner, an escalated status. anon hold write grants? select table name, privilege type, grantee from information schema.role table grants where table schema = 'public' and grantee in 'anon', 'authenticated' and privilege type in 'INSERT', 'UPDATE', 'DELETE' order by 1, 3; RLS still stops the write, but a grant is a second lock that should not be open by accident — and it is exactly the failure mode behind the Supabase October 30 grant change, where tables that relied on old default grants started returning 42501. select pg get userbyid defaclrole as creator, defaclobjtype as object type, defaclacl as acl from pg default acl; ALTER DEFAULT PRIVILEGES ... GRANT SELECT ON TABLES TO anon creates no row in role table grants and no policy. It waits here and attaches silently when the next migration creates a table. If your builder's migrations run as one role and your app queries as another, this is where tomorrow's leak is configured today. SECURITY DEFINER : pin search path select p.proname, p.prosecdef as security definer, p.proconfig as settings, has function privilege 'anon', p.oid, 'EXECUTE' as anon can execute from pg proc p join pg namespace n on n.oid = p.pronamespace where n.nspname = 'public' and p.prosecdef order by p.proname; A definer function runs with its owner's rights. If proconfig is null, search path is not pinned and the function can be redirected to another schema. If anon can execute is true and the function touches privileged data, that is a leak path no policy review will show you. select c.relname as view name, c.reloptions from pg class c join pg namespace n on n.oid = c.relnamespace where n.nspname = 'public' and c.relkind = 'v' and not coalesce c.reloptions, '{}' @ array 'security invoker=true' ; A normal view evaluates with the view owner's rights. If the owner also owns the base table and the table has no FORCE ROW LEVEL SECURITY , the view can return rows your caller's policies would hide. security invoker = true makes the view run as the caller. select id, name, public from storage.buckets order by name; A public bucket serves every object to anyone with the URL. For private data: private bucket, signed URLs, and storage.objects policies reviewed the same way as table policies — one per operation, scoped by owner. grep -rn "service role\|sb secret \|SUPABASE SERVICE" \ --include=" .ts" --include=" .tsx" --include=" .js" \ --include=" .env " . | grep -v node modules service role and sb secret bypass RLS by design. They belong in server-only code. Any hit imported by a client component, or prefixed NEXT PUBLIC / VITE , is a full-database key sitting in the browser. auth.uid is null unless you pass the token A route that queries Supabase with the anon key and no user JWT runs as anon . auth.uid is null, your policy filters everything, and the route returns empty or 42501. Worse: a route that trusts a user id from the request body instead of the verified JWT is an IDOR no matter how good the policies are. Postgres Changes is filtered by table RLS. Broadcast and Presence are authorized by policies on realtime.messages , and only for channels joined with private: true while "Allow public access" is off in Realtime settings. A public channel can be joined by anyone holding the anon key. Two policies are needed per topic — select to receive, insert to send — and a join-time policy cache means revoking a membership row does not disconnect anyone until their JWT refreshes. Everything above is a snapshot. The failure mode is not "I never checked"; it is "I checked in March and the schema changed in July". A nightly read-only diff over the same catalog queries reports only new fingerprints, and fails closed when the credential breaks instead of writing an empty baseline. These are catalog checks, not proof of a leak. They do not read application rows, do not run as service role and do not modify anything. I verified the queries against a local PostgreSQL 17 fixture — not against hosted Supabase projects, whose defaults and exact revision are outside what a public catalog query can tell you. Zero findings does not mean safe; the catalog cannot tell you what your access model should have been. If you want the executable version, the write-up with the full check set and a free nightly n8n workflow is on my site: https://cenkkurtoglu.com/blog/supabase-security-checklist-lovable-bolt-v0-cursor https://cenkkurtoglu.com/blog/supabase-security-checklist-lovable-bolt-v0-cursor If you'd rather have a person read the output and separate real exposure from noise, that is a fixed-scope review — and it starts only after payment is secured.