JAVA-099 / Intermediate
Privilege escalation: missing administrator checks on role-change APIs
Why is this a problem?
Ordinary users can change their own or others' privileges through /users/{id}/role.
How to fix it
java
@PreAuthorize("hasRole('ADMIN')")
@PostMapping("/users/{id}/role") void setRole(@PathVariable Long id, @RequestParam Role r) { ... }