gitleaks-scanning
БесплатноБез исполняемых скриптовНе проверенUse when a team needs open-source secret scanning on commits and in CI, or is adopting it on a repo with existing leaks: gitleaks git, dir and stdin scans…
от testland★ 18 звёзд на GitHubОб этом скилле
gitleaks-scanning
Command-API note (v8.19.0+): Per gl-gh,
"v8.19.0 deprecated detect and protect commands, though they
remain available." Current scanning modes:
| Command | Use |
|---|---|
gitleaks git <repo> |
Scan local git repository using git log -p |
gitleaks dir <path> |
Scan directories and files (no git history) |
gitleaks stdin |
Stream data via pipe |
Use git for git-aware scans (fastest, history-rewinding); dir
for non-git (e.g., extracted CI artifact); stdin for diff-piping.
When to use
- The team needs pre-commit + CI secret scanning.
- A migration from a private-repo-history audit (catch secrets ever committed; not just current state).
- Custom rule library for org-internal secret formats (internal API key prefixes, etc.).
- Layered with TruffleHog (references/trufflehog.md) for live-validation cross-check.
How to use
- Install gitleaks (Step 1); confirm with
gitleaks version. - Run a full-history baseline scan:
gitleaks git(Step 2). - Add
.gitleaks.tomlwith[extend] useDefault = trueplus any org-internal custom rules (Step 3 - 4, references/custom-rules-and-triage.md). - Triage findings: rotate real leaks, allowlist genuine
false-positives with a
Re-review-date(Step 5, references file). - Wire the pre-commit hook for fast local feedback (Step 6).
- Add the CI job with
fetch-depth: 0as the catch-net gate (Step 7). - On any confirmed leak, rotate the credential first, then scrub (Step 8).
Step 1 - Install
Per gl-gh:
# Homebrew
brew install gitleaks
# Docker
docker pull zricethezav/gitleaks:latest
docker run -v ${PWD}:/path zricethezav/gitleaks:latest git /path
# From source
git clone https://github.com/gitleaks/gitleaks.git
cd gitleaks
make build
Step 2 - Basic scans
# Scan current git repo (full history)
gitleaks git
# Scan a specific dir (no git)
gitleaks dir ./services/
# Stream + scan (e.g., scan a PR diff)
git diff main..HEAD | gitleaks stdin
# Output formats
gitleaks git --report-format json --report-path leaks.json
gitleaks git --report-format sarif --report-path leaks.sarif
gitleaks git --report-format csv --report-path leaks.csv
For PR-time scanning (faster - only check what changed):
gitleaks git --log-opts="origin/main..HEAD"
Step 3 - .gitleaks.toml config
Per gl-gh config structure:
rules
id = "rule-identifier"
description = "rule description"
regex = '''regex-pattern'''
secretGroup = 3
entropy = 3.5
keywords = ["auth", "password"]
tags = ["tag1", "tag2"]
rules.allowlists
description = "ignore specific matches"
commits = ["commit-hash"]
paths = ['''file-path-regex''']
stopwords = ['''false-positive-term''']
Built-in rules cover AWS, GCP, Azure, GitHub, GitLab, Stripe,
Twilio, Slack, npm, PyPI, etc. Use gitleaks <command> --no-banner
to discover the full default rule list.
Step 4 - Custom rule example
Org-internal secret formats (internal API-key prefixes, etc.) go in
rules blocks. Set [extend] useDefault = true to keep the
built-in rules; without it, custom rules replace the defaults
entirely. Full example (custom rule + per-rule and top-level
allowlists) in
references/custom-rules-and-triage.md.
Step 5 - False-positive triage (MANDATORY)
Suppress genuine false-positives with rules.allowlists (paths /
commits), the top-level allowlists, --baseline-path for legacy
debt, or an inline # gitleaks:allow comment. Every allowlist entry
needs a Re-review-date; audit them quarterly. The suppression
priority table and the justification template are in
references/custom-rules-and-triage.md.
Onboarding a repo that already has historical findings - baseline
snapshots, cross-tool suppression consistency with TruffleHog, waiver
pointers, and rot prevention - is in
references/baseline.md.
Step 5b - When gitleaks misses a secret
A scan that exits 0 is only as good as what it read. Per gl-gh:
| Missed leak | Why | Fix |
|---|---|---|
Base64 value, e.g. a Kubernetes Secret's data: field, or a percent- or hex-encoded token |
Decoding is off: for --max-decode-depth "the default value "0" means the feature is disabled by default". Supported: percent, hex (32+ chars), base64 (16+ chars). |
--max-decode-depth 3; such findings carry decoded:<encoding> tags. |
Secret inside a committed .zip or .tar.gz (fixtures, build output) |
Archive traversal is off: for --max-archive-depth "The default value of "0" means this feature is disabled by default" (documented from v8.27. |
Установить gitleaks-scanning в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл gitleaks-scanning?
Use when a team needs open-source secret scanning on commits and in CI, or is adopting it on a repo with existing leaks: gitleaks git, dir and stdin scans, custom rules and allowlists in .gitleaks.toml, pre-commit and GitHub Action setup, baselines, and TruffleHog live verification.
Как установить скилл gitleaks-scanning?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл gitleaks-scanning запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic