If a secret is detected by CI:
Immediately disable or revoke the exposed credential.
Examples:
- API keys
- Access tokens
- Database passwords
- Cloud provider credentials
Generate a new credential and update all dependent services.
Remove the secret from:
- Source code
- Configuration files
- Environment files accidentally committed
If the secret has been committed:
- Rewrite Git history
- Remove the secret from all affected commits
- Force-push the cleaned history if appropriate
Recommended tools:
- git-filter-repo
- BFG Repo-Cleaner
Confirm that:
- The secret is no longer present
- Secret scanning passes successfully
- New credentials are functioning correctly