|
| 1 | +# Spring User Framework - Issues to Fix |
| 2 | + |
| 3 | +## High-Impact Issues (Priority 1) |
| 4 | + |
| 5 | +### 1. Fix jar artifact naming mismatch ✅ COMPLETED |
| 6 | +- **Issue**: Jar task sets archiveBaseName to 'ds-spring-ai-client' (copy/paste error) |
| 7 | +- **Fix**: Change to 'ds-spring-user-framework' in build.gradle line 109 |
| 8 | +- **Status**: Fixed - changed archiveBaseName to correct value |
| 9 | + |
| 10 | +### 2. Remove transitive runtime dependencies ✅ COMPLETED |
| 11 | +- **Issue**: Library declares runtimeOnly dependencies that surprise consumers |
| 12 | +- **Fix**: Move spring-boot-devtools, mariadb-java-client, postgresql to testRuntimeOnly |
| 13 | +- **Status**: Fixed - moved all runtime dependencies to test scope |
| 14 | + |
| 15 | +### 3. Fix JPA equals/hashCode anti-patterns ✅ COMPLETED |
| 16 | +- **Issue**: Role and Privilege use @Data without excluding relationships (causes stack overflows) |
| 17 | +- **Fix**: Add @EqualsAndHashCode.Exclude to collection fields, base on id only |
| 18 | +- **Status**: Fixed - replaced @Data with explicit @EqualsAndHashCode(onlyExplicitlyIncluded = true) and @EqualsAndHashCode.Include on id fields |
| 19 | + |
| 20 | +### 4. Fix audit log writer concurrency ✅ COMPLETED |
| 21 | +- **Issue**: FileAuditLogWriter and scheduler access shared BufferedWriter without synchronization |
| 22 | +- **Fix**: Add synchronized blocks to protect concurrent access |
| 23 | +- **Status**: Fixed - added synchronized keyword to writeLog(), flushWriter(), setup(), and cleanup() methods |
| 24 | + |
| 25 | +### 5. Fix registration email base URL |
| 26 | +- **Issue**: UserAPI.publishRegistrationEvent uses request.getContextPath() (broken links) |
| 27 | +- **Fix**: Use UserUtils.getAppUrl(request) like other flows |
| 28 | + |
| 29 | +### 6. Configure security remember-me properly |
| 30 | +- **Issue**: Uses random key per startup, invalidates on restart |
| 31 | +- **Fix**: Make opt-in with explicit key configuration |
| 32 | + |
| 33 | +### 7. Remove @Async from event classes |
| 34 | +- **Issue**: @Async on POJOs has no effect (false impression) |
| 35 | +- **Fix**: Remove from AuditEvent and OnRegistrationCompleteEvent classes |
| 36 | + |
| 37 | +## Security & API Issues (Priority 2) |
| 38 | + |
| 39 | +### 8. Add DTO validation annotations |
| 40 | +- **Issue**: UserDto and PasswordDto lack bean validation |
| 41 | +- **Fix**: Add @NotBlank, @Email, password constraints, create @ControllerAdvice |
| 42 | + |
| 43 | +### 9. Fix CSRF property typo |
| 44 | +- **Issue**: Property name contains odd "d" - 'disableCSRFdURIs' |
| 45 | +- **Fix**: Rename to 'disableCSRFURIs' |
| 46 | + |
| 47 | +### 10. Improve error message handling |
| 48 | +- **Issue**: CustomOAuth2AuthenticationEntryPoint exposes exception details |
| 49 | +- **Fix**: Use generic user messages, log details internally |
| 50 | + |
| 51 | +### 11. Enhance IP detection |
| 52 | +- **Issue**: Only honors X-Forwarded-For header |
| 53 | +- **Fix**: Support X-Real-IP, CF-Connecting-IP, True-Client-IP |
| 54 | + |
| 55 | +## Web/Security Config (Priority 3) |
| 56 | + |
| 57 | +### 12. Fix property injection robustness |
| 58 | +- **Issue**: Empty property yields list with empty string |
| 59 | +- **Fix**: Filter empty strings from unprotectedURIs list |
| 60 | + |
| 61 | +### 13. Configure role hierarchy for method security |
| 62 | +- **Issue**: Method security doesn't use role hierarchy automatically |
| 63 | +- **Fix**: Create MethodSecurityExpressionHandler bean with hierarchy |
| 64 | + |
| 65 | +### 14. Replace System.out.println with SLF4J |
| 66 | +- **Issue**: Using stdout instead of proper logging |
| 67 | +- **Fix**: Update CustomOAuth2AuthenticationEntryPoint and TimeLogger |
| 68 | + |
| 69 | +## Persistence & Domain (Priority 3) |
| 70 | + |
| 71 | +### 15. Clean up User.roles type handling |
| 72 | +- **Issue**: Mixed List/Set setters, defensive copying |
| 73 | +- **Fix**: Standardize collection handling for JPA dirty checking |
| 74 | + |
| 75 | +## Email & Templates (Priority 3) |
| 76 | + |
| 77 | +### 16. Improve MailService error handling |
| 78 | +- **Issue**: Exceptions only logged and swallowed |
| 79 | +- **Fix**: Add Spring Retry mechanism or queue |
| 80 | + |
| 81 | +### 17. Document Thymeleaf dependency |
| 82 | +- **Issue**: Relies on optional TemplateEngine bean |
| 83 | +- **Fix**: Document requirement prominently |
| 84 | + |
| 85 | +## Audit Issues (Priority 4) |
| 86 | + |
| 87 | +### 18. Improve audit log defaults |
| 88 | +- **Issue**: Default path /opt/app/logs unlikely to be writable |
| 89 | +- **Fix**: Use temp directory or auto-create with graceful failure |
| 90 | + |
| 91 | +### 19. Document conditional flushing |
| 92 | +- **Issue**: Complex conditional expression hard to understand |
| 93 | +- **Fix**: Add clear documentation |
| 94 | + |
| 95 | +## Build & Publishing (Priority 4) |
| 96 | + |
| 97 | +### 20. Fix group coordinate mismatch |
| 98 | +- **Issue**: group = 'com.digitalsanctuary.springuser' vs publishing 'com.digitalsanctuary' |
| 99 | +- **Fix**: Align group with publishing coordinates |
| 100 | + |
| 101 | +### 21. Dependency management consistency |
| 102 | +- **Issue**: Mixed explicit versions and BOM usage |
| 103 | +- **Fix**: Prefer Boot BOM for all Spring dependencies |
| 104 | + |
| 105 | +### 22. Simplify test task configuration |
| 106 | +- **Issue**: Overriding test task unusual for library |
| 107 | +- **Fix**: Make testAll optional, restore standard test task |
| 108 | + |
| 109 | +## UX & Behavior (Priority 4) |
| 110 | + |
| 111 | +### 23. Document registration verification flow |
| 112 | +- **Issue**: Auto-enable vs email verification unclear |
| 113 | +- **Fix**: Add clear documentation |
| 114 | + |
| 115 | +### 24. Make post-auth redirects configurable |
| 116 | +- **Issue**: Forces alwaysUseDefaultTargetUrl(true), surprising UX |
| 117 | +- **Fix**: Add configuration property |
| 118 | + |
| 119 | +### 25. Make global model injection opt-in |
| 120 | +- **Issue**: Adds user to all MVC views by default |
| 121 | +- **Fix**: Make opt-in for REST-only apps |
| 122 | + |
| 123 | +## Documentation |
| 124 | + |
| 125 | +### 26. Create comprehensive getting started guide |
| 126 | +- **Fix**: Document required dependencies, minimal properties, examples |
| 127 | + |
| 128 | +## Notes |
| 129 | +- All issues have been validated against the codebase |
| 130 | +- Fixes should include appropriate tests |
| 131 | +- Run ./gradlew check after each fix to ensure no regressions |
0 commit comments