Vibe-coded app leaks API keys in client bundle
A non-programmer's AI-built booking app exposed Stripe, OpenAI, and Resend secrets in browser-loaded JavaScript. Automated bots probed for .env within weeks.
According to the channel author, a widely saved Reddit post details how a non-programmer's vibe-coded application leaked three production API keys directly into client-side JavaScript. The author built a studio booking tool using Cursor and Claude with Supabase, Stripe, OpenAI, and Resend, believing that adding .env to .gitignore was sufficient protection.
Vite's VITE_ prefix pushed secrets to every browser
During development, Claude suggested calling APIs directly from the browser and prefixed every environment variable with VITE_. Vite's build process automatically includes any VITE_ variable in the client bundle, so the OpenAI key, a live Stripe secret key (sk_live_), and the Resend key were shipped to every visitor. The Stripe public key was never used correctly.
Automated scans targeted the hidden .env file
Server logs revealed that within two weeks of the obscure site going live, automated scripts attempted to fetch /.env 212 times. The .env file itself was not served — only the build directory was — but the exposure in JavaScript had already occurred. No spending limit existed on the OpenAI key.
Remediation: rotate keys, enforce hard limits, move calls server-side
The author rotated all three keys that evening, set a $20 hard limit on OpenAI that blocks requests rather than merely emailing alerts, and migrated every API call into Supabase Edge Functions so secrets never reach the browser.
Two five-minute checks before any public launch
First, after building, search the output directory for the strings sk-, sk_live_, and key. Second, in every provider dashboard enable a hard spending cap that automatically rejects requests once the threshold is hit. These steps would have caught the leak before any bot could exploit it.
Sources
reddit.com — content not available without authorization
Related news
AI ToolsApp Store Compliance: Open-Source Guard Catches 125+ Rejection Patterns Before SubmissionFree tool scans iOS and Android projects locally, integrates with Claude Code, Codex, Cursor and other AI agents, and tracks EU AI Act, COPPA and age-gating deadlines.·by shared tag
AI ToolsGoogle Releases Official Migrate-to-Rust Skill for AI AgentsGoogle adds a dedicated Rust migration skill to its Agent Skills repository, giving coding agents a structured path for modernizing legacy codebases.·by shared tag
AI ToolsGoogle's EGM Plugin Splits AI Coding Into Architect and Coder RolesElephant-Goldfish Model separates long-term planning from stateless code generation to prevent context pollution in extended AI-assisted development sessions.·by shared tag
- Claude CodeJunior developer leaks production database password to Claude Code, sparking security debateA Reddit thread reveals how a schema migration error led to credentials exposure, and why enterprise subscriptions don't eliminate local storage risks.·by shared tag
Comments
Weekly digest
The best of vibe coding, AI agents and open source — once a week, no spam.