xgrep vs gitleaks
How xgrep compares to gitleaks. Both are local single binaries for finding secrets, but xgrep validates secrets to cut false positives and folds secret scanning into one pass with SAST and dependency analysis.
gitleaks is a widely used open-source secret scanner: a single local binary that finds hardcoded credentials with regex and entropy rules, including across git history. xgrep also scans locally from one binary. What differs is false-positive control and scope.
At a glance
| xgrep | gitleaks | |
|---|---|---|
| Packaging | single local binary | single local binary |
| Secret detection | 270+ detectors, 150+ providers, plus entropy | regex + entropy rules |
| Validation | yes, live --validate confirms the secret is real | pattern match only |
| Git-history scanning | yes (--history), with commit provenance | yes |
| Encoded secrets | yes (--decode: base64, hex, URL, gzip) | yes |
| Archives | yes: .zip, .tar, .jar/.war, .whl, .gem, .nupkg, .phar | yes |
| Redaction | yes (--redact) | yes |
| Diff-aware / baseline | yes (--baseline-commit) | yes (baseline file) |
| Inline suppression | yes (nosem / nogrep) | yes (gitleaks:allow) |
| Ignore file | yes (.xgrepignore) | yes (.gitleaksignore) |
| Custom rules | yes, Semgrep-compatible YAML | yes, TOML |
| Staged-only pre-commit mode | no | yes (gitleaks protect --staged) |
| Output | text, JSON/NDJSON, SARIF, GitLab SAST | JSON, CSV, JUnit, SARIF, Go templates |
| Also does SAST | yes (taint / dataflow) | no |
| Also does dependency (SCA) scanning | yes (vulnerability matching needs a Mondoo account) | no |
Feature for feature, xgrep does what gitleaks does. History, archives, encoded payloads, redaction, baselines, custom rules, and then validation, SAST and dependency scanning on top. One gap runs the other way: gitleaks has a staged-only pre-commit mode.
Fewer false alarms
gitleaks reports on pattern and entropy: anything that looks like a token. xgrep
adds a validation step. It decodes a candidate and, with --validate,
checks whether the secret is actually live
before raising its severity. A random high-entropy string that matches a pattern can
then be told apart from a real credential, which cuts the noise that makes secret
scans tiring to triage.
One pass, not one tool per problem
gitleaks does secrets, and does them well. xgrep finds secrets in the same run that does taint-based SAST and dependency scanning. One binary, one scan, one report across all three.
Accuracy
There is no public labeled corpus for secret detection comparable to the OWASP Benchmark for SAST, so there is no head-to-head score here, for either tool.
What xgrep does instead of estimating one is verify. A candidate is decoded and, with
--validate, checked against the provider before its severity is raised, so a live
credential is separable from a high-entropy string that merely matches a pattern. For
xgrep's measured SAST accuracy on labeled corpora, see the
Semgrep comparison.
When gitleaks is the better fit
If secrets are the only thing you need, gitleaks is focused and does that one job. Two specifics decide it outright: it has a staged-only pre-commit mode, and it writes CSV, JUnit and Go-template reports if something downstream of you needs one of those formats.
When Mondoo is the better fit
Secrets are one signal. Mondoo pairs xgrep, covering code, secrets and dependencies, with cnspec, which covers infrastructure as code, cloud accounts, containers, Kubernetes and running hosts. Both report to Mondoo Platform and land on the same asset, so a leaked credential is read next to the posture of the systems it opens. See Mondoo.
Try it
xgrep scan . # includes secret detection by default
xgrep scan --validate . # confirm which secrets are live
xgrep scan --history --category secrets . # secrets across the full commit historySee secrets.
Last updated on
vs Trivy
How xgrep compares to Trivy. Both are single local binaries, but xgrep adds taint-based application SAST and reachability-ranked dependency vulnerabilities, while Trivy focuses on container, OS-package, and known-CVE scanning.
vs TruffleHog
How xgrep compares to TruffleHog. Both scan locally and validate secrets, but xgrep folds secret detection into one pass with taint-based SAST and dependency analysis.