Deleting a leaked key from your repo doesn't protect you LiteLLM developers leaked an administrative key in a public GitHub commit in May and attackers used the credential to compromise their infrastructure months later, according to the company's post-mortem on the October 21, 2026 attack chain. The post-mortem states that a follow-up commit deleted the file about three hours after the leak and the keys were noted as requiring revocation, but the original commit stayed in the repository's public history until October 22, when LiteLLM rewrote git history. The incident illustrates that deleting a file, rewriting commit history or deleting a repository does not protect a leaked secret, because secret scanners and attackers parse git history and GitHub still serves unreachable commits to anyone with the SHA-1 hash; only rotating the credential does. tl;dr If you leak a secret, rotate it immediately. Deleting a file, rewriting git commit history or deleting your repository won't protect you. Attackers routinely scan the internet for secrets, so assume they already have a copy. Use Betterleaks or Aikido Secrets Detection to find leaked secrets in your repos, and Aikido Device Protection to find them on developer machines. In May, LiteLLM developers accidentally committed an administrative key to a public GitHub repository. Attackers used that credential to compromise their infrastructure months later. LiteLLM’s post-mortem https://docs.litellm.ai/blog/security-incident-oct-21-2026-attack-chain documents the timeline of their actions to fix the leak. One sentence from the report stuck out to me: “About three hours later a follow-up commit deleted the file that leaked the secret and the keys were noted as requiring revocation, but the original commit stayed in the repository's public history until October 22.” LiteLLM caught the leak within 3 hours. Their first corrective action was this Pull Request https://github.com/LiteLLM-Labs/lite-harness/pull/7 that simply deleted the file. Months later, on October 22, they rewrote git history to remove the commits https://github.com/LiteLLM-Labs/lite-harness/commit/25330ee80c82d7ecc9e988cec0f3cff8eace5419 that leaked the credential. Those two actions, while common, reflect general misconceptions among developers about secret leakage in git history. Neither step LiteLLM took actually prevents anyone from viewing the leaked data. In fact, the commit https://github.com/LiteLLM-Labs/lite-harness/blob/e10b14a/harnesses/opencode/opencode.json leaking the credential is still visible today don’t worry, they’ve since rotated it . The only way to fully fix a leaked credential is to rotate that credential. Once it’s public, it’s no loner a secret, and won't be again. Common Misconceptions about Leaked Secrets in Git The experiments below each test a common "fix" for leaked secrets in git repos: None of these actions fully protects you from threat actors discovering and using a secret you leak. Even if it’s only in public for just a few minutes. Misconception 1: Delete the file LiteLLM took this approach immediately after discovering the leak and it’s probably the most common reaction. The developer recognized a mistake in their code, so they “fixed” it by deleting the offending file in a new commit. As we’ll see below, secret scanners parse git history and scan deleted files. 1. Create a new local git repo. Commit a README. Then commit a file with a secret in it. mkdir tmp repo cd tmp repo git init echo " README" README.md git add README.md git commit -m "initial commit" fake leaked key echo "secret token=ZQ5Cl16U8kmc4uOxS581xDWr" file.txt git add file.txt git commit -m "exposing secret in file.txt" 1. Delete that file. Commit again. rm file.txt git add . git commit -m "removed exposed secret in file.txt" 1. Scan using Betterleaks https://github.com/betterleaks/betterleaks . You’ll see it detects a secret in git history. Instructions for setting up Betterleaks on the GitHub page. betterleaks git . Misconception 2: Rewrite git history The next instinct is usually to "erase" the leak from git history. LiteLLM attempted this on October 22 by force pushing a rewritten history that excludes the relevant commits. On the surface this seems to work, since those commits aren’t reachable from any branch. Unfortunately, GitHub still serves "deleted" commits to anyone who has their SHA-1 hash. 1. Record the commit SHA-1 hash where you exposed the secret. git log --format=%H --grep="exposing secret in file.txt" -1 Note: SHA-1 hashes are 40 characters, which is way too long to guess. However, GitHub allows users to provide a short version in their UI, which resolves to the full 40 characters. The short version can be as short as 4 characters 0-9a-f , which makes these hashes more easily discoverable. 1. Push the local repo from above to GitHub. Create the repo on the GitHub website if the first command doesn’t work. git remote add origin https://github.com/