Over the past week I read through the public code of 145 recently shipped web apps built on Supabase β most of them Next.js, the stack AI coding tools reach for by default. I wasn't running scanners against anyone's servers. I read what the repos themselves publish: migration files, schema dumps, config. No repos are named here, and nothing was probed or tested live.
16 of the 145 β 11% β had at least one serious, exploitable-by-design problem sitting in plain sight. Here's what they were, because the patterns repeat almost word for word.
Row Level Security was enabled. The policies existed. They just didn't restrict anything:
CREATE POLICY "allow_all" ON orders
FOR ALL TO authenticated
USING (true) WITH CHECK (true);
Variations I kept seeing:
FOR SELECT USING (true) on tables holding names, emails, and phone numbers β any signed-in user can read every row.INSERT / UPDATE policies with WITH CHECK (true) β any signed-in user can write or modify anyone's data.TO clause at all, which means they apply to the anonymous role too β no account needed.
These weren't edge-case tables. They were orders, customer records, CRM data, loan records, user profiles.
Two were .env.example files containing values in real secret formats β auth secrets, webhook secrets, cron secrets, a database URL with the password in it. The filename says "example." The contents say otherwise. The third was a hardcoded secret-key default sitting in a config file β harmless only if production remembers to override it. Anything committed to a public repo should be treated as published, whether the filename sounds harmless or not.
I found zero cases of a service_role key shipped in frontend code in this sample. A year of warnings about that one seems to have landed. The failure mode has moved: the keys are fine now β the policies are the open door.
Watch what happens during an AI-assisted build. A query fails with a permission error. The fastest fix that makes the error go away is a permissive policy. The app works, the demo passes, the policy stays. Nobody in that loop ever asks the follow-up question: who else can read this table now? The code does exactly what it was optimized to do β stop erroring.
SELECT policyname, cmd, qual, with_check FROM pg_policies WHERE schemaname = 'public'; β any qual that is just true on a user-data table is a finding, not a convenience.SERVICE_ROLE, SECRET, and real-looking values in .env* files. If a real secret ever landed in a public commit, rotate it; deleting the file doesn't unpublish it.
AI builders are very good at making apps that work and noticeably worse at making apps that refuse. If your RLS policies say true, your database is a public document with extra steps.
Disclosure: I run CapsAGI β fixed-price security checkups for AI-built apps. The checks above are the first things we look for. I also maintain a free, open-source rules pack that teaches Cursor and Claude Code not to write these patterns in the first place: https://github.com/shisanyue950901-beep/vibe-security-rules