JAVA-071 / Intermediate
Returning JPA entities directly as JSON: sensitive fields and lazy loading
Why is this a problem?
Password hashes and entire related entities are exposed, and circular references can cause DoS.
How to fix it
java
@GetMapping("/me") UserDto me() { return UserDto.from(userRepo.findById(id).orElseThrow()); }