Guide · updated Nov 30, 2026
Remove a secret from git history.
Rewriting history hides the key from new clones; only rotating it makes it useless, so rotate first.
highlights · fix ready
Move @xmldom/xmldom to 0.8.15.
- "@xmldom/xmldom": "0.7.13"
+ "@xmldom/xmldom": "0.8.15"
- Verify passedinstall, build, 212 tests · 41 s
- Rescan cleanall 15 advisories gone
- Blast radiusbuild tools only, nothing in the app
Step by step
Rotate the key
Revoke it at the provider and issue a new one. Anyone who cloned or forked the repo still has the old commits.
Find every commit that holds it
Scan the whole history, not just the latest tree.
gitleaks git -v .Write a replacements file
One line per secret: the literal value, then what to put in its place.
echo 'sk_live_abc123==>REMOVED' > replacements.txtRewrite history
git filter-repo rewrites every commit on every branch. Drop a whole file with --invert-paths instead.
git filter-repo --replace-text replacements.txt # or: git filter-repo --invert-paths --path .envForce-push branches and tags
filter-repo removes the origin remote as a safety catch: add it back, then push.
git remote add origin git@github.com:acme/web.git git push --force --all && git push --force --tagsAsk GitHub to drop cached views
Old commits stay reachable from pull request refs and caches until GitHub Support removes them. Forks keep their own copies.
Stop the next one
Ignore the file, re-clone everywhere, and turn on secret scanning push protection or a Gitleaks pre-commit hook.
echo '.env' >> .gitignore
Or let IonCipher do it.
IonCipher checks the whole history once, names each key and where it's used, and hands the rotation steps to you or your coding agent.
More guides
Leaked API key: what to do in the first hour
A leaked API key, in order: revoke it, read the provider's logs since the leak, find every copy, redeploy with the new key, then clean the history..
Pin GitHub Actions to a commit SHA
Tags on GitHub Actions can be moved, as tj-actions (2025) and the Trivy Action (2026) showed.
GitHub Actions security checklist
Twelve checks for GitHub Actions: SHA pins, read-only tokens, pull_request_target, script injection, secrets, runners, OIDC and alerts on change..
A Dependabot alternative that batches PRs
Dependabot can group updates; here's the config.
Your first fix, on your phone tonight.
Connect GitHub; the first scan of every repo finishes in minutes.