Academy
What 2026's leak data says about API keys
Every year a few security firms count how many secrets leak onto public code sites. Most coverage repeats the headline number. We went through GitGuardian's State of Secrets Sprawl 2026, published in March, and did some simple arithmetic on its figures. The result is more mixed than the headlines: leaks per commit fell slightly, secrets for AI services grew far faster than the rest, and most old leaked keys were still alive a year on. This post sets out the numbers, our sums, the limits of the data, and what a small team should do about each finding.
Published · 6 min read
Key takeaways
- About 28.65 million new hardcoded secrets reached public GitHub in 2025, up 34%, while public commits grew 43%.
- AI-service secrets rose 81% to 1,275,105, so they are a growing share of what leaks.
- More than 64% of credentials confirmed valid in 2022 were still valid in January 2026.
- The data covers public GitHub only, so private leaks and chat leaks are invisible in it.
The source and its limits
GitGuardian publishes an annual report on secrets found in public GitHub commits. The 2026 edition came out on 17 March 2026 and covers 2025 (GitGuardian). It is a vendor report, and it measures what its scanners detect on public code. That leaves out private repositories, chat logs, tickets and wikis, where plenty of keys also live. Read every figure below as "what was found in public", not "what exists".
All the figures in the first table come from the report. We have not repeated its method, and we rounded where the report did.
The headline figures
| Measure (2025, public GitHub) | Figure | Change on 2024 |
|---|---|---|
| New hardcoded secrets | About 28.65 million | Up 34% |
| Public commits | About 1.94 billion | Up 43% |
| Active developers | Not stated as a total | Up 33% |
| AI-service secrets detected | 1,275,105 | Up 81% |
| Commits assisted by Claude Code: share leaking a secret | 3.2% | Baseline across public commits: 1.5% |
| Unique secrets in public MCP config files | 24,008 | Not compared |
| Of those, confirmed valid | 2,117 | Not compared |
Our sums
Here is what the numbers look like if you do some arithmetic. This is our own working from rounded figures, so treat it as indicative.
Leaks per commit went down a little. Secrets grew 34% and commits grew 43%. Working back from the 2025 totals, that is roughly 15.8 secrets per thousand commits in 2024 and about 14.8 in 2025. Developers are not getting worse on average. There is simply more code, and a leak is a small number out of a big one.
AI keys are taking a bigger slice. Dividing 1,275,105 by 1.81 suggests about 705,000 AI-service secrets the year before. As a share of all detected secrets, that is roughly 3.3% in 2024 and 4.4% in 2025. The report also says eight of the ten fastest-growing secret types were tied to AI services, and that keys for infrastructure around language models leaked five times faster than keys for the core model providers.
Old keys do not die. Of credentials confirmed valid in 2022, nearly 70% were still valid in January 2025, and the figure was still above 64% in a January 2026 retest. Put another way, the typical response to a leak is not rotation. Time alone fixes almost nothing.
What each finding means for a small team
Leaks per commit are flat, so habits matter more than tools
If a lower rate came from better tooling, it would be steadily falling. A slow drift suggests that scanning and push protection help at the edges, but most leaks are still made by tired people moving quickly. Build the checks into the flow, so a leak is blocked at the moment it is made.
AI keys are valuable and easy to lose
A key for an AI service often has a direct price attached: someone else's usage lands on your bill. That makes them attractive to thieves. Keep them out of prompts, config files and chat, and see our post on AI agent API key security for ways to let software use a key without holding it.
MCP config files are a fresh hiding place
24,008 unique secrets in public MCP configuration files is a new kind of leak. The 2,117 confirmed valid ones are a reminder that a setup file for a tool is still a file that can be committed. Keep those files out of version control, and prefer references to secrets over the secrets themselves. If you are wondering how to store API keys securely, the short answer is outside the repository and out of config files.
Rotation is the gap
The 64% figure is the most useful one in the report for a small team. It says that the fix for a leaked key is almost never applied. OWASP's cheat sheet recommends short-lived secrets, expiry dates and automated rotation where you can manage it (OWASP). If you do only one thing from this post, set a diary reminder to rotate your most powerful key.
A worked example: auditing thirty keys
This is an illustrative scenario. A five-person software shop has about thirty API keys across its services, some of them two or three years old. Nobody knows which are still in use.
The owner takes an afternoon. She lists every key and who made it, using each provider's key page. She marks the ones nobody can explain and revokes those first, since an unused key has no value and a real risk. She sets the rest to rotate once a year, and the three most powerful ones every quarter. She gives each developer their own key instead of the shared one, and scans the repositories using the host's built-in tool.
If the shop behaves like the average in the report, a number of those old keys would still have been alive and exposed somewhere. After the afternoon, any old key that leaked would now be dead.
A short routine for the quarter
- List your keys and who owns each one.
- Revoke anything nobody can explain.
- Rotate API keys on a schedule, starting with the strongest.
- Narrow permissions on anything broader than it needs to be.
- Scan repositories and, with your host's tools, their history.
- Stop sharing in chat. Our post on sharing an API key with your team gives seven better routes.
What the data cannot tell us
The report cannot say how many keys leak in private places. It cannot say why a rate changed. And a vendor's scanner finds the secrets it knows how to recognise. For the human side of how a key gets out, our look at attackers using agents to hunt leaked keys shows why speed now matters, and the security page explains how SecretPigeon handles keys that pass through it.
Questions people ask
How many API keys leak on GitHub each year?
GitGuardian counted about 28.65 million new hardcoded secrets in public GitHub commits in 2025, up 34% on 2024. That covers secrets of every kind, and only the ones its scanners detect.
Do leaked API keys stay valid?
Often, yes. GitGuardian found that more than 64% of credentials confirmed valid in 2022 were still valid when it retested in January 2026. Keys do not expire unless someone rotates or revokes them.
Are AI coding tools making secret leaks worse?
GitGuardian measured a 3.2% leak rate in Claude Code-assisted commits against a 1.5% baseline across public commits. That is one vendor's measure and it does not explain the cause, but it suggests extra care is warranted.
How often should I rotate API keys?
On a schedule you will really keep, and straight away after a suspected leak. Quarterly for your most powerful keys and yearly for the rest is a reasonable starting point for a small team.