Issue #2: 【Config】引入全局 policy.yaml(禁止自动高危操作)#18
Open
alijiujiu123 wants to merge 1 commit intomainfrom
Open
Conversation
- 创建 agent/config/policy.yaml,包含 10+ 种危险命令黑名单 - 实现 Policy Checker (agent/core/policy.ts) - 支持危险命令检查和拦截 - 支持人工确认机制 - 支持执行限制(成本、次数、延迟) - 支持灵活的 YAML 配置 - 支持多种通知渠道 - 添加完整的单元测试(25 个测试,100% 通过率) - 添加集成示例和使用文档 - 验收标准: ✅ policy.yaml 包含 10+ 种危险命令模式 ✅ Policy Checker 能拦截黑名单操作 ✅ 高风险操作需要人工确认机制 ✅ 测试覆盖率达到 100%(超过 80% 要求) Fixes #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 实现了 Issue #2 的所有要求,创建了全局安全策略配置,防止 Agent 自动执行高危操作。
任务清单
验收标准
新增文件
核心实现
测试和文档
配置文件
功能特性
危险命令黑名单: 自动识别并阻止 20+ 种危险命令模式
人工确认机制: 高风险操作需要人工批准
执行限制: 支持成本、次数、延迟等多维度限制
灵活配置: 通过 YAML 文件自定义策略
警告系统: 对中等风险操作发出警告
统计追踪: 记录执行历史和成本
测试结果
使用示例
基本使用
集成到 Skill
依赖关系
参考文档
Fixes #2