Files
aria2bot/.env.example
dnslin bf4fdf1377 fix: 修复安全漏洞和代码质量问题
安全修复:
- 修复路径遍历检查,使用 Path.relative_to() 替代字符串前缀检查
- 修复 Zip Slip 漏洞,添加符号链接检查和路径验证
- 隐藏 RPC 密钥显示,防止敏感信息泄露
- 设置配置文件权限为 0o600

Bug 修复:
- 修复 HTTP 状态码检查(resp.status → resp.code)
- 修复 OneDrive 认证 flow 参数类型
- 修复 RPC 请求缺少状态码验证
- 修复配置文件渲染会替换注释行的问题

代码改进:
- 添加 subprocess 超时处理,防止进程挂起
- 修复异步代码问题(get_event_loop → get_running_loop)
- 使用 asyncio.to_thread 避免阻塞事件循环
- 添加 httpx 超时和状态码异常处理
- 移除无用的 ONEDRIVE_CLIENT_SECRET 配置

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 16:42:48 +08:00

37 lines
1.2 KiB
Plaintext
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.
# Telegram Bot Token (required)
TELEGRAM_BOT_TOKEN=
# 允许使用 Bot 的用户 ID 列表(逗号分隔,必须配置,否则拒绝所有用户)
# 获取用户 ID向 @userinfobot 发送消息
ALLOWED_USERS=
# Custom Telegram Bot API URL (optional, for self-hosted API)
TELEGRAM_API_BASE_URL=
# Aria2 RPC Port (default: 6800)
ARIA2_RPC_PORT=6800
# Aria2 RPC Secret (optional, auto-generated if empty)
ARIA2_RPC_SECRET=
# ==================== OneDrive 配置 ====================
# 启用 OneDrive 云存储功能
ONEDRIVE_ENABLED=false
# Microsoft Azure 应用凭证(使用公共客户端认证,不需要 client_secret
# 在 Azure Portal 创建应用https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
# 需要添加 API 权限Files.ReadWrite, offline_access
# 注意:应用类型选择"公共客户端/本机",不需要配置客户端密码
ONEDRIVE_CLIENT_ID=
# 租户 ID个人账户使用 common组织账户使用具体租户 ID
ONEDRIVE_TENANT_ID=common
# 下载完成后自动上传到 OneDrive
ONEDRIVE_AUTO_UPLOAD=false
# 上传完成后删除本地文件
ONEDRIVE_DELETE_AFTER_UPLOAD=false
# OneDrive 远程存储路径
ONEDRIVE_REMOTE_PATH=/aria2bot