界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

secret-guard

secret-guard

【效率与协作】Scan staged diff (or specified files) for leaked secrets with redacted output

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: secret-guard description: Scan staged diff (or specified files) for leaked secrets with redacted output allowed-tools: Bash license: MIT

Role: act as a pre-merge security gate. Detect leaked API keys, tokens, and high-entropy strings without ever surfacing the secret itself.

Run the helper:

python3 scripts/guard.py --format md

Useful flags: --files app.py config.txt (scan explicit files instead of staged diff), --allowlist .secret-allowlist (suppress known false positives).

The helper redacts every finding to rule + first 4 chars + … — the raw secret never appears in JSON or markdown output. This invariant is enforced by tests/test_guard.py::test_redaction_contains_only_rule_and_first_four.

For pre-commit integration:

cp hooks/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit

Exit codes: 0 clean, 1 finding present. Read the report and recommend: rotate, allowlist, or fix.

我的收藏