← All posts

Original research

We scanned nearly 2,000 AI-built apps. The same secret kept leaking.

Over four separate studies we scanned 1,968 real applications for security flaws: apps generated by no-code builders, repos posted to Hacker News, and web apps written with Claude Code. The groups have almost nothing in common, different tools, different skill levels, different kinds of software. They share one thing. In every single corpus, the flaw at the top of the list was a hardcoded secret committed straight into the repository.

By Prbl Security Team

We have published these studies one at a time: the Lovable and Bolt scan, the Hacker News scan, and the Claude Code scan. Each one has its own headline. But when you line all four up next to each other, a pattern appears that is more useful than any single number, because it holds no matter who built the app or what they built it with.

The one flaw that showed up everywhere

A hardcoded secret is a credential written directly into source code as a plain string, an API key, a database URL and key, a session-signing secret, a password, instead of being read from an environment variable at runtime. When the code gets pushed to a repository, the secret goes with it. Anyone who can read the repo can read the secret, and it stays in the git history even after someone deletes the line.

Here is how often it turned up, by corpus:

Where the apps came fromAppsHardcoded secret
Apps from Lovable & Bolt62820.4% (1 in 5)
Web apps built with Claude Code3649.3% (roughly 1 in 11)
Repos shipped to Hacker News976top 3 (one of the most common high findings)

In the app-builder corpus it was the single most common high-severity finding, in 1 of every 5 apps. In the Claude Code corpus it was again the most common, in roughly 1 of every 11. In the Hacker News corpus it ranked among the top three high-severity patterns. Three completely different populations of developers, and the same class of mistake sat at or near the top of each one.

Scan your own app for issues like these

Paste your live URL. We check what your app serves publicly for exposed keys and misconfigurations. No account, no install.

Why it doesn't matter who built the app

This is the part worth understanding, because it explains why the pattern is so stable. A hardcoded secret is not a knowledge gap and it is not a tooling failure. Every developer who has ever done it knew, abstractly, that it was wrong. It happens anyway because it is the path of least resistance in a specific moment: you are trying to get something working, the key is right there in your clipboard, pasting it inline works instantly, and moving it to an environment variable is a small chore you will do later. Later frequently does not come before the first git push.

A no-code builder does not protect you from this, because the builder often generates the hardcoded key for you as part of its default scaffold. A more capable AI model does not protect you from this either, which we measured directly: the secret-leak rate held flat across three generations of Claude models, because the model was never the thing deciding to paste the key in. It is a human reflex, and it shows up wherever humans ship software quickly, which is now everywhere.

Why it is worse than it sounds

“A leaked key” can sound abstract until you follow what it actually opens. In these studies the hardcoded secrets included database URLs paired with their access keys, session-signing secrets, cloud service keys, and admin passwords. Depending on the key, a reader of the repo could query or modify the app's entire database, forge a login session for any user including an administrator, or run up charges on a paid service in the owner's name. And because a public repository is continuously scraped by automated bots hunting for exactly these strings, exposure is not hypothetical or slow. Committed keys get found.

The fix is the same everywhere too

The uniformity of the problem is good news, because it means one habit closes most of it. Before a repository goes public:

  • Search your own code for the obvious markers: supabase.co, apiKey, SECRET, password, and any long random-looking string. Most hardcoded secrets are found in under a minute this way.
  • Move every secret into an environment variable, and confirm your .env file is listed in .gitignore before the first push, not after.
  • If a secret was ever committed, rotate it at the provider. Removing the line does not remove it from git history, so assume anything that was pushed is already compromised and issue a new one.
  • For anything a framework signs with (session secrets, tokens), generate a long random value and make the app refuse to start if the environment variable is missing, rather than falling back to a default.
Full dataset now public. The anonymised data behind this and our other studies, 4,740 live apps and 2,148 repos, is on GitHub under CC BY 4.0, with charts and the build script. See the research page or get the CSVs.

Methodology and limits

The figures combine four scans run with Prbl: 976 repos linked from Hacker News, 628 apps generated by Lovable and Bolt, and 364 web apps written with Claude Code (across three model generations). Every high-severity finding was manually reviewed, and false-positive patterns the reviews surfaced were fixed in the scanner before the numbers were computed. The corpora were sourced and scoped differently, so the per-group rates are not perfectly comparable to one another, that is not the claim. The claim is narrower and more robust: in each group, independently, hardcoded secrets landed at or near the top of the high-severity findings. No specific repository, owner, or file is identified anywhere in this post.

Every few months a new tool promises to change how software gets built. Some of them genuinely do. None of them have changed the fact that the fastest way to ship a working app is to paste the key inline and mean to fix it later. Until that reflex changes, the single highest-value thing you can do before going public is the most boring: go find the secret you left in the code.

Common questions

Why do AI coding tools hardcode secrets so often?

AI tools optimize for code that runs. Hardcoding a key inline is the fastest way to wire up an integration — the feature works immediately without requiring an env var setup. The model has seen this shortcut in thousands of training examples (tutorials, starter repos, Stack Overflow answers) and reproduces it because it works. The security implication only matters later, and the model has no later.

How common are hardcoded secrets in AI-built apps?

In our scan of 976 AI-built apps from GitHub, hardcoded secrets were the single most common high-severity finding. Across four separate studies totaling 1,968 apps — built with Lovable, Bolt, Claude Code, and general AI assistants — hardcoded credentials ranked #1 or #2 in every group. The rate is higher than in hand-written code because AI tools inline credentials as a development convenience and no one removes them before shipping.

What kinds of secrets do AI tools hardcode most often?

In our data: Stripe API keys (sk_live_ and sk_test_), Supabase anon and service_role keys, OpenAI API keys, database connection strings (postgres:// and mongodb+srv://), JWT signing secrets, and third-party service credentials (SendGrid, Twilio, Resend). Config files and migration scripts are the most common locations.

Is it enough to delete the file or rotate to a private repo?

No. Deleting the file does not remove it from git history. Making a repo private after the key was public does not invalidate the key — bots scrape GitHub continuously and keep what they find. The only remediation that actually protects you is rotating the credential at the provider. Everything else is cleanup that helps but does not fix the underlying exposure.

Ready to check your own app?

Paste your live URL. We check what your app serves publicly for exposed keys and misconfigurations. No account, no install.

Or see a live example scan first.

Prbl in one place: SAST for AI code · secret scanner · website vulnerability scanner · AI code review · GitHub security scanner · OWASP Top 10 · open dataset

We Scanned Nearly 2,000 AI-Built Apps. The Same Secret Kept Leaking | Prbl