security/JwtAuthenticationFilter.java
[Naive UserDetails Mapping]
// VULNERABLE: Naïvely passing the database entity password property directly.
// For social profiles (Google/GitHub), user.getPassword() returns null, causing
// Spring's User details validator to throw an unhandled NullPointerException.
private UsernamePasswordAuthenticationToken createAuthToken(User user, HttpServletRequest request) {
org.springframework.security.core.userdetails.User principal =
new org.springframework.security.core.userdetails.User(user.getEmail(), user.getPassword(), List.of());
UsernamePasswordAuthenticationToken authToken =
new UsernamePasswordAuthenticationToken(principal, null, List.of());
authToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
return authToken;
}