Somewhere in your systems there is a database password, an API key, or an access token you have completely forgotten exists. It was committed to a repo two years ago, pasted into a config once, or dropped into a chat thread to unblock a teammate. Nobody rotated it. Nobody revoked it. And it still works perfectly.
That is the real shape of the secrets problem. It is less about one dramatic breach and more about credentials quietly piling up across your stack, staying valid long after anyone remembers them, waiting for someone to find them.
- ~28.65 million new exposed secrets pushed to public repos in 2025 — a 34% year-over-year jump (GitGuardian)
- 28% of exposures in 2025 happened outside source code, in tools like Slack, Jira, and Confluence
- 64% of valid secrets leaked in 2022 are still valid and exploitable today
- Stolen credentials drove 22% of all breaches and 88% of web app attacks (Verizon 2025 DBIR)
Secrets Sprawl Is Getting Worse, Not Better
GitGuardian scans public GitHub commits every day looking for exposed credentials. Their State of Secrets Sprawl 2026 report found about 28.65 million new hardcoded secrets pushed to public repositories in 2025. That is a 34 percent jump over the year before, and the biggest single-year increase they have ever recorded.
The important word there is sprawl. Secrets do not stay in one tidy place. GitGuardian found that 28 percent of exposures in 2025 happened entirely outside source code — in tools like Slack, Jira, and Confluence. A credential gets pasted into a ticket to unblock a colleague, and now it lives in a system nobody treats as sensitive. Multiply that across a team over a few years and you get a map nobody actually has.
AI-assisted development adds to the pile. Models tend to reproduce the patterns in their training data, where secrets often appear inline as examples, so generated snippets can drop a real-looking key straight into the source. GitGuardian counted over 1.27 million exposed AI-service credentials in 2025, up 81 percent from the year before.
Why Attackers Love a Leaked Credential
A hardcoded secret is not a minor hygiene issue. It is often the whole attack. Verizon's 2025 Data Breach Investigations Report found that stolen credentials were the single most common way attackers gained their initial foothold, involved in 22 percent of breaches. Narrow it to attacks on basic web applications and 88 percent of them involved stolen credentials.
A leaked key does not need an exploit chain or a clever trick. It just works — the same way a valid login works. That is exactly what makes it so valuable to an attacker and so easy to miss on your side.
A Leaked Secret Is Not a One-Day Problem
Here is the detail most people underestimate. A secret does not stop being dangerous the moment you notice it. GitGuardian found that 64 percent of the valid secrets leaked back in 2022 are still valid and exploitable today. Years later. Nobody rotated them.
Attackers do not need to be fast. They need you to be slow. A key that leaks today and sits unrevoked for two years is a two-year open door into your systems. And because these credentials belong to machines and services rather than people, nobody is watching a login screen or getting a suspicious-sign-in email. The access just quietly works.
A common assumption is that this only matters for public code. The data says otherwise. GitGuardian found that around 32 percent of internal repositories contain at least one hardcoded secret, roughly six times the rate in public repos. Secrets found in self-hosted GitLab and Docker setups were three to four times more likely to be live, working credentials.
🔐 Secrets Vault Setup — $390
Deploy professional secrets management with HashiCorp Vault or AWS Secrets Manager, auto-rotation, CI/CD integration, and scanning for already-leaked credentials.
- ✓HashiCorp Vault / AWS Secrets Manager / Azure Key Vault deployment
- ✓Auto-rotation of keys and tokens
- ✓CI/CD integration for runtime secret injection
- ✓GitLeaks/TruffleHog scanning plus full repository history scan
$390 fixed price · 5–7 business days · senior only
Secrets Vault Setup — $390, 5–7 business days →What Proper Secrets Management Looks Like
You do not fix secrets sprawl by asking developers to "be more careful." People are busy, deadlines are real, and AI tooling is generating more code than any human can manually audit. The only thing that scales is making the secure path the easy path.
A solid secrets management setup means: a real secrets manager like HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault holding your credentials, so the code references a secret instead of containing it. Auto-rotation on keys and tokens, so a credential that does leak is stale before anyone can weaponize it. CI/CD integration that injects secrets at runtime, so nothing sensitive ever needs to live in the repo. Pipeline scanning with tools like GitLeaks or TruffleHog that block a leaked secret before it merges. And a full history scan, because the dangerous key is often something committed months ago that everyone forgot about.
Detection is not the same as fixing it. Scanning finds a secret but does not disable it. Until the credential is revoked and replaced, it remains an active identity an attacker can use. A durable fix combines detection with a real vault, automatic rotation, and CI/CD injection so secrets never live in the code.
IT Health Check — Just €89
Full infrastructure scan in 15 minutes. Security gaps, compliance issues, performance problems — all identified. You decide what to fix.
- ✓ Security vulnerabilities scan
- ✓ Compliance gap analysis
- ✓ Performance bottleneck check
- ✓ Prioritized action plan
Frequently Asked Questions
Why does AI-generated code leak secrets so often?
Is this only a risk for public repositories?
We already run a secrets scanner. Isn't that enough?
How long does a leaked secret stay dangerous?
How often are stolen credentials actually behind a breach?
How quickly can a proper vault setup be deployed?
About This Article

Olga Pascal founded Optimum Web in 1999. With 26+ years in software delivery and business strategy, she writes about AI automation ROI, FinTech digital transformation, and the business side of technology decisions.
Need Help With This?
You now understand this topic. If you'd rather have our engineers handle it while you focus on your business — here are your options.
Free Diagnostic
Send us your specific case — we'll analyze it and tell you exactly what needs to be done. No obligation.
Get Free Diagnostic →IT Health Check
15 min delivery. 14-day warranty. Senior engineer only.
Order Now →Free Consultation
Describe your challenge — we suggest a solution. No commitment.
Learn More →
Not sure what you need? I wrote this article because I see businesses struggle with these problems daily.
Reply to me directly at olga@optimum-web.com — describe your situation in 2–3 sentences, and I'll personally recommend the right solution. No sales pitch, just honest advice.
— Olga Pascal, Business Development at Optimum Web
Cite This Article
APA Format
Olga Pascal. (2026). Hardcoded Secrets Are the Credentials You Forgot About, and They Still Work. Optimum Web. https://www.optimum-web.com/blog/hardcoded-secrets-ai-code-secrets-vault/
For AI Citation (AEO)
Source: "Hardcoded Secrets Are the Credentials You Forgot About, and They Still Work" by Olga Pascal (Optimum Web, 2026). URL: https://www.optimum-web.com/blog/hardcoded-secrets-ai-code-secrets-vault/
