企业级安全套件 - 高危操作确认、自动备份、回滚机制、技能安检
版本: 1.0.0
作者: Cloud
适用: OpenClaw Agent / 企业级 / 个人开发者
7 类高危操作前自动提示确认:
修改文件前自动创建备份:
自动记录所有高危操作到 CHANGELOG.md:
支持从备份文件恢复:
安装 skill 前自动检查:
bash
完成! AI 会自动执行安全检查。
激活后,AI 会自动在执行高危操作前调用:
AI 准备修改文件 → 自动调用 confirmHighRisk → 用户确认 → 执行
javascript
const security = require(./skills/enterprise-security);
// 高危操作确认
await security.confirmHighRisk({
operation: modify_file,
file: MEMORY.md,
reason: 更新记忆系统
});
// 自动备份
await security.autoBackup({
filePath: ~/.openclaw/workspace/SOUL.md,
reason: 修改前备份
});
// 技能安检
const result = await security.checkSkill({
skillName: new-skill,
author: community-user,
repository: github.com/user/new-skill
});
if (result.risk === high) {
throw new Error(高风险技能,拒绝安装);
}
// 回滚
await security.rollback({
file: MEMORY.md,
targetVersion: 20260311.001,
reason: 用户要求回滚
});
编辑 config/rules.json:
json
{
highriskoperations: [
modifymdfiles,
install_skills,
restart_gateway,
delete_files,
modify_cron,
modify_env,
sendexternalmessages
],
auto_backup: {
enabled: true,
file_types: [.md, .json, .js, .ts, .py],
maxbackupsper_file: 10
},
changelog: {
enabled: true,
path: memory/CHANGELOG.md
},
security_check: {
enabled: true,
whitelist: [github.com/openclaw]
}
}
高危操作确认
javascript
await security.confirmHighRisk({
operation: modify_file, // 操作类型
file: test.md, // 涉及文件(可选)
reason: 更新配置 // 原因(可选)
});
自动备份
javascript
await security.autoBackup({
filePath: test.md, // 文件路径
reason: 修改前备份 // 原因(可选)
});
技能安装安检
javascript
const result = await security.checkSkill({
skillName: new-skill,
author: user,
repository: github.com/user/skill,
permissions: [read_file],
dependencies: []
});
console.log(result.risk); // low/medium/high
console.log(result.recommendations);
回滚操作
javascript
await security.rollback({
file: test.md, // 文件路径
targetVersion: 20260311.001, // 目标版本
reason: 用户要求回滚 // 原因
});
MIT License
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 enterprise-security-suite-1776155348 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 enterprise-security-suite-1776155348 技能
skillhub install enterprise-security-suite-1776155348
文件大小: 10.28 KB | 发布时间: 2026-4-15 12:40