Security
构建权限与安全系统 — 审批模式、规则引擎、风险评分、Hook、分类器From its SKILL.md
npx -y skills add dongliutony/myagent-skill --skill securityAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.3 KB, as published. Nobody here has run it
权限与安全设计
你在解决什么问题
构建 Agent 的安全边界:谁能做什么、何时自动执行、何时需要人工审批。
参考实现 Snippets
snippets/security/permission-decision-cascade.ts— 六阶段决策级联 + 拒绝跟踪 + 规则匹配snippets/security/hook-system.ts— PreToolUse/PostToolUse Hook + 原子注册snippets/security/filesystem-guard.ts— 受保护文件/目录 + 遍历防护 + 风险评分
设计检查清单
- 至少 4 种权限模式(default/acceptEdits/bypass/plan)
- 规则格式
toolName(ruleContent)+ 8 种来源优先级 - 六阶段决策:规则→模式→快速路径→白名单→分类器→用户
- 三级风险(LOW/MEDIUM/HIGH)+ 颜色
- 受保护文件/目录白名单 + 路径遍历防护
- Hook 可审批/阻止/修改输入输出
- Hook 原子注册(clear-then-register)
常见错误
| 错误 | 后果 | 正确做法 |
|---|---|---|
| 默认 allow all | 安全漏洞 | 默认 ask |
| 分类器阻塞 UI | 用户等待 | 异步非阻塞 |
| 无路径遍历检查 | 读写系统文件 | 拒绝 .. + UNC |
| Hook 无超时 | 挂起 | 配置超时 + abort |