
CC Safety Net
Plugin在工具调用执行前,拦截破坏性的 Git 与文件命令(如 git reset --hard、rm -rf)以及对 SSH 密钥、.env 等敏感文件的读写。它按命令语义解析,套一层 bash -c 也能识别。支持 Claude Code、Codex 等多种编码 CLI,需要 Node.js 18+。
CC Safety Net (Coding CLI Safety Net) blocks destructive commands and access to secrets such as SSH keys and .env files before the tool call runs. It parses what the command does. Wrapping the command or reordering flags does not hide it. A broken config file never blocks anything. It is not a sandbox: it does not contain processes, set filesystem permissions, or watch network egress.
[!NOTE] Full documentation → covers installation, configuration, reference material, guides, and the security model. This README is the short version.
How it works
Supported coding CLIs
CC Safety Net supports these coding agent CLIs on Windows, macOS, and Linux.
Amp Code | Antigravity CLI | Claude Code | Codex |
Cursor | DeepSeek Harness | Devin CLI | Factory Droid |
Gemini CLI | GitHub Copilot CLI | Grok Build | Hermes Agent |
Kimi Code | OpenClaw | OpenCode | Pi |
Features
- Blocks destructive commands such as
git reset --hard,git push --force, andrm -rfon dangerous targets, even insidebash -corpython -c. See Blocked Commands. - Blocks secret access to SSH keys,
.envfiles,~/.aws, and coding-CLI credentials, from the shell and from the agent's file tools. See Secret Protection. - Tunes the policy in a GUI. Run
npx cc-safety-net guito pick the Standard, Strict, or Paranoid preset and turn rules on or off. See Modes. - Adds blocks through rulebooks: official packs for Terraform, AWS, gcloud, and Azure, or your own JSON. See Official Rulebooks.
- Shares policy through git. Commit
.cc-safety-net/so clones and cloud sessions get the same rules. See Team Setup. - Embeds in your own tools. Call
checkCommandfrom Node.js without installing the hook. See Library API.
Quick start
You need Node.js 18 or higher. Install into the coding CLIs on this machine, then check that protection is working:
npx -y cc-safety-net@latest install
npx -y cc-safety-net@latest doctor
Update with npx -y cc-safety-net@latest update and uninstall with npx -y cc-safety-net uninstall. Keep the @latest qualifier: a bare cc-safety-net spec can run an older copy from the npx cache. Per-CLI requirements are in Installation.
Development
See CONTRIBUTING.md to report a bug or request a feature.
License
MIT
相关资源

Gitleaks
CLI检测 Git 仓库、目录文件与标准输入中硬编码的密码、API Key 和令牌,可配成 pre-commit 钩子或 GitHub Action 拦截密钥泄露。已宣布功能冻结、只发安全补丁,作者转向 Betterleaks。
gitleaks/gitleaks30k
pre-commit
CLI多语言 git hook 管理框架:在 .pre-commit-config.yaml 里声明格式化、lint、密钥扫描等钩子,提交前自动运行,也可用 pre-commit run --all-files 让 agent 提交前自检。
pre-commit/pre-commit15.6k
Aider
CLI终端里的 AI 结对编程工具:为整个代码库建立仓库地图,改动自动提交 git,可接入 Claude、DeepSeek、OpenAI 等几乎所有模型及本地模型,改完可自动跑 lint 与测试。
Aider-AI/aider49.6k
SonarQube
Plugin在 agent 编码循环中接入 SonarQube 代码质量与安全检查:密钥扫描钩子、问题列表与修复、质量门禁、覆盖率与依赖风险查询;开通 Vortex 分析后每次编辑自动检查。Sonar 官方维护,需 SonarQube 账号(含免费 Community Build)、sonar CLI 与 Docker。
SonarSource/sonarqube-agent-plugins112
Semgrep Guardian
Plugin把 Semgrep MCP 服务和钩子打包在一起:agent 每写一个文件,就用 Semgrep Code、Supply Chain、Secrets 扫描漏洞、恶意依赖和硬编码密钥,并提示 agent 重写,直到结果干净或由你忽略。Semgrep 官方维护,需要登录 Semgrep 账号。
semgrep/guardian17
RTK (Rust Token Killer)
CLI在命令输出进入 agent 上下文之前做过滤和压缩的 Rust 命令行代理,覆盖 git、测试、grep、ls 等上百种命令,最多可减少约 90% 的 bash 输出;通过钩子自动改写 Claude Code、Codex 等 agent 执行的命令。
rtk-ai/rtk83.6k