个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证Claude Code PreToolUse hook that stops the agent from printing your API keys. MIT, no dependencies.
翻译准备中
取自仓库 README
正在加载完整 README。 以下为已保存的摘录。
A Claude Code PreToolUse hook that stops the agent from printing your API keys.
Coding agents with shell access will sometimes "check" a credential by echoing it. That puts the key in the transcript, in logs, and in anything you share. This hook blocks the common paths and tells Claude why, so it changes approach.查看完整 README ↗A Claude Code PreToolUse hook that stops the agent from printing your API keys.
Coding agents with shell access will sometimes "check" a credential by echoing it. That puts the key in the transcript, in logs, and in anything you share. This hook blocks the common paths and tells Claude why, so it changes approach.
echo / printf / Write-Output of variables named like *KEY*, *TOKEN*, *SECRET*, *PASSWORD*, *CREDENTIAL*$env:SECRET in PowerShell, GetEnvironmentVariable('..._KEY')printenv, env, set, bare export, declare -p/-x, Get-ChildItem env:.env, .env.local, .env.production, … (cat, head, grep, sed, awk, sort, xxd, Get-Content, Select-String, < .env redirects, …)Read and Grep tools on .env* filesWrite / Edit content containing live-looking Google, Anthropic, OpenAI, GitHub or Slack keys, or private key blocks[ -n "$GEMINI_API_KEY" ] && echo set, [bool]$env:GEMINI_API_KEY.env.exampleIn Claude Code:
/plugin marketplace add fable-and-fuse/claude-secret-guard
/plugin install secret-guard@fable-and-fuse
Restart Claude Code, then ask it to echo $SOME_API_KEY: it will be blocked with a reason. The plugin needs bash (Git Bash on Windows, which Claude Code already uses) and Python 3.8+. If no Python is found, the hook prints a warning and lets the call through.
The hook already blocks reading .env files. Plugins can't add permission rules, so if you also want the permissions.deny backstop shown below, add it to your settings yourself.
.claude/hooks/guard_secrets.py into your project..claude/settings.json, or merge it into the existing file:{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash|PowerShell|Read|Grep|Write|Edit|MultiEdit|NotebookEdit",
"hooks": [{ "type": "command", "command": "python .claude/hooks/guard_secrets.py", "timeout": 10 }]
}
]
},
"permissions": { "deny": ["Read(./.env)", "Read(./.env.*)"] }
}
echo $SOME_API_KEY and it will be blocked with a reason.Requires Python 3.8+. No dependencies.
This is pattern matching. A command that reads the environment in an unusual way (for example, a one-off script that prints os.environ) can get past it. Use it as a seatbelt, and layer it with a pre-commit secret scanner, scoped and rotatable keys, provider billing alerts, and the habit of never pasting keys into chats or screenshots.
Found a bypass? Open an issue with the command. It becomes a test case in tests/test_guard_secrets.py.
pip install pytest && python -m pytest
This hook ships inside Switchboard, a Claude Code + Gemini multi-model kit with a resilient Gemini broker (fallback chain, quota circuit breaker, usage telemetry), a research subagent, and /research and /second-opinion commands, sold by Fable & Fuse Studios: https://fable-and-fuse.github.io/brainrot-colour-chaos-site/switchboard/
MIT licensed. Not affiliated with Anthropic.