CLI reference¶
Generated from leakscan 0.5.2.
leakscan¶
Usage: leakscan [OPTIONS] COMMAND [ARGS]...
leakscan - find leaked API keys and secrets in code, history, images and
packages.
Options:
-V, --version Show the version and exit.
--help Show this message and exit.
Commands:
completion Print a shell completion script.
config Validate configuration and print JSON schemas.
hook Agent hook: block AI coding agents from writing or...
ignore Add PATTERN to .leakscanignore (gitignore syntax).
init Create a .leakscanignore with sensible defaults.
install-hook Install a git pre-commit hook in the current repo.
mcp Run an MCP server on stdio exposing scan_text, scan_path...
purge Print (never run) commands to remove secrets from git...
rules List, inspect, disable or import detection rules.
scan Scan PATH for leaked secrets.
leakscan completion¶
Usage: leakscan leakscan completion [OPTIONS] {bash|zsh|fish}
Print a shell completion script.
bash: leakscan completion bash > ~/.local/share/bash-completion/completions/leakscan
zsh: leakscan completion zsh > "${fpath[1]}/_leakscan"
fish: leakscan completion fish > ~/.config/fish/completions/leakscan.fish
Options:
--help Show this message and exit.
leakscan config¶
Usage: leakscan config [OPTIONS] COMMAND [ARGS]...
Validate configuration and print JSON schemas.
Options:
--help Show this message and exit.
Commands:
schema Print the JSON schema for .leakscan.yaml (or for --format...
validate Check a .leakscan.yaml for unknown keys, bad types and...
leakscan config schema¶
Usage: leakscan config leakscan config schema [OPTIONS]
Print the JSON schema for .leakscan.yaml (or for --format json output).
Options:
--report Print the JSON report schema instead of the config schema.
--help Show this message and exit.
leakscan config validate¶
Usage: leakscan config leakscan config validate [OPTIONS] [PATH]
Check a .leakscan.yaml for unknown keys, bad types and invalid regexes.
Options:
--help Show this message and exit.
leakscan hook¶
Usage: leakscan leakscan hook [OPTIONS]
Agent hook: block AI coding agents from writing or running secrets.
Reads the tool call JSON on stdin, scans every string in it, and blocks the
call when a secret at or above --fail-on is found. See the docs for Claude
Code and Cursor configuration snippets.
Options:
--agent [claude-code|cursor|generic]
Hook protocol to speak. [default: claude-
code]
--fail-on [CRITICAL|HIGH|MEDIUM|LOW]
[default: HIGH]
--help Show this message and exit.
leakscan ignore¶
Usage: leakscan leakscan ignore [OPTIONS] PATTERN [PATH]
Add PATTERN to .leakscanignore (gitignore syntax).
Options:
--help Show this message and exit.
leakscan init¶
Usage: leakscan leakscan init [OPTIONS] [PATH]
Create a .leakscanignore with sensible defaults.
Options:
--help Show this message and exit.
leakscan install-hook¶
Usage: leakscan leakscan install-hook [OPTIONS]
Install a git pre-commit hook in the current repo.
Options:
--help Show this message and exit.
leakscan mcp¶
Usage: leakscan leakscan mcp [OPTIONS]
Run an MCP server on stdio exposing scan_text, scan_path and scan_staged.
Options:
--help Show this message and exit.
leakscan purge¶
Usage: leakscan leakscan purge [OPTIONS]
Print (never run) commands to remove secrets from git history.
Options:
--commit SHA Show what a commit changed and how to redact it.
--file PATH Remove a file from every commit.
--all Template for redacting secret values everywhere.
--method [filter-repo|bfg]
--help Show this message and exit.
leakscan rules¶
Usage: leakscan rules [OPTIONS] COMMAND [ARGS]...
List, inspect, disable or import detection rules.
Options:
--help Show this message and exit.
Commands:
disable Disable a rule for this project (writes .leakscan.yaml).
enable Re-enable a disabled rule.
import Import a YAML rule pack from an https URL or a local file.
list List every built-in and imported rule.
remove Remove an imported rule pack.
show Show a rule's regex, blast radius and rotation link.
verifiers List services supported by --verify / --verify-only and what...
leakscan rules disable¶
Usage: leakscan rules leakscan rules disable [OPTIONS] RULE_ID
Disable a rule for this project (writes .leakscan.yaml).
Options:
--config TEXT Config file to edit (default ./.leakscan.yaml).
--help Show this message and exit.
leakscan rules enable¶
Usage: leakscan rules leakscan rules enable [OPTIONS] RULE_ID
Re-enable a disabled rule.
Options:
--config TEXT
--help Show this message and exit.
leakscan rules import¶
Usage: leakscan rules leakscan rules import [OPTIONS] SOURCE
Import a YAML rule pack from an https URL or a local file.
Options:
--name TEXT Name to save the pack under.
--help Show this message and exit.
leakscan rules list¶
Usage: leakscan rules leakscan rules list [OPTIONS]
List every built-in and imported rule.
Options:
--json Machine-readable output.
--severity TEXT Filter by severity.
--search TEXT Filter by name or ID.
--help Show this message and exit.
leakscan rules remove¶
Usage: leakscan rules leakscan rules remove [OPTIONS] NAME
Remove an imported rule pack.
Options:
--help Show this message and exit.
leakscan rules show¶
Usage: leakscan rules leakscan rules show [OPTIONS] RULE_ID
Show a rule's regex, blast radius and rotation link.
Options:
--help Show this message and exit.
leakscan rules verifiers¶
Usage: leakscan rules leakscan rules verifiers [OPTIONS]
List services supported by --verify / --verify-only and what each request
sends.
Options:
--help Show this message and exit.
leakscan scan¶
Usage: leakscan leakscan scan [OPTIONS] [PATH]
Scan PATH for leaked secrets.
PATH can be a directory, a file, '-' for stdin, a git URL (GitHub, GitLab,
Bitbucket or any https/ssh remote), docker://IMAGE[:TAG], pypi:NAME[==VER]
or npm:NAME[@VER].
Examples:
leakscan scan .
leakscan scan . --staged
leakscan scan . --pr --format sarif -o results.sarif
leakscan scan . --history --since 2024-01-01
cat .env | leakscan scan -
leakscan scan --text "AKIA..."
leakscan scan notebooks/ --archives
leakscan scan docker://nginx:1.27
leakscan scan pypi:requests==2.32.3
leakscan scan https://gitlab.com/group/project --history
leakscan scan --github-org my-org --resume org.state.json
Options:
--text STRING Scan a literal string instead of a path.
-g, --github USER Scan every public repo of a GitHub user or
org.
--github-org ORG Scan every repo in a GitHub organisation.
-r, --repo REPO Limit --github to one repo name.
--include-forks Org/user scans: include forks.
--include-archived Org/user scans: include archived repos.
--repo-include GLOB Org/user scans: only repos matching GLOB.
--repo-exclude GLOB Org/user scans: skip repos matching GLOB.
--resume FILE Org/user scans: resume from (and save
progress to) FILE.
-t, --token TOKEN GitHub token for API calls and private
clones (or GITHUB_TOKEN).
--clone-depth N Depth for remote clones (default: 1, or
--depth+1 with --history).
-f, --format [terminal|json|csv|sarif|html|junit|markdown|sonarqube|defectdojo|disclosure]
[default: terminal]
-o, --output FILE Write the report to FILE.
--also FORMAT:FILE Write an extra report in another format,
e.g. --also sarif:out.sarif (repeatable).
--entropy-threshold FLOAT [default: 4.5]
--no-entropy Disable the high-entropy fallback detector.
-s, --severity [critical|high|medium|low]
Only report findings at or above this
severity.
--min-confidence 0-1 Only report findings at or above this
confidence.
--fail-on [critical|high|medium|low]
Exit 1 if any finding is at or above this
severity (default HIGH).
--exit-zero Always exit 0 when the scan itself succeeds.
--history Also scan git history.
--depth, --max-commits N Max commits to scan with --history (default
100, GitHub 50).
--since DATE History: only commits after DATE.
--branch BRANCH History: only this branch.
--staged Scan only staged changes (pre-commit).
--since-commit REF Scan only lines added since REF.
--base BRANCH Scan only lines added relative to BRANCH
(merge-base).
--pr Scan only lines added in the current PR/MR
(CI env vars).
--follow Tail PATH (or stdin) and report secrets as
lines arrive.
--archives Scan inside .zip/.tar/.whl/.jar archives.
--decode Also decode base64/hex/URL-encoded values
one level.
--no-validate Keep matches that fail checksum/structure
validation.
--keep-placeholders Report EXAMPLE/changeme/xxxx placeholder
values too.
--disable-rule ID Disable a rule by ID (repeatable).
--verify Check whether found secrets are live (sends
them to their provider).
--verify-only SERVICES Comma list of services to verify (see
`leakscan rules verifiers`).
--verify-timeout SECONDS [default: 5.0]
--verify-concurrency INTEGER RANGE
[default: 4; 1<=x<=10]
-y, --yes Confirm --verify against third-party
targets.
--config FILE Config file (default: auto-detect
.leakscan.yaml).
--baseline FILE Hide findings already in this baseline.
--save-baseline FILE Save findings as a baseline (fingerprints
only).
--redact Mask secret values in output.
--include-gists Include gists in --github scans.
--threads N Worker threads (default: CPU count).
--max-file-size MB [default: 50]
--chunk-size BYTES [default: 1000000]
--cache FILE Skip unchanged clean files using a cache
(default file .leakscan-cache).
--no-progress No progress bar or live stream.
--brief One line per finding instead of full blocks.
--no-blame Skip git blame lookups.
--show-ignored List files skipped by .leakscanignore.
--notify TARGETS Comma list: slack, discord, teams, webhook,
email (or 'both' for slack+discord).
--webhook URL Generic JSON webhook URL (also used as the
fallback for --notify).
--slack-webhook URL
--discord-webhook URL
--teams-webhook URL
--notify-clean Also notify when nothing is found.
--help Show this message and exit.