Your Name
|
3c3b7abda5
|
feat: rm/cp/mv/chmod/chown 等文件操作命令支持(需人工审批)
- SHELL_WRITE_COMMANDS 新增 rm cp mv chmod chown mkdir touch ln
所有文件操作命令任意参数都需人工审批
- _PIPE_DANGEROUS_TARGETS 移除 rm mv chmod chown,它们现在在
写白名单中审批执行,不再直接拒绝
- 管道分支增加写表子命令不匹配时的回退处理
|
2026-07-25 14:42:30 +08:00 |
|
Your Name
|
8852e6d0ca
|
fix: 允许 AI Agent 使用管道(|)和重定向(>)进行精准排查
之前禁止所有 shell 操作符,导致 crictl ps -a|tail / df -h | grep vda
这类常用诊断管道无法使用。
改动:
1. FORBIDDEN_TOKENS 移除了 | > >> $,保留 ; || && < << `
2. 新增 _has_shell_operators() 检测命令是否需要 shell 执行
3. 新增 _pipe_to_dangerous_target() 阻止管道后执行 sh/bash/rm 等危险命令
4. classify_shell_command 对含管道命令: 只检查管道前 binary 白名单,
子命令不做限制(管道后工具多样,精确分类无意义)
5. execute_command 对 needs_shell=True 的命令用 create_subprocess_shell 执行
6. AI Prompt 第1条安全规则改为允许管道和重定向
7. 分号仍然禁止;cat 不安全路径检查对管道场景同样生效
|
2026-07-25 14:40:12 +08:00 |
|
Your Name
|
a5399bd69d
|
chore: 移除不存在的 etcdutl 命令及其相关逻辑和测试
|
2026-07-25 14:23:04 +08:00 |
|
Your Name
|
4b54e49a0d
|
feat: 扩充 shell 命令白名单(含 containerd/ctr/nerdctl),解除 AI Agent 轮数上限
- 新增 ~50 个 Linux 基础命令(du/top/iostat/sar/curl/tcpdump 等)
- 新增 containerd 系列: ctr (containers/images/tasks/snapshots),
nerdctl (ps/logs/inspect/stats 等)
- ip 命令补充 maddr/monitor/tunnel/tuntap 只读操作
- _run_agent_loop 改为 while True 循环,max_steps=0 表示不限轮数
- main.py 传入 max_steps=0,AI Agent 持续诊断直到问题解决
- 更新 Agent system prompt 第7条:明确无轮数上限
|
2026-07-25 14:17:56 +08:00 |
|
cnbugs
|
1f37cd3268
|
fix: etcdutl snapshot 未知子命令应拒绝而非默认当写
修复验证中发现的安全漏洞:
- etcdutl snapshot <bogus> 原会默认返回 write (需审批),
现改为显式拒绝 (ValueError)
- 新增 _ETCDUTL_SNAPSHOT_WRITE = {restore, make} 显式枚举写子命令
- 同时补充 etcdctl defrag 为写操作 (需审批)
验证: 65 项 ad-hoc 检查全部通过, 56 个单元测试通过
|
2026-07-25 13:52:19 +08:00 |
|
cnbugs
|
4f37c65f18
|
feat: Agent 支持 etcdctl/etcdutl 诊断命令
etcd 是 K8S 控制平面的关键组件,缺少 etcd 诊断会导致很多故障无法
继续排查。本次将 etcdctl 和 etcdutl 纳入命令白名单:
只读 (自动执行):
- etcdctl endpoint status/health/hashkv - 端点健康
- etcdctl member list - 成员列表
- etcdctl alarm list - 告警
- etcdctl auth/user/role status|list - 认证与权限查看
- etcdctl check perf/datascale - 性能检查
- etcdctl get/watch - 读取 key
- etcdctl version
- etcdutl snapshot status/hash - 快照检查
- etcdutl version
写操作 (人工审批):
- etcdctl put/del/compact/txn - 数据修改
- etcdctl snapshot save - 保存快照
- etcdctl member add/remove/update - 成员管理
- etcdctl alarm disarm - 解除告警
- etcdctl auth enable/disable - 认证开关
- etcdctl user/role add/delete/grant/revoke - 权限管理
- etcdutl snapshot restore - 恢复快照
实现细节:
- etcdctl/etcdutl 命令支持全局 flag (--endpoints/--cacert 等在子命令前)
- 两段式命令按 (verb, subverb) 组合精确分类,避免 member list (只读)
和 member remove (写) 混淆
- 新增 12 个 etcd 命令分类测试,全部 56 个测试通过
|
2026-07-25 13:50:34 +08:00 |
|
cnbugs
|
32bea0d4ea
|
feat: AI 诊断 Agent 支持执行系统诊断 shell 命令
扩展 Agent 命令工具,除 kubectl 外新增节点宿主机系统诊断命令支持:
- agent_tools.py: 新增 shell 命令白名单分类器 (classify_shell_command)
- 只读白名单: systemctl status/is-active、journalctl、crictl ps/logs、
docker ps/logs、df、free、ss、ip addr、ps、mount、lsmod、dmesg、
ping、nslookup、cat (限 /proc /sys /etc/kubernetes 等安全路径) 等 30+ 命令
- 写白名单: systemctl restart/stop/start/reload 等需人工审批
- 统一分发器 classify_agent_command 按命令前缀路由
- 统一执行入口 execute_command 走 subprocess_exec (无 shell 注入风险)
- ai_agent.py: 更新 AGENT_SYSTEM_PROMPT 告知 AI 两类可用工具及安全规则
- 三个调用点 (初始探测/分类/执行) 切换到统一接口
- main.py: 审批执行处改用 execute_command
- tests: 新增 19 个用例覆盖 shell 命令分类、混合执行、白名单拒绝
- 全部 44 个测试通过
- 前端/README: 文案与文档补充 shell 命令支持说明
安全策略不变: 禁止 shell 操作符/管道/重定向/多命令拼接,
非白名单命令 (rm/vi/apt 等) 直接拒绝。
|
2026-07-25 13:38:48 +08:00 |
|
cnbugs
|
f2254646c1
|
fix: 实现 Agent 修复验证闭环
|
2026-07-25 13:10:21 +08:00 |
|
cnbugs
|
4f3a7833a0
|
feat: 增加 AI Agent 自主诊断执行模式
|
2026-07-25 12:21:54 +08:00 |
|