13 Commits
Author SHA1 Message Date
胡绍康 d50f01663c feat: finalize pool registration flow and docs 2026-03-17 20:02:21 +08:00
胡绍康 aa01758ad9 feat: add granular release controls and key-based access for external pool 2026-03-16 20:29:35 +08:00
胡绍康 a26079026b fix: clear release quality gates 2026-03-15 09:41:45 +08:00
胡绍康andCopilot 6085ddd926 fix: harden external API guard client IP
Use auth.get_client_ip for whitelist/rate-limit decisions to avoid X-Forwarded-For spoofing. Add tests for trusted-proxy behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 12:42:12 +08:00
胡绍康 01d1dc0874 feat: implement external API security architecture (public mode, IP whitelist, rate limit)
- Add ExternalApiGuard for IP whitelisting, rate limiting, and public mode enforcement
- Update wait-message to support async mode
- Fix bugs in verification code extraction (BUG-00014 to BUG-00017)
- Update documentation and architectural diagrams
2026-03-13 11:27:34 +08:00
胡绍康andCopilot a01b48a813 feat: PRD-00008 P1 公网模式安全层 — 守卫模块、设置 UI、321 测试全绿
- 新增 external_api_guard.py:IP 白名单、限流(SQLite 分钟桶)、高风险端点禁用
- DB v5→v6:新增 external_api_rate_limits 表 + 5 项 P1 默认设置
- 10 个外部 API 端点集成 @external_api_guards() 装饰器
- capabilities 端点增强:public_mode / restricted_features
- settings 控制器 + 前端 UI:公网模式开关、IP 白名单、限流、功能禁用
- 新增 18 个 P1 守卫测试(TC-GUARD-01~18),总计 321 测试全绿
- 更新 api.md:P1 错误码、配置文档
- 默认 public_mode=false,与 P0 行为完全兼容

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-11 22:18:40 +08:00
胡绍康 9673b3524d feat: add external api docs tests and verification updates 2026-03-09 15:07:18 +08:00
胡绍康andClaude Opus 4.6 f7a8817970 style: 使用 Black 和 isort 格式化代码
- 使用 Black 格式化 47 个 Python 文件
- 使用 isort 修复 import 排序
- 修复 Code Quality CI/CD 检查失败问题

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 13:12:16 +08:00
胡绍康andCopilot c70d2b97dd chore: 代码质量修复 + CI升级
- black 格式化 (1 file)
- isort 排序修复 (30 files, --profile black)
- 升级 actions/checkout v4 → v6 (全部 3 个 workflow)
- 添加 pyproject.toml (black/isort 配置)
- isort CI 命令添加 --profile black 参数
- 114 测试全部通过

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-01 21:52:44 +08:00
胡绍康andClaude Opus 4.6 0eb36f5175 style: 运行 Black 格式化所有 Python 代码
- 格式化 66 个 Python 文件以符合 Black 代码风格
- 修复 GitHub Actions Code Quality 工作流失败问题

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:23:57 +08:00
胡绍康andClaude Opus 4.6 5af073caa8 fix: 修复 CSRF token 导入错误并豁免临时邮箱 API
- 在 csrf.py 添加模块级别 generate_csrf() 函数,解决 /api/csrf-token 端点导入错误
- 为临时邮箱 API 路由添加 CSRF 豁免,避免 Session 认证下的 CSRF token 缺失错误
- 重构 temp_emails.py 路由注册逻辑,支持统一应用 csrf_exempt 装饰器

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:56:45 +08:00
胡绍康andClaude Opus 4.6 2aca6d9954 fix: 修复安全问题和错误处理改进
P0 安全修复:
- 添加 IP 信任链验证,防止 X-Forwarded-For 伪造攻击
- 导出验证 token 增加 IP 和 User-Agent 绑定校验
- 改用请求头传递导出 token,避免 URL 泄露

P1 改进:
- 错误响应自动使用正确的 HTTP 状态码(400/500)
- 4xx 错误使用 WARNING 日志级别,5xx 使用 ERROR

P2 文档更新:
- 更新 CLAUDE.md 架构说明,体现 controllers 层
- 添加 TRUSTED_PROXIES 和 PROXY_FIX_ENABLED 配置说明
- 修正登录锁定时长为 5 分钟

P3 工程卫生:
- 清理乱码字符
- 删除意外创建的 nul 文件

测试修复:
- 更新测试以适应新的 HTTP 状态码行为
- 添加测试前清理登录限制记录的逻辑

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:11:33 +08:00
胡绍康andClaude Opus 4.6 192240436d refactor: 模块化架构重构 & 完善测试与文档体系
- 架构重构:拆分为 routes/services/repositories/security 分层结构
- 新增测试:添加完整的单元测试套件(烟雾测试/核心功能/错误处理等)
- 完善文档:添加开发者指南、运行验证、回归清单、性能基线等文档
- 前后端分离:静态资源独立,模板组件化
- CI/CD:添加 GitHub Actions 自动化测试
- Docker 优化:添加健康检查,修复调度器启动问题
- 配置增强:支持 SCHEDULER_AUTOSTART 环境变量

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:54:16 +08:00