← 返回
开发者工具 中文

DCG Guard

Hard-blocks dangerous shell commands (rm -rf, git push --force, etc.) before execution via OpenClaw's before_tool_call plugin hook. Zero noise on safe comman...
通过 OpenClaw 的 before_tool_call 插件钩子在执行前硬拦截危险 Shell 命令(如 rm -rf、git push --force 等),对安全命令零干扰。
starensen starensen 来源
开发者工具 clawhub v1.1.0 1 版本 99918.2 Key: 无需
★ 0
Stars
📥 1,222
下载
💾 10
安装
1
版本
#latest

概述

DCG Guard

An OpenClaw plugin that hard-blocks dangerous shell commands before they execute. Works on any OpenClaw installation (Windows, macOS, Linux, local, VPS, anywhere). No binary dependencies required.

What It Does

Intercepts every exec/bash tool call via OpenClaw's before_tool_call plugin event. Pipes the command through DCG (Dangerous Command Guard). Safe commands pass silently with zero overhead. Dangerous commands are blocked before execution.

Blocked (Unix): rm -rf ~, git push --force, git reset --hard, git clean -fd, git branch -D

Blocked (Windows): Remove-Item -Recurse -Force, rd /s /q, del /s, Format-Volume, reg delete HKLM

Allowed: ls, cat, echo, git status, npm install, dir, Get-ChildItem

Install

# After clawhub install dcg-guard:
bash install.sh

Or manually:

# 1. Install DCG binary
curl -sSL https://raw.githubusercontent.com/Dicklesworthstone/destructive_command_guard/master/install.sh | bash

# 2. Link plugin into OpenClaw
openclaw plugins install -l /path/to/dcg-guard
openclaw gateway restart

How It Works

  1. Agent calls exec with a command
  2. Plugin intercepts via before_tool_call (runs before execution)
  3. Command is checked against built-in rules (cross-platform, <1ms, no subprocess)
  4. If no built-in match and DCG binary is installed, command is piped to DCG (~27ms)
  5. Safe: silent passthrough, agent never knows the plugin exists
  6. Dangerous: { block: true } returned to OpenClaw, command never executes

v1.1.0: Built-in rules work without the DCG binary. DCG binary is optional (adds extra unix rules). Windows fully supported out of the box.

Security

  • No shell interpolation. Commands are passed to DCG via stdin using execFileSync (not execSync). No injection risk.
  • Fail-open. If DCG binary is missing or crashes, commands pass through. The plugin never deadlocks your agent.
  • Zero dependencies. Only requires the DCG binary (single Go binary, no runtime deps).

Configuration

Optional, in openclaw.json under plugins.entries.dcg-guard.config:

{
  "enabled": true,
  "dcgBin": "/custom/path/to/dcg"
}

Default DCG path: ~/.local/bin/dcg

Override with env var: DCG_BIN=/path/to/dcg

Agent Instructions (optional)

Add to your workspace AGENTS.md:

When a command is blocked by DCG Guard, do NOT retry it.
Ask the user for explicit permission before attempting any alternative.
The block exists because the command is destructive or irreversible.

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-03-29 06:59 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

Tmux

steipete
通过发送按键和抓取窗格输出,远程控制交互式 CLI 的 tmux 会话。
★ 45 📥 29,370
it-ops-security

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 31,433
it-ops-security

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,832