Commit Graph

4 Commits

Author SHA1 Message Date
8095307d82 fix: P0/P1 security and quality fixes
P0-01: Add ESCAPE clause to LIKE queries in operation_log.go and device.go
P0-02: Add atomic Increment to L1Cache and L2Cache interfaces
P0-07: Add TOTP verification step after password login
P1-01: Sanitize error messages in error.go middleware
P1-03: Remove err.Error() from export error messages
P1-04: Add error return to CountByResultSince in login_log.go
P1-05: Add transactional DeleteCascade to RoleRepository
P1-06: Add PasswordChangedAt tracking for JWT token invalidation
P1-07: Wrap theme SetDefault in database transaction
P1-08: Use config values for database pool parameters
P1-09: Add rows.Err() checks in social_account_repo.go
P1-10: Validate sortOrder with map in user.go ORDER BY
P1-11: Add GORM tags to Announcement struct
P1-15: Add pageSize upper limit (100) to device and log handlers
2026-04-18 15:33:12 +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
d73837e5ef test: add comprehensive JWT coverage tests
Added tests for JWT token operations:
- TestGenerateAccessToken_Success
- TestGenerateRefreshToken_Success
- TestGenerateTokenPair_Success
- TestGenerateTokenPairWithRemember_Success
- TestValidateAccessToken_WrongType
- TestValidateRefreshToken_WrongType
- TestValidateAccessToken_InvalidToken
- TestGetAccessTokenExpire
- TestGetRefreshTokenExpire
- TestParseToken_Invalid
- TestGenerateLongLivedRefreshToken_Success
- TestParseRSAPrivateKey_InvalidPEM
- TestParseRSAPublicKey_InvalidPEM
- TestGenerateAndPersistRSAKeyPair_EmptyPath
- TestRefreshAccessToken_Success
- TestRefreshAccessToken_InvalidRefreshToken
- TestRefreshAccessToken_AccessTokenProvided

auth module coverage: 23.8% → 52.5%
Key functions now at 100%: ValidateAccessToken, ValidateRefreshToken, RefreshAccessToken, GetAccessTokenExpire, GetRefreshTokenExpire
2026-04-09 09:55:55 +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