Remediate a leak on public GitHub
If you end up on this page, it is likely that you got an alert from our pro bono alerting service. Don't worry, leaks sometimes just happen... even to the best of us...
This section provides a step by step guide on how to remediate a leak that occurred on public GitHub.
For comprehensive remediation guidance covering both public and internal incidents, see our Public Monitoring Remediation Overview.
⚠️ What you should NOT do:
- Committing on top of the current source code version is not a solution. Bear in mind that git keeps track of the history, the secret will still be visible in previous commits.
- Only taking down the involved repository is not a correct solution. The leaked credentials will still be exposed in forks of the repository, and attackers could still access it in mirrored versions of GitHub.
✅ Step by step guide to remediate the leak
- Step 1: Assess the impact and revoke the exposed secret.
- Step 2: Clean the git history (optional, see warnings below).
- Step 3: Inspect logs and verify security.
🔒 Step 1: Assess impact and revoke the secret (~ 5-10 min)
First, quickly assess the situation:
- Confirm this secret actually belongs to your organization
- Understand what resources this secret can access
- Determine the privilege level and potential impact
Then, revoke the secret - this is the only way to ensure no attacker will access the involved service.
How to revoke:
- Having been alerted by GitGuardian, you can navigate to the corresponding GitGuardian detector's documentation, all information about revocation are available in the
Revoke the secretsection of the selected detector. - If you found out about the leak without GitGuardian and it is not a secret type handled by one of our detectors, have a look at the relevant provider's documentation. You can usually revoke your credentials in the same section you issued them.
- If you leaked corporate credentials or credentials you cannot revoke by yourself, we highly recommend you get in touch with your security team immediately. It's OK to make mistakes, hiding them is often a bigger problem.
Whether you managed to revoke the credentials or not, move to step 2 to mitigate the leak and remove evidence of it.