pleasedodisturb/llm-safe-haven
GitHub: pleasedodisturb/llm-safe-haven
为独立开发者提供一键式 AI 编程 Agent 安全加固方案,自动检测已安装 Agent、配置安全钩子并评估风险等级。
Stars: 0 | Forks: 0
# LLM Safe Haven
[](https://socket.dev/npm/package/llm-safe-haven)
[](https://www.npmjs.com/package/llm-safe-haven)
[](https://opensource.org/licenses/MIT)
在 60 秒内强化你的 AI 编程 Agent。
```
npx llm-safe-haven
```
## 它的功能
检测你已安装的 Agent,安装安全钩子,并为你的配置评分:
```
LLM Safe Haven -- Security Scorecard
Detected agents:
+ Claude Code -- Level 3 (hooks + audit + sandbox)
+ Cursor -- Level 1 (ignore files + advice)
. Windsurf -- not installed
Security Level: 2 of 4
+--------------------------------------+
| ##########.......... Level 2: Guarded |
+--------------------------------------+
```
## 支持的 Agent
| Agent | 等级 | 配置内容 |
|-------|------|--------------------|
| Claude Code | Full | Hooks, settings.json, sandbox, 审计日志 |
| Cursor | Solid | .cursorignore, 工作区信任指南 |
| Windsurf | Solid | .codeiumignore, 限制警告 |
| Cline | Solid | .clineignore |
| Continue.dev | Solid | .continueignore |
| Aider | Solid | .aiderignore, .env 警告 |
| Codex CLI | Solid | .codexignore, sandbox 指南 |
## 命令
```
npx llm-safe-haven # Install hooks and harden (default)
npx llm-safe-haven audit # Check security posture
npx llm-safe-haven audit --json # Machine-readable for CI
npx llm-safe-haven scan # Find exposed .env files
npx llm-safe-haven update # Update hooks to latest
npx llm-safe-haven --dry-run # Preview without changing anything
```
## 安全级别
| 级别 | 名称 | 含义 |
|-------|------|---------------|
| 0 | Exposed | 无强化 |
| 1 | Basic | 已安装 Hooks |
| 2 | Guarded | + 审计日志 + 无 .env 文件 |
| 3 | Hardened | + 凭证代理 + 拒绝规则 |
| 4 | Fortified | + 容器隔离 + 网络限制 |
## 深入了解
- [威胁模型](docs/threat-model.md) -- 针对独立开发者的 OWASP Agentic Top 10(26+ 起真实事件)
- [Claude Code 强化指南](docs/hardening/claude-code.md) -- 包含 hooks、sandbox 和权限的完整指南
- [Cursor 强化指南](docs/hardening/cursor.md) -- 记录了 7 个 CVE 及强化步骤
- [Windsurf 强化指南](docs/hardening/windsurf.md) -- 对限制的客观评估
- [Devin 强化指南](docs/hardening/devin.md) -- 云 Agent 安全模型
- [GitHub Copilot 强化指南](docs/hardening/github-copilot.md) -- 4 种模式,5 个 CVE
- [Aider 强化指南](docs/hardening/aider.md) -- 无 sandbox,但攻击面极小
- [凭证管理](docs/credential-management.md) -- 为什么环境变量会失败,以及代理架构
- [测试与检测](docs/testing.md) -- Canary tokens、蜜罐、事件响应
- [参考资料](docs/references.md) -- 64+ 精选安全资源
## 为什么会有这个项目
在 2026 年 4 月,三个 AI 编程 Agent 因一次单一的 prompt injection 泄露了机密信息。
我们遇到了同样的问题,提交了 issue,构建了解决方案,并记录了所有内容。
我们调查中的关键 issue:
- [anthropics/claude-code#52471](https://github.com/anthropics/claude-code/issues/52471) -- Sandbox 阻止了凭证管理器
## 贡献
添加新的 Agent 模块:创建 `lib/agents/your-agent.js` 并实现标准
接口(detect, harden, audit)。请参阅 [lib/agents/cursor.js](lib/agents/cursor.js)
作为模板。
## 许可证
[MIT](LICENSE)
标签:Aider, AI安全, AI编码助手, Chat Copilot, CISA项目, Claude, CLI, Cline, Codex CLI, Continue.dev, Cursor, CVE检测, DLL 劫持, .env文件保护, GitHub Advanced Security, GNU通用公共许可证, Hook, LLM, MITM代理, Node.js, npm, npx, StruQ, Unmanaged PE, WiFi技术, Windsurf, 人工智能, 依赖安全, 大语言模型, 威胁情报, 子域名变形, 安全加固, 安全基线, 安全评分, 开发者工具, 教学环境, 数据可视化, 无线安全, 暗色界面, 沙箱, 漏洞防护, 独立开发者, 用户模式Hook绕过, 结构化查询, 自动化安全, 自定义脚本, 规则过滤, 防御指南