OpenAI key in the shipped JavaScript
An OpenAI key sits in plain text in your frontend bundle. Any visitor can read it, and automated bots comb public bundles looking for exactly this. The key counts as compromised the moment it was shipped — even if you replace the bundle now.
- Where we found it:
- /assets/index-Bq7fK2mP.js, Zeile 1842
- Auszug:
- const openai=new OpenAI({apiKey:"sk-proj-4f8a2…",dangerouslyAllowBrowser:true})
How to fix it
Revoke the key immediately at platform.openai.com/api-keys — not later; the old one is irreversibly public. Then: the call belongs on the server, not in the browser. Add your own route (an edge function or /api/chat) that holds the key server-side and forwards the request. The frontend then only calls your route. `dangerouslyAllowBrowser: true` is the SDK telling you this path was never intended.