Commit Graph

3 Commits

Author SHA1 Message Date
b77412b47f test: 增强 handler/middleware 测试覆盖并优化错误分类
测试增强:
- handler_test.go: 大幅增强 handler 集成测试(+1284/-98 行)
- theme_handler_test.go: 增强主题管理测试(+174/-22 行)
- auth_bootstrap_test.go: 新增 bootstrap 认证测试(+329 行)
- ratelimit_test.go: 新增限流中间件测试(+153 行)
- runtime_test.go: 新增运行时中间件测试(+351 行)

错误处理:
- auth_handler.go: classifyErrorMessage 增加 TOTP 错误码和 2FA 状态字分类

清理:
- 删除覆盖率报告残留文件(coverage_issue, handler, middleware 等)
- 归档 docs/superpowers/plans/2026-05-09-middleware-test-backfill-phase1.md
2026-05-10 13:46:29 +08:00
8665c97d0d fix(security): X-Forwarded-For IP 伪造防护
- isTrustedProxy: 空可信代理列表时默认不信任(安全优先)
- realIP: 修正 XFF 遍历逻辑,从右到左跳过可信代理,返回第一个不可信的客户端 IP
- GetClientIP: 优先读取 IPFilterMiddleware 已验证的 client_ip,避免直接信任转发头
2026-05-08 10:35:20 +08:00
dcc1f186f8 feat: backend core - auth, user, role, permission, device, webhook, monitoring, cache, repository, service, middleware, API handlers 2026-04-02 11:19:50 +08:00