JAVA-009 / Beginner
Direct entity binding in Spring MVC (mass assignment)
Why is this a problem?
Request JSON fields role and isAdmin are bound to the entity.
How to fix it
java
public record UserUpdateDto(@NotBlank String name, @Email String email) {}
@PutMapping("/users/me")
public void update(@Valid @RequestBody UserUpdateDto dto, @AuthenticationPrincipal Me me) { ... }