Commit Graph

5 Commits

Author SHA1 Message Date
8665c97d0d fix(security): X-Forwarded-For IP 伪造防护
- isTrustedProxy: 空可信代理列表时默认不信任(安全优先)
- realIP: 修正 XFF 遍历逻辑,从右到左跳过可信代理,返回第一个不可信的客户端 IP
- GetClientIP: 优先读取 IPFilterMiddleware 已验证的 client_ip,避免直接信任转发头
2026-05-08 10:35:20 +08:00
582ad7a069 test: add comprehensive test coverage and improve code quality
- Add new test files for auth, service, and handler modules
- Improve test organization and coverage
- Refactor code for better maintainability
- Add captcha, settings, stats, and theme handler tests
- Add auth module tests (CAS, OAuth, password, SSO, state)
- Add service layer tests for auth, export, permissions, roles
- All Go tests pass (exit code 0)
- All frontend tests pass (325 tests in 59 files)
2026-04-17 20:43:50 +08:00
12a5be9826 fix: suppress gosec G115/G118 false positive warnings
- G115 (integer overflow): Added nosec comments for safe type conversions
  where values are bounded by design (e.g., rng.Intn(255) returns 0-254)
- G118 (context.Background): Added nosec for intentional async goroutines
  that use WithTimeout for bounded execution after request completes

Note: G101 (hardcoded credentials) warnings are low-confidence false
positives - OAuth fields use getEnv() to read from environment.
2026-04-08 22:50:42 +08:00
5dbb530b76 chore: 删除未使用的孤立包
清理以下未导入的包:
- internal/response (未使用的响应结构体)
- pkg/response (未使用的响应封装)
- internal/model (TLSFingerprintProfile, ErrorPassthroughRule)
- internal/models (SocialAccount, domain已有)
- internal/pkg/response (未使用的响应封装)
- internal/security/ratelimit (已迁移到middleware)

验证: go build ./... && go test ./... 通过
2026-04-07 17:46:25 +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