OpenAI & Anthropic API keys in client code: the new #1 leak
Adding an AI feature is a five-minute job, and that is exactly the problem: the quickest path drops your OpenAI or Anthropic key into code the browser downloads.
Tag
Adding an AI feature is a five-minute job, and that is exactly the problem: the quickest path drops your OpenAI or Anthropic key into code the browser downloads.
An AI assistant does what you ask, including the parts you did not think to forbid. That is how a .env full of keys ends up committed or served.
Stripe gives you several kinds of key, and only one is meant for the browser. Mixing them up is the common mistake — here is which goes where.
In .NET apps, configuration lives in JSON files that can hold connection strings and keys. When one ends up in a public path, it is a plain URL away.
An AWS access key has a recognizable shape, which makes it easy for bots to spot. Here is where they leak from and what typically happens right after.
The .env file holds your database URLs, API keys and tokens. It belongs on the server — but when it ships to a public folder, anyone can just download it.
API keys do not usually leak through clever hacks. They leak because a key meant for the server ends up in code the browser downloads. Here is the pattern, and the fix.
We built a small app the vibe-coding way, deployed it, then scanned it. Here is the honest list of what came back, and what each finding actually meant.
AI writes the code that solves your prompt — not the code that keeps secrets. Here are the 7 things vibe-coded apps leak first, and how to catch them before bots do.