How to hide API keys when an AI builder writes your app
Patterns that keep OpenAI, Stripe, and other secrets out of the browser when you vibe-code.
Check your live site
Worried a secret key ended up in your live app? Paste your URL and we'll check your live JavaScript for known secret key patterns, like OpenAI and Stripe keys, in about 10 seconds.
Uses 1 of your 3 free scans today; a site scanned in the last 24 hours answers from that scan. Passive and read-only: we only look at what any browser can see. Only check sites you own or may test.
What the free scan checks
- Leaked keys in your live JavaScript (AI, payment and cloud keys), including a Supabase
service_rolekey - Files that should never be public, like
/.envand/.git - Supabase and Firebase secrets in the browser: an
sb_secret_key, a Supabase access token or a Firebase service-account file - HTTPS and security headers (CSP, HSTS, clickjacking protection)
It only reads what any visitor's browser can see. It doesn't log in, read your tables or check App Check.
AI builders optimize for "it works in the preview." That often means calling OpenAI or Stripe straight from the browser with a secret key. Veracode found 45% of AI-generated code samples contained security flaws across their tested tasks (Veracode).
Rules of thumb
- Browser: only publishable keys (
pk_, Supabaseanon, Firebase config). - Server / Edge Function:
sk_,service_role, AWS keys, webhook secrets. - Add a standing project rule so the AI does not "helpfully" undo this later.
Never put secret API keys in frontend code. Create a server-side (or Supabase Edge) function for each paid API: OpenAI, Stripe, email. The browser calls my function only. Add a project rule: 'No secret keys in client code.'
Related: Calling OpenAI from your frontend · ElevenLabs key in the frontend · Committed a key to GitHub · Cursor checklist · Security headers
Scan your app free
Paste your URL. ShipLatch checks for leaked keys, exposed /.env and /.git, and flags Supabase/Firebase so you know what to lock down. The free scan finds the issues; the $29 Fix Pack gives you fix prompts written for your app and re-scans that prove each fix worked.
Want the whole pre-launch process in one place? See what's inside App Security for Vibe Coders, our $9 PDF playbook, or go straight to checkout.