Service-role keys in client bundles
The most common critical finding in the applications I review, and a two-minute check you can run today.
The pattern
Almost every vibe-coded app I have reviewed ships with a Supabase or Firebase project, and almost every one of those came within one rename of a full-database breach. The service-role (or admin) key lands in a variable like NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY, a helper imports it, Next.js inlines the value into a public chunk, and every visitor now holds a key that ignores row-level security entirely.
Coding assistants copy this shape from tutorials and old docs without flagging it, because the app still works. It works right up until someone opens devtools.
The check
Build the app, then search the output for the key’s JWT prefix:
grep -r "eyJ" .next/static | head
One match in a server chunk is normal. A match in .next/static or any /assets path means the key is public. In Firebase the equivalent is any private_key block appearing in shipped JavaScript.
The fix
Three steps, in order: rotate the key in the provider dashboard first (finding it in the bundle means treating it as leaked), rename the variable without the public-inlining prefix, then mark the helper module import "server-only" so a future client import fails the build instead of silently re-leaking it. Re-run the bundle grep afterwards.
The full walkthrough, including how the leak happens and how to verify the rotation, is finding NPB-01 in the Northgate Physio review report.
About this note
Written by Joshua Thweny, OHMYVIBECODE LTD. A defensive field note: it describes a defect class and its fix, with no client-specific detail beyond the published report it links to.