AGENT SKILL

gitleaks-scan

Run gitleaks against the working tree to detect committed secrets, API keys, tokens, and credentials. Use whenever a file has been written, before any git commit, before any push, and as part of the tiered security gate. Catches the most common cause of credential leaks - accidental commits.

License 许可
MIT
所属仓库
MILTONADINA/DevOPs
最近更新
2026-11-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
gitleaks-scan
description
Run gitleaks against the working tree to detect committed secrets, API keys, tokens, and credentials. Use whenever a file has been written, before any git commit, before any push, and as part of the tiered security gate. Catches the most common cause of credential leaks - accidental commits.

02 资源文件 1

03 SKILL.md 正文

Gitleaks Scan

Catches secrets before they hit the remote, wherever it is wired in: a CI step, the pre-commit hook init-project.sh installs, or the post-tool hook script once a harness registers it (nothing registers it by default).

Tradeoff: ~2-5s scan time on file change. Worth it: a leaked secret is a P0 incident and takes hours to rotate + audit.


When to invoke

  • After writing a file that may hold a credential: run gitleaks detect --no-git --source <file> --no-banner yourself. hooks/universal/post-tool/gitleaks-scan.sh runs that command, but only once the harness registers it as a post-tool hook with a wrapper that passes the written file's path as its first argument (for Claude Code, in .claude/settings.json); analyzer/install.ts copies hooks without registering them.
  • Pre-commit: in .git/hooks/pre-commit (installed by init-project.sh)
  • Pre-push: in .git/hooks/pre-push
  • CI: on every PR

Install

brew install gitleaks
# or
go install github.com/gitleaks/gitleaks/v8@latest

The post-tool hook gitleaks-scan.sh emits a "missing" warning once per session and skips gracefully if gitleaks isn't installed.


Configure

Project-level: .gitleaks.toml. Inherit defaults and add custom rules:

[extend]
useDefault = true

[[rules]]
id = "internal-client-id"
description = "Internal client ID format"
regex = '''CL-[A-Z0-9]{16}'''
tags = ["client-id", "PII"]

Allowlist false positives:

[allowlist]
description = "Test fixtures"
paths = [
    '''fixtures/test-keys/.*''',
]

Tiered usage

See docs/SECURITY.md for the full tiered pentest stack. Gitleaks fits at:

  • Tier 1 (every file write): post-tool hook, once the harness registers it; until then secrets are caught at commit (pre-commit hook, where installed) or at PR (the CI step)
  • Tier 2 (every PR): CI step blocking merge on findings
  • Tier 3 (pre-release): full history scan with gitleaks detect

On finding

The post-tool hook, once registered, exits 2; the pre-commit hook, where installed, blocks the commit; the CI step blocks the PR. The user must:

  1. Remove the secret from the file
  2. Rotate it if it was real
  3. Add to a vault (Doppler, 1Password, Vault, Infisical)
  4. Reference via env var

If a secret has ALREADY been committed (caught by Tier 2/3):

  1. Rotate immediately
  2. Use git filter-repo or BFG to scrub history
  3. Force-push with team coordination
  4. Open a postmortem in docs/postmortems/

This skill is working when: zero secrets reach the remote. The intended record is governance/telemetry/secret-findings.jsonl. Nothing writes it yet, so check by hand.

04 同仓库更多 Skills

MILTONADINA
MILTONADINA/DevOPs

karpathy-guidelines

Behavioral guidelines that reduce common LLM coding mistakes. Apply whenever writing, modifying, or reviewing code. Don't assume requirements, don't overcomplicate, don't refactor unrelated code, and define success criteria before implementing. Use this skill on every non-trivial coding task to avoid bloat, silent assumptions, and completion-bias.

★ 0
MILTONADINA
MILTONADINA/DevOPs

unsigned-missing-sig-fixture

Test fixture (F.09) — SKILL.md without an accompanying .sig file. Default install rejects with exit 2; --allow-unsigned --rationale="..." proceeds.

★ 0
MILTONADINA
MILTONADINA/DevOPs

unsigned-mismatched-sig-fixture

Test fixture (F.09) — SKILL.md whose accompanying .sig signs different content. NFR-F3 hash check catches this even with --allow-unsigned.

★ 0
MILTONADINA
MILTONADINA/DevOPs

karpathy-guidelines

Behavioral guidelines that reduce common LLM coding mistakes. Apply whenever writing, modifying, or reviewing code. Don't assume requirements, don't overcomplicate, don't refactor unrelated code, and define success criteria before implementing. Use this skill on every non-trivial coding task to avoid bloat, silent assumptions, and completion-bias.

★ 0
MILTONADINA
MILTONADINA/DevOPs

webhook-idempotency

Defend against double-processing of webhook events across every provider (Stripe, GitHub, Slack, Twilio, SendGrid). Idempotency-key pattern + replay-window enforcement + dedupe-storage strategy. Triggers on any webhook handler authoring (route matching /webhook(s)?/, Stripe-Signature / X-Hub-Signature-256 header references). Defense against OWASP ASI02 (Tool Misuse) -- a replayed webhook that re-triggers a destructive tool is the canonical control-flow-level replay attack. Universal across providers; stack-specific signature verification lives in stack-specific skills.

★ 0
MILTONADINA
MILTONADINA/DevOPs

semgrep-scan

Run Semgrep static analysis to detect insecure code patterns - SQL injection, XSS, path traversal, weak crypto, broken auth, OWASP Top 10 issues. Use on every file change touching security-sensitive code and as part of the tiered security gate. Complements gitleaks (which catches secrets) by catching insecure logic.

★ 0