Gitleaks

Gitleaks

Scans a repository and its full history for committed secrets.

Application & Supply Chain Free & Open Source CLI Learning Cross-platform

Cyber Kill Chain & Defender Lifecycle

Attacker — Kill Chain
1 Reconnaissance
2 Weaponization
3 Delivery
4 Exploitation
5 Installation
6 Command & Control
7 Actions on Objectives
Defender — IR Lifecycle
8 Preparation
9 Detection & Analysis
10 Containment, Eradication & Recovery
11 Post-Incident Activity

Description

Gitleaks searches the working tree and every commit in history for credentials. The history part is what matters: removing a key in a later commit does not remove it from the repository, and anyone who cloned before the fix still has it.

A hit is not just a finding, it is an incident — the credential must be rotated, not deleted. Running it as a pre-commit hook is the cheaper posture, since it stops the secret before it becomes history.

Use cases

  • Pre-commit hook blocking a secret before it is committed
  • Auditing the full history of an inherited repository
  • Triggering credential rotation after a leak is confirmed

Example

gitleaks detect --source . --redact --verbose