@wd041216-bit/openclaw-ironclaw-security-guard
v0.3.0
Published
Defense-in-depth OpenClaw security plugin for dangerous-command blocking, prompt-injection detection, secret redaction, and audit logging.
Downloads
224
Maintainers
Readme
OpenClaw IronClaw Security Guard
给 OpenClaw 加上一层更偏企业可治理的防御:拦危险调用、识别 prompt injection、发送前脱敏,并留下带规则标识的审计日志。
English README: README.md
这个插件解决什么问题
在开源模型、本地工具和自动化 agent 工作流里,最常见的风险通常是:
- 危险 shell 命令过早执行
- 敏感路径或凭据被带进工具参数
- 外部内容试图劫持系统行为
- agent 把 token、密钥或私密信息发到外部
ironclaw-security-guard 通过 OpenClaw 的插件 hook 层增加防护,而不是假装自己是完整沙箱。
现在这层插件已经建立在通用安全核心 ironclaw-agent-guard 之上,OpenClaw 专属的 hook、prompt guidance 和审计行为则继续保留在这个适配仓库里。
企业级强化点
- 支持
policyPreset,可在developer-local、enterprise-default、regulated之间切换 - 扫描结果现在稳定输出
allow | review | block - 审计日志会保留 rule IDs 和 remediation 信息
- OpenClaw 适配层只保留 hook 和插件集成逻辑,不再复制核心检测引擎
它会做什么
- 拦截高风险 shell 命令
- 保护敏感路径
- 识别 prompt injection 模式
- 阻止向外部发送明显的 secret
- 在消息发送前自动脱敏
- 记录 JSONL 审计日志
- 提供手动检查工具
ironclaw_security_scan
快速安装
把仓库路径加入 OpenClaw 的 plugins.load.paths,允许 ironclaw-security-guard,再在 plugins.entries 里启用。
可直接复制的配置例子见 examples/openclaw-config.example.json。
为社区发布准备的 npm 包名:
@wd041216-bit/openclaw-ironclaw-security-guard60 秒验证
先跑一轮轻量回归:
npm test再跑一次手动安全扫描示例:
node --input-type=module -e "import('./src/config.ts').then(async ({ normalizeSecurityConfig }) => { const { createSecurityScanTool } = await import('./src/tool.ts'); const writes = []; const tool = createSecurityScanTool({ config: normalizeSecurityConfig({}), audit: { write: async (event) => writes.push(event) } }); const result = await tool.execute('demo', { toolName: 'shell', content: 'rm -rf /tmp/demo', redactPreview: true }); console.log(result.content[0].text); })"典型能力
- 拦截
rm -rf、git reset --hard、curl ... | sh等危险模式 - 标记
.env、SSH key、.pypirc、.npmrc、云凭据等敏感路径 - 识别 “ignore previous instructions” 这类注入模式
- 在发消息前把敏感 token 替换成
[REDACTED:...] - 可选地只允许访问 allowlist 中的外部 host
完整示例见 examples/manual-scan-example.md。
配置项
核心配置来自 openclaw.plugin.json:
enabledmonitorOnlypolicyPresetblockDestructiveShellprotectSensitivePathsredactSecretsInMessagesnetworkDenyByDefaultallowedOutboundHostsauditLogPathprotectedPathPatternsblockedCommandPatterns
如果你想把它作为本地 agent 的默认安全兜底,推荐开启外联 allowlist,并保持 monitorOnly=false:
{
"plugins": {
"entries": [
{
"id": "ironclaw-security-guard",
"config": {
"monitorOnly": false,
"networkDenyByDefault": true,
"allowedOutboundHosts": ["localhost", "127.0.0.1"]
}
}
]
}
}设计边界
它受 IronClaw 启发,但不是完整运行时隔离方案。
它适合做:
- 轻量安全兜底
- prompt / tool 参数层面的前置扫描
- agent 工作流里的防误操作保护
它不负责:
- 提供 WASM sandbox
- 容器级隔离
- 替代系统级安全控制
