OpenClaw Security Guard
The missing security layer for your OpenClaw installation.
Audit. Monitor. Protect. All from one tool.
Quick Start • Why This Tool • Features • Dashboard • CLI • Contributing
Built by Miloud Belarebia at 2PiData — for the OpenClaw community.
______________________________________________________________________
问题
您安装了OpenClaw。它工作得很好。但问问自己:
- 你是 暴露的API密钥 配置文件或技能?
- 就是你 沙盒模式 正确配置?
- 做你的 MCP服务器 来自经过验证的来源?
- 能吗 提示注入 隐藏在工作区文件中?
- 你是 npm依赖关系 没有已知的漏洞?
如果你不确定,你需要这个工具。
______________________________________________________________________
快速开始
# Install globally
npm install -g openclaw-security-guard
# Run your first audit
openclaw-guard audit
# Fix issues automatically
openclaw-guard fix --auto
# Launch the live dashboard
openclaw-guard dashboard30秒。 这就是了解你的安全态势所需要的一切。
______________________________________________________________________
为什么是保安?
OpenClaw生态系统中还有其他安全工具。以下是它们的比较:
内置 security audit | ClawSec | OpenClaw盾牌 | 保安 | |
|---|---|---|---|---|
| 机密扫描(API密钥、令牌) | 基本 | 是 | 是 | 15+格式+熵 |
| 配置强化和自动修复 | 否 | 部分 | 部分 | 全自动修复,3种模式 |
| 快速注射检测 | 否 | 否 | 基本 | 50+图案 |
| MCP服务器验证 | 否 | 否 | 无 | 基于允许列表 |
| npm依赖扫描 | 否 | 否 | 不 | 是 |
| 实时网络仪表板 | 否 | 否 | 不 | 实时评分 |
| API成本监控 | 否 | 否 | 无 | 每日/每月 |
| 预提交挂钩 | 否 | 否 | 不 | 是 |
| 多语言(EN/FR/AR) | 否 | 否 | 无 | 是 |
| 保证零遥测 | 未知 | 未知 | 100%本地 |
保安不会取代这些工具。它填补了他们留下的空白。
______________________________________________________________________
所得
5个应用程序扫描仪+基础设施模块
| 扫描仪 | 它能捕捉到什么 |
|---|---|
| 秘密扫描仪 | API密钥、令牌、密码、私钥、webhook URL。使用模式匹配+Shannon熵分析。 |
| 配置审计员 | 弱沙盒模式、开放DM策略、公共网关绑定、禁用速率限制、模式风险升高。 |
| 快速注射检测器 | 50多种模式:指令重写、角色劫持、数据泄露、分隔符操作、越狱尝试。 |
| 依赖性扫描程序 | npm依赖树中的已知CVE。 |
| MCP服务器审计员 | 未经验证的MCP服务器不在社区列表中。 |
基础设施安全(选择加入)
对于生产部署,请添加 --infra 扫描您的服务器:
openclaw-guard audit --infra| 扫描仪 | 它检查什么 |
|---|---|
| 网络安全 | 防火墙状态(UFW/firewalld/macOS)、公共端口暴露、网关绑定到0.0.0.0 vs 127.0.0.1 |
| SSH访问控制 | 密码验证、root登录、fail2ban状态、登录尝试失败(24小时) |
| 系统强化 | 安全更新可用,配置文件权限(600 vs 777),无人值守升级 |
| TLS/证书 | 反向代理(Caddy/Nginx)、Tailscale/WireGuard VPN状态 |
| 资源安全性 | 磁盘使用情况(DoS风险>90%)、内存使用情况监控 |
infra模块捕获应用程序扫描遗漏的内容:
- 应用评分为85/100,但网关已打开
0.0.0.0启用SSH密码身份验证=实际上易受攻击 - 随着
--infra,综合得分反映了真实情况
自动淬火
三种模式以您的方式解决问题:
openclaw-guard fix # Interactive: review each fix
openclaw-guard fix --auto # Automatic: fix everything, backup first
openclaw-guard fix --dry-run # Preview: see what would change每次修复都会创建一个带时间戳的备份。没有什么是不可逆转的。
安全评分(0-100)
一个数字告诉你的立场:
| 分数 | 含义 |
|---|---|
| 80-100 | 你身体很好。 |
| 60-79 | 一些需要审查的问题。 |
| 60以下 | 现在需要采取行动。 |
扣除:关键发现=-10,高=-5,中=-2。沙盒关闭=-20。开放DM策略=-15。
______________________________________________________________________
实时仪表板
openclaw-guard dashboard在以下位置打开受密码保护的web仪表板 http://localhost:18790 与:
- 实时安全评分 检测到威胁时进行更新
- 请求监控 每分钟请求跟踪
- 成本跟踪 API使用(每日/每月限额)
- 威胁源 显示及时的注入尝试、被阻止的请求、速率限制点击
- 配置概述 一目了然
仪表板运行 localhost 仅使用PBKDF2密码散列(10万次迭代,SHA-512),并通过WebSocket连接到您的OpenClaw网关。
______________________________________________________________________
CLI参考
| 命令 | 描述 |
|---|---|
openclaw-guard audit | 全面安全审计 |
openclaw-guard audit --deep | 深度扫描与熵分析 |
openclaw-guard audit --quick | 快速扫描,跳过高级检查 |
openclaw-guard audit --infra | 包括基础设施扫描(网络、SSH、系统) |
openclaw-guard audit --ci | CI模式(关键问题退出代码1) |
openclaw-guard fix | 交互式修复模式 |
openclaw-guard fix --auto | 自动修复并备份 |
openclaw-guard fix --dry-run | 预览修复而不应用 |
openclaw-guard dashboard | 启动实时仪表板 |
openclaw-guard dashboard -p 3000 | 自定义端口 |
openclaw-guard scan secrets | 仅扫描机密 |
openclaw-guard scan config | 仅审核配置 |
openclaw-guard scan prompts | 仅检测快速注射 |
openclaw-guard report -f html | 生成HTML报告 |
openclaw-guard report -f json | 生成JSON报告 |
openclaw-guard hooks install | 安装预提交挂钩 |
openclaw-guard hooks status | 检查挂钩状态 |
全局选项
| 选项 | 描述 |
|---|---|
| `-c, --config | |
| ` | 自定义配置文件路径 |
-l, --lang | 语言: en, fr, ar |
-v, --verbose | 详细输出 |
-q, --quiet | 无横幅 |
______________________________________________________________________
配置
创建 .openclaw-guard.json 在项目根目录或主目录中:
{
"scanners": {
"secrets": {
"enabled": true,
"exclude": ["*.test.js", "node_modules/**"]
},
"config": {
"enabled": true,
"strict": true
},
"prompts": {
"enabled": true,
"sensitivity": "high"
},
"mcpServers": {
"allowlist": [
"mcp-server-filesystem",
"mcp-server-fetch",
"mcp-server-memory",
"mcp-server-sqlite",
"mcp-server-git",
"mcp-server-github"
],
"blockUnknown": false
}
},
"monitors": {
"cost": {
"dailyLimit": 10,
"monthlyLimit": 100
}
},
"dashboard": {
"port": 18790
}
}______________________________________________________________________
程序化API
在您自己的项目中使用Security Guard作为库:
import { quickAudit, checkPromptInjection } from 'openclaw-security-guard';
// Full audit
const results = await quickAudit('~/.openclaw');
console.log(`Score: ${results.securityScore}/100`);
console.log(`Critical: ${results.summary.critical}`);
// Check a message for injection
const check = await checkPromptInjection('ignore all previous instructions');
console.log(check.safe); // false// Individual scanners
import { SecretsScanner, ConfigAuditor, McpServerAuditor } from 'openclaw-security-guard';
const scanner = new SecretsScanner({});
const result = await scanner.scan('/path/to/openclaw');______________________________________________________________________
隐私和安全
这是一个安全工具。它本身应该是安全的。以下是承诺:
| 遥测 | 没有。零。 |
| 网络请求 | 无(本地WebSocket到网关除外) |
| 数据收集 | 没有 |
| 云依赖性 | 没有 |
| 仪表板访问 | localhost 仅限,密码保护 |
| 密码存储 | PBKDF2,10万次迭代,SHA-512 |
| 输入验证 | Zod模式无处不在 |
| 报告生成 | XSS安全,路径遍历安全 |
看 安全.md 完整的安全策略。
______________________________________________________________________
文档
______________________________________________________________________
贡献
PR欢迎。看 贡献.md.
git clone https://github.com/2pidata/openclaw-security-guard.git
cd openclaw-security-guard
npm install
npm test # 25 tests, 0 warnings______________________________________________________________________
许可证
______________________________________________________________________
Created by Miloud Belarebia at 2PiData
Inspired by detect-secrets, trivy, and OWASP.
If this tool helps you, leave a star. It helps others find it too.
github.com/2pidata/openclaw-security-guard
Report a bug • Request a feature • 2pidata.com
