Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

gitleaks-scanning

FreeNo executable scriptsNot checked

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…

testlandby testland★ 18 GitHub stars

About this skill

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

  1. Install gitleaks (Step 1); confirm with gitleaks version.
  2. Run a full-history baseline scan: gitleaks git (Step 2).
  3. Add .gitleaks.toml with [extend] useDefault = true plus any org-internal custom rules (Step 3 - 4, references/custom-rules-and-triage.md).
  4. Triage findings: rotate real leaks, allowlist genuine false-positives with a Re-review-date (Step 5, references file).
  5. Wire the pre-commit hook for fast local feedback (Step 6).
  6. Add the CI job with fetch-depth: 0 as the catch-net gate (Step 7).
  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.
Full SKILL.md on GitHub

Install gitleaks-scanning in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

.tessl-plugin/plugin.jsonevals/auditor-wants-proof-one-suppression-hides-one-key/criteria.jsonevals/auditor-wants-proof-one-suppression-hides-one-key/task.mdevals/custom-rule-quietly-replaced-the-default-ruleset/criteria.jsonevals/custom-rule-quietly-replaced-the-default-ruleset/task.mdevals/every-pr-red-since-scanning-went-live/criteria.jsonevals/every-pr-red-since-scanning-went-live/task.mdevals/gitleaks-baseline-rollout/criteria.jsonevals/gitleaks-baseline-rollout/task.mdevals/gitleaks-bypass-hardening/criteria.jsonevals/gitleaks-bypass-hardening/task.mdevals/gitleaks-custom-rule/criteria.jsonevals/gitleaks-custom-rule/task.mdevals/gitleaks-default-rules/criteria.jsonevals/gitleaks-default-rules/task.mdevals/gitleaks-encoded-archived/criteria.jsonevals/gitleaks-encoded-archived/task.mdevals/hook-blamed-for-a-commit-it-never-ran-on/criteria.jsonevals/hook-blamed-for-a-commit-it-never-ran-on/task.mdevals/researcher-found-a-key-our-green-job-never-saw/criteria.jsonevals/researcher-found-a-key-our-green-job-never-saw/task.mdreferences/baseline.mdreferences/custom-rules-and-triage.mdreferences/trufflehog.md

FAQ

What does the gitleaks-scanning skill do?

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.

How do I install the gitleaks-scanning skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the gitleaks-scanning skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare gitleaks-scanning with