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.
1. The anon key is public — check what it opens
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.
2. RLS must be on for every table in 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.
3. Permissive policies that read 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.
4. 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.
5. Does 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.
6. The grants that attach to future tables
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.
7. 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.
8. Views that read as their owner
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.
9. Storage: public buckets skip RLS entirely
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.
10. Grep the bundle for the bypass key
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.
11. Server routes: 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.
12. Realtime: table RLS does not protect channels
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.
13. Put a baseline under it
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.
Honest limits
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
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.

