Every engineering team has a version of this story. Someone pushes a commit with an access key in it. Someone else notices, the commit gets rewritten, everyone breathes out. Problem solved.
It usually isn't. Removing a secret from your code doesn't remove it from the world. Once it's been seen, the only fix is to make it stop working, and the data says that step is the one most teams skip.
Two clocks that don't match
There are two timelines that matter after a secret leaks.
The attacker's clock is measured in minutes. Researchers who have deliberately leaked AWS keys on public GitHub keep seeing the same result. In one honeypot experiment by Comparitech, abuse began within a minute of the key being published. Bots watch public code for credentials constantly. They don't need to be clever, just fast.
The defender's clock is measured in years. GitGuardian's State of Secrets Sprawl 2026 report found that 64% of valid secrets it detected back in 2022 were still active in January 2026. The same report counted more than 28 million new secrets in public GitHub commits in 2025 alone, and found secrets in internal repositories far more often than in public ones.
Put those side by side and the problem is obvious. Detection is mostly solved: secrets get found, by someone. What's missing is the step after: revoke, rotate, confirm nothing used it.
Why rotation doesn't happen
Nobody decides to leave a leaked key active. It happens because rotation is harder than it looks.
- Nobody knows what uses the key. Rotating a credential that five services depend on means breaking five services. So it waits for a "proper" migration that never gets scheduled.
- Deleting the commit feels like fixing it. The secret disappears from view, and the urgency goes with it. But forks, clones, caches and logs keep a copy.
- The key belongs to nobody. It was created by someone who left, for a service nobody owns. There's no one to ask whether it's safe to turn off.
- There's no proof either way. Without checking what the key did since it leaked, nobody can say whether it was used, so nobody wants to be the one to raise the alarm.
The new leak doesn't need a commit
The classic story is a developer pasting a key into code. In 2025, two incidents showed that secrets can escape without anyone committing anything.
tj-actions/changed-files, March 2025. A widely used GitHub Action was compromised so that it printed secrets from CI runs into build logs. According to CISA's alert, that exposed access keys, GitHub tokens, npm tokens and private keys for repositories that used it during a window of a few days. CISA's advice was blunt: treat those secrets as compromised and rotate them.
Shai-Hulud, September 2025. A self-replicating worm spread through more than 500 npm packages. As CISA described it, it harvested GitHub tokens and AWS, GCP and Azure keys from developer machines, published them publicly, and used the stolen access to push itself into more packages. Again the advice: rotate every developer credential.
In both cases, the secrets weren't sitting in a file waiting to be found. They were read straight out of the place where they're used: build pipelines and developer machines. If your plan for secrets is "don't commit them", these attacks walk right past it.
What actually closes the gap
- Prefer credentials that expire on their own. Use IAM roles and federation (OIDC from your CI provider, for example) instead of long-lived access keys. A credential that lives for an hour can't leak for four years.
- Make rotation a button, not a project. For every long-lived secret, know who owns it, what uses it and how to replace it. If that takes a week to find out, find out now, not during an incident.
- When a secret leaks, revoke first, investigate second. Assume it was used. Turn it off, then read the logs to see what it did.
- Give CI the least it needs. A pipeline that only builds shouldn't hold deploy credentials. Pin third-party actions and packages to versions you've reviewed, so a compromised update doesn't run with your secrets.
- Check what a leaked key can reach. A leaked key is only as dangerous as the identity behind it. A narrowly scoped role turns a breach into a nuisance.
Leaks are the start of a path, not the end
A stolen credential is rarely the goal. It's the first step: log in as something legitimate, then see what that identity can reach. That's why we think secrets and permissions have to be tested together.
At Antivenom, an AI red team, working only against your own systems and with your permission, looks for credentials that are exposed or still active when they shouldn't be, and follows each one to show what it actually unlocks. The AI blue team revokes and narrows what it finds, and the red team retests.
For what an over-permissive identity can turn into, read your AWS perimeter is a graph of who can become whom.