← 返回
未分类

安全工具执行器

安全工具执行器 — 通过分层访问控制强制最低权限执行。 使用场景:(1) 执行具有破坏潜力的工具,(2) 执行前验证工具安全性,(3) 危险操作需要人工审批,(4) 防止不安全的文件删除。
安全工具执行器:分层访问控制,强制最低权限执行。适用场景:执行高危工具、验证工具安全、人工审批危险操作、防止不安全删除。
kofna3369 kofna3369 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 337
下载
💾 0
安装
1
版本
#latest

概述

安全工具执行器

通过分层访问控制和危险操作人工审批强制安全工具执行。

问题:不安全的工具使用

症状:
├── 工具权限过高
├── 破坏性操作未被检测
├── 删除重要数据
└── 看门狗警告不够严重

解决方案

1. 最低权限原则

class SafeToolExecutor:
    tool_tiers = {
        '只读': ['ls', 'cat', 'head', 'tail', 'grep'],
        '写入': ['write', 'edit', 'mkdir', 'touch'],
        '删除': ['rm', 'rmdir', 'unlink']
    }
    
    required_approval = ['DELETE', 'DROP', 'TRUNCATE', 'FORMAT']

2. 审批工作流

def execute_dangerous_tool(action, tool, args):
    if tool in required_approval:
        request_human_approval(f"危险: {tool} {args}")
        wait_for_approval(timeout=60)
        if not approved:
            return {'status': 'BLOCKED', 'reason': 'No approval'}
    return execute_tool(tool, args)

3. 分层分离

def validate_tool_access(tool, operation):
    # 只读工具不能写入
    if operation == 'WRITE' and tool in tool_tiers['只读']:
        return False
    # 删除工具默认需要审批
    if tool in tool_tiers['删除']:
        return require_approval(tool)
    return True

看门狗

看门狗角色阈值
--------------------
VLS逻辑验证>0.700 = 阻止
ABS架构任何删除 = 审批
STC紧张度>0.600 = 警告

使用方法

from safe_tool_executor import SafeToolExecutor

executor = SafeToolExecutor()

# 只读工具 - 直接通过
result = executor.execute('cat', '/etc/passwd')

# 写入工具 - 警告
result = executor.execute('write', '/project/config.py')

# 删除工具 - 无审批则阻止
result = executor.execute('rm', '/important/file.txt')
# → 阻止: 需要人工审批

危险模式(阻止)

模式操作
------------
rm -rf /*阻止 + 警报
DROP TABLE需要审批
TRUNCATE需要审批
DELETE /system审批 + 记录
format完全阻止

前置条件

条件要求检查命令
----------------------
Python>= 3.8python3 --version
VLS 看门狗活跃curl -s http://localhost:6333/collections/vls_watchdog
ABS 看门狗活跃curl -s http://localhost:6333/collections/abs_watchdog
Qdrant运行中curl -s http://localhost:6333/collections

文件结构

safe-tool-executor/
├── SKILL.md
├── scripts/
│   ├── safe_tool_executor.py
│   ├── main.py
│   └── utils.py
├── data/
├── models/
└── tests/

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-21 13:56 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

OpenClaw Backup

alex3alex
备份与恢复 OpenClaw 数据。适用于创建备份、设置自动备份计划、从备份恢复或管理备份轮转。处理 ~/.openclaw 目录归档并包含适当的排除规则。
★ 90 📥 31,094
ai-agent

Hermes Skills

kofna3369
Hermes自我进化技能 — 为 OpenClaw 代理提供记忆管理和技能追踪。适用场景:(1) 在常规对话间隔进行记忆追踪,(2) ...
★ 0 📥 542
it-ops-security

Free Ride - Unlimited free AI

shaivpidadi
管理OpenClaw的OpenRouter免费AI模型,自动按质量排名模型,配置速率限制备用方案,并更新opencla...
★ 472 📥 78,665