Interview Prep/Git & GitHub/Security: secrets, signing, access and supply chain

Walk through purging a leaked secret from a 5 GB repo with 200 contributors.

AdvancedProductionSecurity: secrets, signing, access and supply chain
Answer

Rotate first. Announce a freeze, take a mirror backup, run git filter-repo --replace-text on a fresh mirror clone, push all branches and tags with force (temporarily lifting protection through the ruleset bypass), then contact GitHub support to remove cached PR refs (refs/pull/*) and dangling views. Everyone must re-clone because old clones can reintroduce the secret on the next push. Forks and local clones outside your control still hold it, which is why rotation matters.

git clone --mirror [email protected]:org/app.git && cd app.git
git filter-repo --replace-text ../replacements.txt
git push --force --mirror
All Git & GitHub questions Roadmap: Git & GitHub

More on Security: secrets, signing, access and supply chain