The Real Fullstack

The Broken Authorization

Every request is authenticated. So how did Alice read Bob's order?

مهندس9 دقيقةمختبر تصحيح الأخطاءتحدي الشيفرة
restspring-securityjavaoauth2

لم يُترجم هذا التحدي إلى العربية بعد. أنت تقرأ النسخة الإنجليزية.

المهمة:Apply authorization checks so every legitimate request still works and none of the illegitimate ones does.السياق · أهداف التعلّم ▾

Brightcart's orders API checks that requests carry a valid token. A security researcher reported that changing /orders/A-17 to /orders/B-42 returns another customer's order, including address and payment details. Support agents serve several tenants.

المهمة: Apply authorization checks so every legitimate request still works and none of the illegitimate ones does.

أهداف التعلّم

  • Distinguish authentication from authorization.
  • Implement object-level and tenant-level checks.
  • Recognise security through obscurity.
المحاكاةمحاكاة

شغّل المحاكاة لترى المخرجات.

تشغيل المحاكاة
@GetMapping("/orders/{id}")public OrderDto get(@PathVariable String id, Authentication auth) {  return orders.findById(id).map(OrderDto::of).orElseThrow();   // authenticated ≠ authorized}