适用于 Claude Code · Codex CLI · Antigravity (agy) · GitHub Copilot CLI · Gemini CLI · Cursor · Windsurf · VSCode · Claude Desktop · Opencode · Pi · Hermes Agent · 任何 MCP 服务器。
rm -rf、git push --force、DROP TABLE、凭据读取、curl | bash、AWS/GitHub/Stripe 密钥泄露这是我自己的机器——构建 Node9 期间的 90 天。得分 25/100,AI 代理当前可触及 5 个凭据文件。```bash npx node9-ai scan # before installation, runs in ~10s, nothing uploads node9 scan # after installation, same output
<p align="center">
Node9 扫描评分卡
</p>
## 安全态势评分卡
`node9 posture` 会评估这台机器对受感染代理的暴露程度——隔离、出站流量、磁盘上的机密、供应链、权限——并为你提供修复每项发现的确切命令。```bash
node9 posture # scorecard with the #1 risk and a fix for every finding
node9 posture --ship # send a redacted snapshot to your node9 dashboard (fleet view)
发现结果按谁能修复它们分组:🔒 是 node9 能减少的(只需运行命令)和 🧱 是只有你能修复的。每项都附带通俗易懂的“是什么 / 为什么 / 谁”说明以及实际修复建议——例如,“代理在主机上无沙箱运行”这一发现直接指向 node9 sandbox run(见下文)。```text
🛡️ Node9 Posture — agent on this host Score: 100/100 (Good)
2 advisories below don't affect the score — OS-level exposure, yours to weigh.
🟢 node9 is already protecting you ✅ Secrets node9 DLP is blocking this ✅ Egress node9 egress is approval-gating this ✅ Approval gate node9 is blocking this ✅ Privilege node9 is approval-gating this
🔒 node9 reduces these — run the command, the rest is yours ⚠️ Isolation Running directly on the host — no container The agent runs loose on your whole machine, not in a sandbox. → node9 sandbox run — jail it: kernel egress + scoped mounts + node9 inside → node9 shield enable project-jail — or shrink the blast radius, keep host access ⚠️ Network exposure 4 services on 0.0.0.0 (node :3000/:4000, PostgreSQL :5432, Redis :6379) Reachable from your whole network, not just this laptop. → node9 shield enable postgres|redis — node9 blocks DROP TABLE / FLUSHALL → bind to 127.0.0.1 / firewall the port (your part)
✅ Supply chain no issues found ✅ Coverage no issues found
Track this across your fleet & keep it green → node9.ai
## 扫描仓库 — agent-CI 安全
`node9 scan-repo` 会检查任何仓库(或本地文件夹),以发现接入 GitHub Actions 的 AI 代理可能被**外部人员劫持**的途径——可注入的工作流、代理可访问的机密、未固定版本的 MCP 服务器、权限过宽的代理配置,以及被投毒的指令文件。该工具仅进行静态解析:只读取已提交的配置,绝不执行仓库代码。扫描公共仓库无需安装或令牌。```bash
npx node9-ai scan-repo <owner/repo> # any public repo, no install
node9 scan-repo . # a local checkout — no network
node9 scan-repo <owner/repo> --json # machine-readable
(未提供输入内容。请补充需要翻译的 Markdown 文本。)```text 🛡️ node9 scan-repo · node9-ai/agent-security-demo · ⚠️ agent-security risk found inspected 2 config file(s), 2 finding(s)
🔴 CRITICAL Injectable agent workflow — untrusted input reaches a tool-using agent with secrets .github/workflows/vulnerable-example.yml · CI-2 • runs with base-repo secrets (pull_request_target) • checks out the untrusted PR head into the workspace root • allowed_non_write_users: "*" — any user can trigger the agent • no effective actor gate
🔴 CRITICAL Exfiltratable secrets reachable by an injectable agent .github/workflows/vulnerable-example.yml · CI-4 • agent has arbitrary shell (bare Bash) → can read env and exfiltrate
它检查的内容:
| 检查项 | 标记内容 |
| -------- | ---------------------------------------------------------------------------- |
| **CI-1** | 已提交的代理配置,预先授权了宽泛的工具或运行远程钩子 |
| **CI-2** | 可注入的代理工作流——外部人员可以触发代理并劫持它 |
| **CI-3** | 未固定版本 / `@latest` 的 MCP 服务器或内联凭据(供应链风险) |
| **CI-4** | 被注入的代理可能窃取的机密信息 |
| **CI-6** | `CLAUDE.md` / `AGENTS.md` / 技能中包含的恶意或危险指令 |
**为每个 PR 设置门禁** —— 与 GitHub Action 使用相同的引擎,因此可被劫持的配置无法被合并:```yaml
# .github/workflows/agent-security.yml
- uses: node9-ai/node9-proxy@v2
with:
fail-on: high # or 'never' to just comment
Marketplace: node9 Agent Security
正在使用它?在你的 README 中添加 scanned by node9 徽章。
Node9 监控仪表盘
node9 monitor 会打开一个交互式终端仪表盘,包含两个视图:
[1] 实时 — 实时活动、审批、安全警报、当前风险评分[2] 报告 — 周期窗口汇总:成本、热门工具、触发的防护、爆炸半径在监控界面按 [2] 可查看周期窗口汇总。使用 [T]oday(今日)· [W]eek(本周)· [M]onth(本月)· [N]inety(九十天)切换窗口 — 面板与上述扫描相同,数据来自你的安装后审计日志。
Node9 监控 [2] 报告
npm install -g node9-ai
I need the input content to translate. Please provide the chunk of Markdown content you'd like me to translate from English to Chinese.```bash
node9 init # auto-wires all detected agents + MCP servers
node9 login # connect this machine to your workspace (approve it in the browser)
node9 doctor # verify everything is wired and reporting
需要 Node.js 18+。
单独使用 init 即可获得完整的本地强制执行:规则、防护盾、DLP 和审批全部离线运行,就在这台机器上。
login 的作用是将这台机器接入你的仪表盘。它会打印一个代码,打开浏览器,然后你在那里审批这台机器;如果你还没有账户,在流程中注册后,会带着相同的代码返回到同一个审批页面。在你运行它之前,所有内容都在本地强制执行,但不会传送到 Mission Control,因此仪表盘保持为空。
node9 logout 可再次断开机器连接。它会吊销该机器的密钥;本地强制执行会继续运行。
每个防护盾都是针对某个服务或领域的一套精选规则。只启用你需要的即可。
| 防护盾 | 捕获内容 | 启用命令 |
|---|---|---|
project-jail | 阻止通过 Bash 和 Read 工具读取 ~/.ssh、~/.aws、.env、凭据 | node9 shield enable project-jail |
bash-safe | curl | bash、rm -rf /、磁盘覆写、对远程内容的 eval | node9 shield enable bash-safe |
postgres | DROP TABLE、TRUNCATE、DROP COLUMN、无 WHERE 的 DELETE | node9 shield enable postgres |
mongodb | dropDatabase、drop()、deleteMany({})、索引删除 | node9 shield enable mongodb |
redis | 在活动服务器上执行 FLUSHALL、FLUSHDB、CONFIG SET | node9 shield enable redis |
aws | S3 删除、EC2 终止、IAM 更改、RDS 销毁 | node9 shield enable aws |
k8s | 命名空间删除、helm uninstall、集群角色清除 | node9 shield enable k8s |
docker | system prune、volume prune、rm -f 容器 | node9 shield enable docker |
github | gh repo delete、远程分支删除、设置更改 | node9 shield enable github |
filesystem | chmod 777、写入 /etc/、/boot/、/usr/ 目录 | node9 shield enable filesystem |
mcp-tool-gating |
## 始终开启 — 无需配置
- **Git** — 拦截 `git push --force`、`git reset --hard`、`git clean -fd`
- **SQL** — 拦截不带 `WHERE` 的 `DELETE` / `UPDATE`、`DROP TABLE`、`TRUNCATE`
- **Shell** — 拦截 `curl | bash`、未授权的 `sudo`
- **DLP** — 在任何工具参数、文件内容或 shell 配置(`~/.zshrc`、`~/.bashrc`)中标记 AWS 密钥、GitHub 令牌、Stripe 密钥、PEM 私钥
- **响应 DLP** — 后台扫描器读取 Claude 的对话历史,并在 Claude 于其响应文本中_写出_机密信息时提醒你
- **技能固定** — 对已安装的 Claude 技能 / 插件在会话之间进行 SHA-256 校验
## 审查提示 — 在代理中内联批准
当 node9 将某个操作标记为**审查**(例如 `git push --force`、`DROP TABLE`)时,批准/拒绝提示会**内联渲染在代理对话中** — 不会冻结会话、无需单独终端、不存在钩子超时竞争。node9 仍会运行完整的评估器并做出决策;只有提示_界面_移至代理中。
- **默认开启**,适用于 **Claude Code** 和 **GitHub Copilot CLI** — 这些代理的钩子契约支持原生的 `ask`。所有其他代理(Codex、Gemini、Antigravity、Hermes、Cursor、OpenCode、Pi)则使用 node9 自带的批准器。
- **通过** `~/.node9/config.json` 中的 `reviewChannel` 进行控制(或在钩子上使用 `--no-ask`):```jsonc
{
"settings": {
"reviewChannel": "ask", // "ask" = inline agent prompt (default) | "approver" = node9's own approver
},
}
approvers.cloud: true)时,审查将路由到该审批人,而不是节点9——节点9不会让内联的自审批绕过路由/第二方审批。当仅监控不够时,node9 sandbox 会在一个一次性容器中运行代理,该容器具有内核强制的出口允许列表和作用域挂载——而节点9的钩子会治理并审计盒子内部的每一次工具调用。这是硬性保护版本:代理只能访问你挂载的文件夹并到达你允许的主机;其他一切都在内核层面被丢弃。```bash
cd ~/my-project
node9 sandbox new # write node9.sandbox.yaml — what to mount + which hosts to allow
node9 sandbox run # build + boot the jailed agent (your project at /workspace)
node9 sandbox tail # watch the agent's actions live, from the host
- **一次性** — 容器在退出时销毁;你的项目编辑会落在真实磁盘上,其他内容都不会保留。
- **相同策略** — 你现有的防护规则 / 出站规则 / 审批在容器内同样生效,并流式写入同一审计日志和仪表板。
- **闭环安全态势** — 运行它会将隔离 / 出站相关发现翻转为绿色。
诚实的范围(第一阶段):单容器,**先支持 Claude**(Codex 随后);代理在容器内仍持有其_自身_的凭据(出站墙将其限制在允许的主机范围内)— _"代理绝不持有密钥"_ 是路线图上的凭据代理阶段。需要 Docker。
## MCP 网关
透明地包装任意 MCP 服务器。代理看到的是同一服务器 — Node9 会拦截每一次工具调用。```json
{
"mcpServers": {
"postgres": {
"command": "node9",
"args": ["mcp", "--upstream", "npx -y @modelcontextprotocol/server-postgres postgresql://..."]
}
}
}
或者直接运行 node9 init —— 它会自动包装你现有的 MCP 服务器。
MCP 服务器可能会在会话之间更改其工具定义。一个被入侵或恶意的服务器可能会在你首次信任它之后,悄悄添加、移除或修改工具——这就是 “抽地毯”攻击。
Node9 在首次使用时固定工具定义:
</details>
## 其他命令
除上述三个流程命令(`scan` / `monitor` / `report`)之外:
| 命令 | 显示内容 | 使用时机 |
| ----------------- | ------------------------------------------------------------ | ------------------------------------ |
| `node9 blast` | AI 代理当前可访问的内容 — 文件、凭据、环境变量 | 在任何机器上首先运行 |
| `node9 tail` | 每次工具调用的实时流(仅文本,无 TUI) | 管道传输到其他工具、CI、日志 |
| `node9 sessions` | 会话历史,包含提示词、工具调用轨迹和成本 | 审查交接或过往工作 |
| `node9 dlp` | Claude 响应文本中的凭据泄露发现结果 | 每当 DLP 桌面警报触发时 |
| `node9 mask` | 从本地会话历史文件中编辑明文机密 | 在 DLP 发现之后 — 清理本地磁盘 |
此外,在 Claude Code 状态栏中还有一个**实时 HUD**:```
🛡 node9 | standard | [bash-safe] | ✅ 12 allowed 🛑 2 blocked 🚨 0 dlp | ~$0.43
📊 claude-opus-4-7 | ctx [████████░░░] 54% | 5h [██░░░░░░░░] 12% | 7d [█░░░░░░░] 7%
🗂 2 CLAUDE.md | 8 rules | 3 MCPs | 4 hooks
Node9 会呈现关键信号。以下是一些值得关注的模式:
一次性信号是正常的;持续出现的模式才是你需要采取行动的对象。
from node9 import configure, protect
configure(agent_name="my-agent", policy="require_approval")
@protect("bash") def run_command(cmd: str) -> str: ...
**[Python SDK →](https://github.com/node9-ai/node9-python)** · **[CI 代码审查代理示例 →](https://github.com/node9-ai/node9-pr-agent)**
## 底层原理
- **扫描** 从 `~/.claude/projects/`、`~/.gemini/tmp/`、`~/.gemini/antigravity-*/brain/`、`~/.copilot/session-state/`、`~/.codex/sessions/` 读取原始代理历史记录 — 无 API 调用,完全离线
- **运行时** 通过预执行钩子(Claude Code、Codex、Antigravity、GitHub Copilot CLI、Gemini CLI、Opencode、Pi)或通过 MCP 网关(Cursor、Windsurf、VSCode、Claude Desktop)拦截工具调用。所有决策以原子方式写入 `~/.node9/audit.log`
- **MCP 网关** 是一个 stdio 代理;拦截 `tools/list` + `tools/call` JSON-RPC,转发其余内容
- **策略引擎** 使用 [mvdan-sh](https://github.com/mvdan/sh) 进行 bash AST 分析 — 可破解通过反斜杠转义、变量替换、远程下载 eval 实现的混淆
- **沙箱** 生成一个 Dockerfile + 入口点,构建 `ipset`/`iptables` 默认拒绝的出站网络墙,然后降权至非 root 代理,并在其中运行 node9 的守护进程和钩子;仅挂载代理的凭据文件,绝不会挂载你的整个 `~/.claude`
## 完整文档
配置参考、智能规则、有状态规则、可信主机、审批模式、CLI 参考 — 请访问 **[node9.ai/docs](https://node9.ai/docs)**。
## 相关项目
- **[node9-python](https://github.com/node9-ai/node9-python)** — Python SDK
- **[node9-pr-agent](https://github.com/node9-ai/node9-pr-agent)** — 通过 Node9 审查 PR 的 GitHub Action
## 企业版
**Node9 Pro** 增加了治理锁定、SAML/SSO、集中审计导出和 VPC 部署。请参阅 [node9.ai](https://node9.ai)。
## 许可证
Apache-2.0
<p align="center">
<sub>由 ☕ 和健康的偏执构建而成。</sub>
</p>
| 未经审批的 MCP 工具静默激活新能力 |
node9 shield enable mcp-tool-gating |
| node9 shield list # show all shields + status |
| 信号 | 可能含义 |
|---|
一周内 Would have blocked ≥ 5 次 | Agent 正在尝试高影响操作;值得审查防护规则 |
单条 review-git-push 规则占发现结果的 50% 以上 | 你自己的规则按预期触发——不是风险,只是监督 |
user-prompt 工具中的 DLP 发现 | 你将机密粘贴到了自己的提示词中——请轮换密钥 |
| 同一文件上 Agent Loop ×50+ | Agent 陷入编辑/测试/修复循环——请检查上下文或放慢速度 |
| MCP 工具固定不匹配 | 服务器更改了其工具——在重新信任前请先审查 |
| 大型 MCP 响应警告 | 该服务器正在为后续每一轮对话膨胀你的上下文窗口 |
Response DLP 警报 | Claude 在其响应文本中写入了机密——未被阻止,请立即轮换 |
tool-result 中的 DLP 发现 | Claude 读取了包含机密的文件(.env、凭据)——请轮换密钥并运行 node9 mask |
[Shell] 中的 DLP 发现 | ~/.zshrc 或 ~/.bashrc 中存在明文机密——每次 AI 会话都能看到它 |