Scanning

Scanning

Run xgrep against your code — the CLI surface, output formats, supported languages, file selection, and Semgrep parity.

Scanning

Everything about running a scan with xgrep:

Common recipes

Secrets scanning runs by default alongside the security rules, so a committed credential surfaces without any extra flags:

xgrep scanning a config file and reporting a committed GitHub token and Stripe key, each with revoke-and-rotate remediation guidance

# Default: run the built-in security + secrets rules over a directory
xgrep scan <target>

# High-signal, exploitable-only scan — recommended when embedding xgrep or
# scanning a focused executable surface (e.g. an AI-agent skill).
# Drops hardening/advisory findings (--subcategory vuln) and non-source trees
# such as tests/benchmarks/examples (--xgrepignore).
xgrep scan --category security --subcategory vuln --xgrepignore <target>

# Machine-readable output for tooling / CI
xgrep scan --json <target>

# Hunt secrets across the whole git history — including ones committed and later
# deleted (they still live in history and are still compromised).
xgrep --history --category secrets <repo>

# Find secrets hidden one encoding layer deep (base64/hex/url/gzip blobs).
xgrep --decode --category secrets <target>

See Secrets scanning for the full secrets story (history scanning, decoding encoded payloads, validation, and what's detected), CLI reference for the vuln vs audit tiers, and File filtering for --xgrepignore.

To author the rules you scan with, see Rules.

On this page