{"slug": "i-leaked-an-api-key-in-my-vibe-coded-app-here-is-the-order-to-fix-it", "title": "I leaked an API key in my vibe-coded app. Here is the order to fix it.", "summary": "A developer who leaked an API key in a vibe-coded app published a seven-step remediation order, starting with revoking the key at the provider rather than deleting it from code, then moving the call behind a server route with per-user limits, checking usage and billing, purging old builds and CDN caches, treating git history as public, and rescanning the live app. The writeup warns against testing a leaked key to see if it works and against rotating only after cleaning git history. It promotes ProofForge, a free scanner that detects recognizable key patterns in public bundles and offers fix prompts for builders like Lovable, Bolt, Replit, Cursor and v0.", "body_md": "Do these in order. The order matters.\n\n1. \n**Revoke the key at the provider first.** Deleting it from your code does not stop someone who already copied it. OpenAI, Anthropic, Stripe, Supabase, AWS and GitHub each have a revoke or rotate button.\n2. \n**Create a new key and keep it on the server.** Store it in a server-only environment variable. Never use`VITE_` ,`NEXT_PUBLIC_` or any prefix that ships to the browser.\n3. \n**Move the call behind your own route.** The browser calls your server, your server calls the provider. Add per-user limits so one user cannot burn your quota.\n4. \n**Check usage and billing.** Look for calls you do not recognize. Set a spending cap.\n5. \n**Remove the key from old builds.** Rebuild, redeploy, purge CDN caches. Old JavaScript files with the key may still be served. Source maps can also expose it.\n6. \n**If it was in git, treat git history as public.** Rotating is the real fix, since history rewriting cannot reach forks and clones.\n7. \n**Rescan the live app** to confirm the key no longer appears in what visitors download.\n\nCommon mistakes: rotating only after cleaning git, leaving the old key active \"for a day\", and testing the leaked key to see if it works. Do not do that last one.\n\nProofForge scans your public bundle for recognizable key patterns (shown masked, first 6 and last 4 characters), never uses a key it finds, and gives builder-specific fix prompts for Lovable, Bolt, Replit, Cursor and v0. Free scan: [https://proofforge.live](https://proofforge.live)", "url": "https://wpnews.pro/news/i-leaked-an-api-key-in-my-vibe-coded-app-here-is-the-order-to-fix-it", "canonical_source": "https://dev.to/proofforge_live/i-leaked-an-api-key-in-my-vibe-coded-app-here-is-the-order-to-fix-it-3m2a", "published_at": "2026-11-26 16:17:45+00:00", "updated_at": "2026-11-26 16:25:17.054488+00:00", "lang": "en", "topics": ["ai-safety", "ai-tools", "developer-tools"], "entities": ["ProofForge", "OpenAI", "Anthropic", "Stripe", "Supabase", "AWS", "GitHub", "Lovable"], "also_reported_by": [], "takeaway": "Revoke a leaked API key at the provider before anything else, since removing it from code does not stop anyone who already copied it, then move the call behind a server route with per-user limits and purge old builds and CDN caches.", "recommendation": {"advice": "Revoke leaked keys at the provider first, store replacements in server-only env vars, and proxy provider calls through your own rate-limited route.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/i-leaked-an-api-key-in-my-vibe-coded-app-here-is-the-order-to-fix-it", "markdown": "https://wpnews.pro/news/i-leaked-an-api-key-in-my-vibe-coded-app-here-is-the-order-to-fix-it.md", "text": "https://wpnews.pro/news/i-leaked-an-api-key-in-my-vibe-coded-app-here-is-the-order-to-fix-it.txt", "jsonld": "https://wpnews.pro/news/i-leaked-an-api-key-in-my-vibe-coded-app-here-is-the-order-to-fix-it.jsonld"}}