JAVA-012 / Beginner
IDOR: looking up by ID without ownership checks
Why is this a problem?
Changing /orders/{id} enables access to another user's order.
How to fix it
java
@GetMapping("/orders/{id}") Order get(@PathVariable Long id, @AuthenticationPrincipal Me me) {
return repo.findByIdAndOwnerId(id, me.getId()).orElseThrow(NotFound::new);
}