TBC/.env.example
D-Robotics 637b1026df release: v1.2.0 - 安全加固与性能优化
Security:
- 添加 API 认证中间件 (PLATFORM_API_TOKEN Bearer Token)
- SSRF 防护: 校验 git URL scheme + 过滤内网 IP
- 路径遍历修复: module 参数添加 is_relative_to 校验
- 异常信息泄露修复: 统一错误处理不返回内部信息
- API Key 不持久化到数据库
- 硬编码 SSH Key 移至环境变量
- CORS 生产环境校验

Rate Limiting:
- 新增内存滑动窗口速率限制 (6个POST端点)

Performance:
- ThreadPoolExecutor(max_workers=4) 限制并发
- 任务超时 _enforce_proc_timeout (默认3600s)
- JSON 原子写入 tempfile+os.replace
- 日志轮转 RotatingFileHandler
- httpx 连接池配置
- 随机名改用 uuid4
- 前端 Error Boundary
- 前端统一 EventSource 使用

Docs:
- 更新 .env.example, CHANGELOG, API.md, CONFIG.md, AGENTS.md
- .gitignore 添加 .venv/ 和 backend/db.json
2026-07-16 15:00:05 +08:00

38 lines
1.3 KiB
Plaintext
Raw Permalink 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.

# ===========================================
# LLM API 配置
# ===========================================
DEEPSEEK_API_KEY=sk-your-api-key-here
OPENAI_API_KEY=sk-your-api-key-here
OPENAI_BASE_URL=https://ai-api.d-robotics.cc/v1
# ===========================================
# 测试平台登录凭证
# ===========================================
TEST_USERNAME=your_username
TEST_PASSWORD=your_password
# ===========================================
# 后端安全配置(生产环境必须设置)
# ===========================================
# API 认证 Token(设置后所有 API 请求需携带 Authorization: Bearer <token>)
# 留空则关闭认证(仅开发模式推荐)
PLATFORM_API_TOKEN=
# Flask 运行环境(development / production)
FLASK_ENV=development
# CORS 允许的来源(逗号分隔,生产环境必须设置)
CORS_ORIGINS=http://localhost:5174,http://127.0.0.1:5174,http://localhost:5002
# ===========================================
# 任务执行配置
# ===========================================
# 单个任务最大运行时间(秒,默认 3600)
TASK_TIMEOUT_SECONDS=3600
# ===========================================
# SSH Key(从源码硬编码迁移至环境变量)
# ===========================================
SSH_PUBLIC_KEY=
DM_SSH_KEY=