I use coding agents (Claude Code, Cursor, OpenCode) a lot, and after a while you notice that the bugs they write are not the bugs a tired human writes. A human forgets to escape one input. An agent writes a perfectly structured endpoint that has no authentication at all, reports the task as done, and moves on.
This post walks through the four patterns I kept running into in Next.js + Supabase projects, and how I turned them into rules for an open-source scanner called vibe-shield. Full disclosure: I am the author of that tool. Treat the last two sections as the pitch and everything before them as the actual content.
1. The service_role key that ends up in the browser
The Supabase service_role key bypasses Row Level Security. Agents know this in the abstract, but when they need an admin client they tend to do one of two things. They create lib/supabaseAdmin.ts and then import it from a component that has "use client" at the top (or from something that component imports).…