PROVIDER - Secret leak scanning for Git repositories
Gitleaks
Gitleaks scans Git history and the working tree with 150+ credential rules plus custom regex, blocking leaks before commit and offering baselines for legacy findings; pattern matching means false positives remain and rotation stays manual.
4.5pts
Service Overview
Gitleaks is an open source secret scanning tool written in Go. It walks Git commit history and the current working tree, matching API keys, private keys and database passwords against a rule catalogue and emitting structured reports.
In the development tools category it is the DevSecOps front line: rather than auditing after merges, it blocks credentials from ever entering the repository.
Key Strengths
- Rich rules: 150+ credential formats plus custom regex
- Pre-commit blocking: hooks stop leaks from entering history
- Flexible usage: one binary scans local, directory or remote targets
- Baseline mechanism: record legacy findings then clean gradually
- Standard output: 4+ formats, with SARIF consumable by code scanning platforms
Product Ecosystem
Platform capabilities
History scanning, working tree scanning, custom rules, baseline management, ignore configuration, concurrency control and multi-format reports.
Integrations
Works with GitHub Actions, GitLab CI, pre-commit, Jenkins and code scanning platforms.
Typical scenarios
Repository security audits, CI secret gates, compliance evidence and pre-merge credential checks.
Limitations
- False positives: high-entropy strings are easily flagged
- Coverage limits: credentials without defined rules are missed
- History cost: full scans of very large repositories take time
- No revocation: leaked keys must be rotated manually
Use Cases
- Every code repository (★★★★★): low cost with frequent payoff
- CI secret gates (★★★★★): automatic scans before each merge
- Compliance auditing (★★★★☆): SARIF output archives cleanly
- Runtime secret protection (★★☆☆☆): pair with Vault-style systems
Pricing
| Item | Price | Notes |
|---|---|---|
| Gitleaks itself | $0 | MIT open source, commercial use allowed |
| Binary releases | $0 | Direct downloads from GitHub Releases |
| Gitleaks Pro | Contact sales | Commercial edition with extra governance |
FAQ
How does Gitleaks differ from GitHub native secret scanning?
Gitleaks is self-hostable, allows custom rules and runs locally at the pre-commit stage, so coverage is not limited to the GitHub platform.
How do I stop false positives blocking releases?
Record acceptable fingerprints in .gitleaksignore or a baseline file so only new findings fail.
Can it scan non-Git directories?
Yes, point it at a plain filesystem path to scan files without Git history.
What should I do after a leak is found?
Revoke and rotate the credential immediately, purge the history, then record the case in the baseline for review.
Code Examples
# .gitleaks.toml: custom rules and ignores
title = "custom gitleaks config"
[extend]
useDefault = true
[[rules]]
id = "internal-api-key"
description = "Internal API key"
regex = '''int_[0-9a-f]{32}'''
[allowlist]
paths = ['''test/fixtures/.*''']
# Scan the current repository history
gitleaks detect --source . --report-format sarif --report-path report.sarif
# Create a baseline so only new findings are reported
gitleaks detect --source . --baseline-path gitleaks-baseline.json
# Run as a pre-commit hook
gitleaks protect --staged
Community & Resources
- Website: https://gitleaks.io/
- Source repository: https://github.com/gitleaks/gitleaks
- Configuration docs: https://github.com/gitleaks/gitleaks#configuration
Articles
- 01 GitLab CI/CD Best Practices: From Beginner to Production-Grade Pipelines 07-18
- 02 Prometheus Monitoring System Setup: From Metric Collection to Alert Notifications 07-18
- 03 Ansible Automation Ops Guide: From Configuration Management to Application Deployment 07-18
- 04 Docker Beginner Tutorial: From Installation to Containerized Web Deployment 07-18
- 05 Developer Tools Panorama: What Version Control, Package Managers, CI/CD and Containers Solve 08-12
- 06 Upgrading SVN to 1.8 on CentOS 7 04-02
- 07 Git for Beginners: Working Directory, Staging Area, Repository and Core Commands 08-12
- 08 GitHub Actions CI/CD Tutorial: Automated Build, Test, and Deployment 07-18
- 09 GitHub Copilot Code Review Is Now Generally Available 08-05
- 10 API Integration Guide: REST vs GraphQL Comparison and Selection 07-18