security
Secret detection and credential scanning using gitleaks. Use when scanning repositories for leaked secrets, API keys, passwords, tokens, or implementing…
от vinnie357★ 30 звёзд на GitHub
Установить security в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Security: Secret Detection
This skill activates when performing secret detection, credential scanning, or implementing security checks for leaked sensitive data in code repositories.
Pre-Commit Hook (Automatic)
When this skill is loaded, a pre-commit hook automatically scans staged files for secrets before every git commit command, providing defense-in-depth by catching secrets before they enter git history. Only staged files are scanned (not the entire working tree); .gitleaks-baseline.json and .gitleaks.toml, when present, are honored for known false positives and custom rules.
If the hook detects secrets, the commit is blocked (exit code 2) with guidance to remove the secret, switch to an environment variable, or add it to the baseline if it's a false positive.
The hook requires a container runtime (Apple Container, Docker, or Colima via mise) to run gitleaks. If no runtime is available, the hook logs a warning and allows the commit — it fails open, not closed.
See references/gitleaks-usage.md for the hook's exact flow diagram and block-message text.
Agent Secret Safety
When agents interact with secrets (1Password, environment variables, keychains):
- Never print secret values in output, logs, or reports
- Confirm existence only:
test -n "$VAR" && echo "set" || echo "empty" - Never use
--revealin agent scripts — use it only in launcher scripts that don't capture output - If a secret value is accidentally exposed in conversation context, the user must rotate it immediately
This applies to all agent tiers. A leaked secret in agent output forces credential rotation.
Commands that leak environments
"Never print secret values" is not enough on its own — some commands leak the full environment as a side effect of an unrelated-looking diagnostic. The command reads as "get a bit more context on this process," not "dump every credential this process can see," so the guidance above does not visibly apply and the leak happens anyway.
Incident (2026-08-04): an agent confirming one environment variable on a running process followed up with ps -E -p <pid> as a diagnostic. On macOS, -E appends the process's entire environment after the command line, undifferentiated from the command-line arguments — four live credentials landed in the transcript in plaintext, requiring rotation of all four. A prior incident (2026-07-30) came from printenv | grep -i database on a pod — same shape, different command. A third incident, the same day as the first, happened while drafting the guidance below: an agent ran the exact command this section warns about, to confirm it leaks, against a session holding live credentials — and leaked them.
Do not run these commands to check whether they leak. This is the operative instruction, ahead of the table below. ps -E/-e-shaped flags, COMMAND_MODE=legacy ps -e, /proc/<pid>/environ, and unfiltered printenv/env all read and emit the target's real environment the instant they execute — there is no dry-run, no filtered form, no "just to see." Verifying the hazard reproduces the hazard. An agent session routinely holds live service-account tokens and API keys in its own environment, so "let me confirm this actually leaks" against a real process is itself the leak, not a safe way to check one. Take the mechanism below as established fact — do not re-derive it by running anything:
- Observed on macOS 26.6, against a mise-installed (non-platform) binary:
ps -Eoutput grew from an 11-word baseline (command line only) to 105 words once the process's environment was appended, with a marker variable present only in the appended portion. - Observed on macOS 26.6:
COMMAND_MODE=legacy ps -etargeted at one process returned 2 lines — a header and that process with its environment appended. The same flag withCOMMAND_MODEunset returned 961 lines, one per running process on the system, confirming the default (unix2003) reading of-eis "select all processes" (matching Linux), not "append environment."man psLEGACY DESCRIPTION documents the flip: "-eDisplay the environment as well. Same as-E." - Apple's own platform binaries (
/bin/sleep,/bin/cat, and similar) ship codesigned with the hardened runtime and are shielded from the environment-append behavior — a check against one of those looks clean and is not evidence the flag is safe. That shielding does not extend to anything an agent actually spawns: mise-installed binaries, language runtimes (nu,node,python,elixir), and project-local tooling all leak reliably. This is background for why the hazard is broader than "system processes," not an invitation to compare the two yourself.
Banned outright — never run any of these, on any platform, filtered or not:
| Command | Platform | Why it leaks |
|---|---|---|
ps -E |
macOS/BSD | Documented flag: "Display the environment as well" (man ps). Appends the targe |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- hooks/check-secrets-before-commit.sh
- references/ci-and-prevention.md
- references/container-runtimes.md
- references/gitleaks-usage.md
- scripts/gitleaks.nu
- scripts/gitleaks.sh
- templates/mise.toml
FAQ
Что делает скилл security?
Secret detection and credential scanning using gitleaks. Use when scanning repositories for leaked secrets, API keys, passwords, tokens, or implementing pre-commit security checks.
Как установить скилл security?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл security запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis 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…