qwen_agent/.features/skill/decisions/002-security.md
朱潮 63d17d355b feat(skill): add feature memory with changelog and decisions
添加 skill 功能的完整记忆文档:

Changelog:
- 2025-Q4: 初始实现 (GRPC 层 + 内置 skills)
- 2026-Q1: API 完善 (REST API + Hook 系统)

Design Decisions:
- 001: Skill 架构设计 (目录结构、Hook 系统)
- 002: 上传安全措施 (ZipSlip、路径遍历防护)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 12:30:56 +08:00

36 lines
935 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 002: Skill 上传安全措施
## 状态
已采纳 (Accepted)
## 上下文
用户可以上传 ZIP 格式的技能包,需要防范常见的安全攻击。
## 决策
### 安全防护措施
| 威胁 | 防护措施 |
|------|---------|
| ZipSlip 攻击 | 检查每个文件的解压路径 |
| 路径遍历 | 验证 `bot_id``skill_name` 格式 |
| Zip 炸弹 | 压缩比检查(最大 100:1 |
| 磁盘空间滥用 | 上传 50MB解压后最大 500MB |
| 符号链接攻击 | 禁止解压包含符号链接的文件 |
### 限制规则
```python
MAX_UPLOAD_SIZE = 50 * 1024 * 1024 # 50MB
MAX_EXTRACTED_SIZE = 500 * 1024 * 1024 # 500MB
MAX_COMPRESSION_RATIO = 100 # 100:1
```
## 结果
- 完整的上传验证链
- 防止恶意文件攻击
- 资源使用可控
## 替代方案
1. 使用沙箱容器解压(拒绝:复杂度高)
2. 仅允许预定义技能(拒绝:限制用户自定义能力)