AIToday
AI Coding AssistantsAI Safety & AlignmentZenn AI/MLPublished: Nov 24, 2026, 22:01 JST

Claude Code and Codex Find All Leaked Keys in 12 Runs

Send on LINE
Claude Code and Codex Find All Leaked Keys in 12 Runs

3 Key Points

  1. What happened

    BPR Prot. hid keys in 7 spots in a Next.js practice app and asked Claude Code and Codex to find browser-exposed secrets; both flagged leaked keys K2, K4 and K5 in all 12 runs.

  2. Why it matters

    Both AI tools caught the leaked keys every time, suggesting AI pre-launch checks can reliably surface exposed secrets—though this was one small practice app, so results may not generalize.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

By signing up you agree to the Terms of Service and Privacy Policy.

Context & Analysis

The experiment was designed around a common blind spot: developers often assume that scanning environment variables is enough. BPR Prot. deliberately placed K4 and K5 outside the .env file—one hardcoded in a client-side admin page, the other in a public config file—to test whether AI tools would look beyond the obvious. Both Claude Code and Codex did, flagging all three leaked keys across every run. The tools also correctly classified keys that were not leaked but still risky, such as a SendGrid key that cannot reach the browser but is written in a way that would expose it if prefixed with NEXT_PUBLIC_. Claude Code consistently warned that renaming the key to fix the issue would itself cause a leak, while Codex mentioned that risk only once. However, the AIs relied solely on reading source code: they did not run npm install or a build, and they could not check git history. So while the results are encouraging for pre-launch checks, they do not prove that keys were never exposed in the past. The author recommends rotating any found keys and reading the AI's stated reasoning before trusting a clean bill of health.

FAQ
What keys were leaked in the test app?
The leaked keys were K2 (an OpenAI key called from the browser), K4 (an admin password hardcoded in a client-side file), and K5 (a Mapbox secret token in public/config.json).
Did the AI tools catch keys outside the .env file?
Yes, both Claude Code and Codex flagged K4 and K5, which were placed outside the .env file, in all 12 runs.
What did the AIs not check?
Neither AI built or installed the app, so they did not inspect the compiled JavaScript, nor did they check git history to see if keys were previously exposed.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

By signing up you agree to the Terms of Service and Privacy Policy.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleDeepMind's Genewein: AGI likely leads to ASI, four paths