When to use
Use this when onboarding a repo, after a suspected leak, before open-sourcing code, or on a recurring cadence. It detects exposed credentials so they can be revoked and rotated defensively.
METHOD
- Define targets. Enumerate what to scan: working tree, full git history, CI logs, application logs, and config/env files.
- Pattern scan. Search for high-entropy strings and known token shapes: AWS keys (AKIA...), private keys (BEGIN ... PRIVATE KEY), JWTs,
Bearertokens, DB connection strings, andpassword=/api_key=assignments. - History sweep. Scan committed history, not just HEAD — secrets often live in old commits. Note that deleting a file does not remove it from history.
- Triage findings. Classify each hit as true positive, test/placeholder, or false positive. Record where it is exposed and its blast radius.
- Rotation runbook. For each confirmed secret: revoke the credential at the provider, issue a replacement, update the secret store, redeploy, then purge history if warranted.
- Prevent recurrence. Recommend pre-commit secret scanning,
.gitignorehardening, and a secrets manager.
OUTPUT FORMAT
- Scan scope — targets covered.
- Findings table — Secret type | Location (file:line / commit / log) | Confidence | Blast radius.
- Rotation runbook — per secret: revoke → reissue → update store → redeploy → verify.
- Prevention — tooling and policy recommendations.