Deleting a leaked secret from a file, a commit, a log or a vault entry changes where the secret is stored, but it does nothing to the credential itself: until the issuing system revokes it, anyone who copied it can still use it. This guide explains why "we removed it" is the most common false closure in secrets incidents, what real remediation looks like, and how to prove that an exposed credential is dead rather than merely hidden.
The pattern is not theoretical. In October 2026 Zeabur reported that long-lived cluster admin tokens and AWS keys, held in plaintext in a configuration repository, were missed by the rotation it carried out after its August breach, and were then used to read secrets across its shared cluster. In the same month, LiteLLM's incident showed how credentials that leak into logs, and signatures made with a replaced key, keep working after the obvious clean-up. Both cases are covered in our breach pages and summarised below. For the mechanics of rewriting Git history, see How to Remove Secrets From Git History; this page is about the step that must come before it.
Key takeaways
- A secret is a bearer credential held by the issuer, not by your repository. Removing every copy you can see does not invalidate the copies you cannot see.
- Revoke or rotate first, at the issuing system, then clean up. GitHub's own guidance says that once a secret is revoked or rotated "it can no longer be used for access", which may make history rewriting unnecessary.
- Rotation that only covers the secrets you know about is incomplete. Zeabur's August rotation missed admin tokens stored in plaintext in a configuration repository, and those tokens were used in October.
- Non-expiring credentials turn a historical leak into a permanent exposure. Expiry is the safety net for every revocation you forget.
- Close an incident only on evidence: the old credential fails authentication, usage logs show no activity after revocation, and every dependent system runs on the replacement.
Why deletion feels like remediation
When a developer sees an API key in a pull request, the natural reflex is to delete the line, force-push and move on. The diff looks clean, the scanner alert closes and the ticket is resolved. Every signal the team watches says the problem has gone. None of those signals measures whether the credential still works.
A secret has two lives. One is its storage life: the files, commits, environment variables, logs, chat messages, backups and caches where its value sits. The other is its authority life: the period during which the issuing system, such as a cloud provider, an identity provider or a SaaS platform, accepts it. Deletion acts only on the storage life, and only on the copies you control. Revocation acts on the authority life, and it acts on every copy at once, including those already taken by an attacker.
This is why the OWASP Secrets Management Cheat Sheet lists revocation as the first containment step when a secret is exposed: "Keys that were exposed should undergo immediate revocation." Deletion comes after, and the cheat sheet frames it as cleaning up secrets that have already been "revoked/rotated". It also notes that restarting an application "does not itself revoke stolen credentials", another clean-up action that is often mistaken for a fix.
Where deleted secrets keep living
Even if you trusted deletion as a control, it rarely reaches every copy. On GitHub alone, the documentation on removing sensitive data from a repository is explicit about the limits:
- Forks. If the commit exists in a fork, "it will continue to be accessible there", and GitHub cannot give you contact details for fork owners.
- Clones. "You cannot remove sensitive data from other users' clones of your repository." Every developer laptop and CI cache that fetched the commit still has it.
- Cached views and pull request refs. Rewritten commits remain reachable by their hashes in cached views, and force-pushing does not update the read-only
refs/pull/references. Clearing these needs GitHub Support.
Outside the repository, copies spread further: build logs, container image layers, observability platforms, ticketing systems where someone pasted an error, laptop shell history and backups. Zeabur's October report notes that its backups contained all secrets, and that a replacement backup key was itself captured by a later backup and used the same day. LiteLLM's incident post reports that GitHub CLI OAuth tokens "may appear in LiteLLM logs", the route by which it believes three engineers' tokens were taken. A credential that has been written to a log has been copied to every system that ingests that log.
Attackers also collect leaked secrets at the moment of exposure. Automated scanners watch public commits and package registries continuously, so the window between a push and a harvest can be very short. By the time a human deletes the line, the value may already be in an attacker's store, and from there no deletion on your side can reach it.
Case study: rotation that missed the tokens
Zeabur's two incidents in 2026 are the clearest recent example of a gap between "we rotated" and "every exposed credential is dead". After its August breach, Zeabur stated that internal admin keys had been disabled or rotated. Its October report, published on 19 October 2026, says that statement was "incomplete": the "August rotation did not cover the cluster admin tokens and AWS keys stored in plaintext in the configuration repository", and only the GitHub App private key had been replaced on 31 August.
The details show how each weakness compounded the last:
- The shared cluster admin tokens were created on 10 January 2024 with no expiry. One was written in plaintext to the configuration repository on 20 January 2026.
- The admin interface was reachable from the public internet, so a valid token was enough.
- At 01:36 on 14 October an attacker used a Zeabur AWS key, and at 01:40 accessed the shared cluster with an admin token.
- Zeabur says that more than 16 hours of attack activity on 14 October triggered no alerts.
Zeabur's own conclusion was that the root cause lay in "long-lived admin credentials" that "were stored in plaintext and could be used from the public internet". The lesson for responders is that a rotation is only as complete as the inventory it starts from. The full account is in our Zeabur second breach page.
Case study: replaced keys and logged tokens
LiteLLM's October 2026 supply chain incident adds two further lessons. First, credentials that pass through logs must be treated as exposed even when nobody pasted them anywhere. LiteLLM reports that Claude Code can embed a user's GitHub CLI OAuth token in a response body, and that these tokens may then appear in LiteLLM logs. Deleting the log file later would not have helped; the tokens had to be revoked.
Second, replacing a signing key does not withdraw trust in what the old key signed. LiteLLM believes the private half of its previous cosign key was exposed and replaced it on 23 October, but its post notes that the compromised v1.107.0 images still carry a valid signature from the previous key. Consumers who trust that key will keep accepting those images until they stop trusting it. From v1.111.0-dev.3 on 15 November 2026, LiteLLM moved to keyless cosign signing, so no stored signing key remains to leak. Our LiteLLM supply chain attack page covers the sequence in full.
The same attacker also used a third developer account to delete production and staging workflow records, which LiteLLM says "limited the workflow logs available for investigation". Deletion cuts both ways: it does not remove an attacker's access, but it can remove your evidence.
Revoke, rotate, then clean up
The order of operations matters more than any single tool. The difference between revocation and rotation is covered in Secret Rotation vs Revocation; in a leak, you usually need both.
- Identify the issuer. Work out which system minted the credential and which identity it represents. A string in a file is not actionable until you know where it is accepted.
- Revoke at the issuer. Disable or delete the key, token or certificate in the issuing system. If revocation would break production, issue the replacement first, deploy it, then revoke within minutes, not days.
- Rotate dependants. Update every workload that used the credential. Where several services shared one secret, each gets its own replacement so the next incident has a smaller blast radius.
- Revoke derived access. Sessions, refresh tokens, sub-keys and anything the credential could create, including new credentials an attacker may have minted while they had access, need separate revocation.
- Withdraw trust in signatures. For signing keys, publish the revocation, remove the old public key from verification policies and decide how to handle artefacts it signed.
- Clean up copies. Only now rewrite history, purge logs and scrub tickets. This reduces future confusion and false positives, but it is hygiene, not containment.
For step-by-step handling of API keys specifically, see the API Key Leak Response Playbook.
Finding the secrets your rotation will miss
Zeabur's gap was not a failure to rotate; it was a failure to know what to rotate. Before declaring a rotation complete, build the list from several directions rather than from memory:
- From the issuers. List every active key, token and service account in each cloud account, identity provider and SaaS platform, with creation date and last use. Anything active that is not on your rotation list is a finding.
- From the stores. Scan configuration repositories, infrastructure code, CI variables, container images, backups and server initialisation scripts for embedded values, not just the main application repositories.
- From the blast radius. Ask what else an attacker could have read with the access they had. If they reached a secrets store, every secret in it is in scope, not just the one that leaked.
- From time. Treat any credential older than the start of the compromise window, and without expiry, as presumed exposed until rotated.
Measuring how many places a secret lives is the subject of our Secret Sprawl Measurement Guide. Private keys deserve particular attention, because they are often long-lived and rarely appear in issuer dashboards; see Private Keys in Repositories Guide.
Proving a secret is dead
An incident should close on evidence, not on a completed task. NHI Mgmt Group recommends three checks for every exposed credential:
- Negative authentication test. Attempt a harmless, authorised call with the old credential from a controlled environment and record the rejection. Many providers also expose a key status in their console or API.
- Usage review. Pull the issuer's logs for the credential from first exposure to now. Responders, as OWASP puts it, should be able to see who accessed the secret, when it was used and when it was last rotated. Any use after revocation means another copy or a derived credential is still live.
- Dependency confirmation. Confirm that every workload that used the credential now authenticates with its replacement, so nobody quietly re-enables the old one to fix an outage.
Record the evidence in the incident ticket. If a later investigation asks whether the August rotation covered a given token, you should be able to answer from records rather than from recollection.
Designing so deletion matters less
The long-term fix is to make leaked credentials expire on their own and to remove stored secrets where possible. OWASP advises that you "create secrets to expire after a defined time where possible" and notes that lifetimes can range from minutes upward depending on the function.
- Prefer short-lived, federated credentials (workload identity, OIDC to cloud providers, keyless signing) over stored keys. A leaked token that expires in an hour is a smaller problem than one created in 2024 with no expiry.
- Set an expiry on every credential that supports one, and alert on credentials that do not.
- Restrict where credentials can be used from, so an admin token is not accepted from the public internet.
- Scope each credential to one workload and one purpose. Zeabur notes a key meant for one storage bucket could read every bucket in the account.
- Keep secrets out of logs with redaction at source, and keep backup keys separate from the secrets the backups contain.
- Detect secrets before commit with pre-commit hooks and IDE scanning, as OWASP recommends, so fewer leaks reach shared history at all.
Common failure patterns
- Closing the scanner alert as remediation. The alert closes when the string disappears, not when the credential is revoked.
- Rewriting history first. Hours spent on
git filter-repowhile the key is still valid is time an attacker can use. - Rotating from a partial inventory. Rotating the secrets you remember, and missing those in configuration repositories, backups or init scripts.
- Replacing without revoking. Issuing a new key and leaving the old one active "in case something breaks".
- Forgetting derived credentials. Revoking the leaked key but not the sessions, sub-tokens or new keys created with it.
- Trusting the old signer. Rotating a signing key but leaving its public key in verification policies.
- Overstating closure. Telling customers "all keys rotated" before the evidence supports it, then having to correct the statement.
Practitioner checklist
- For every exposed secret, record the issuer, the identity it represents and the time of first exposure.
- Revoke or rotate at the issuer before any history rewrite or log purge.
- Revoke sessions, refresh tokens and any credentials created with the exposed one.
- Build the rotation scope from issuer inventories and store scans, not from memory.
- Treat every secret readable from a compromised store as exposed.
- For signing keys, remove the old public key from verification and decide what to do with artefacts it signed.
- Test that the old credential fails, review its usage logs and confirm dependants use the replacement.
- Set expiry on every credential that supports it and alert on non-expiring credentials.
- Redact secrets from logs at source and separate backup keys from backed-up secrets.
- Only then clean up history, forks, caches and tickets, and contact your Git host's support where needed.
Standards and references
- Zeabur: October 2026 security incident report
- LiteLLM: Security incident, 21 October 2026
- GitHub Docs: Removing sensitive data from a repository
- OWASP: Secrets Management Cheat Sheet
- OWASP: Non-Human Identities Top 10 2025
- NIST: SP 800-53 Rev. 5 (IA-5 Authenticator Management)
- MITRE ATT&CK: Credentials In Files (T1552.001)
- MITRE ATT&CK: T1078 Valid Accounts
Related NHI Mgmt Group resources: How to Remove Secrets From Git History · Secret Rotation vs Revocation · API Key Leak Response Playbook · Leaked secret breaches