The Real Fullstack

The Broken Authorization

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

Ingénieur9 minLaboratoire de débogageDéfi de code
restspring-securityjavaoauth2

Ce défi n'est pas encore traduit en Français. Vous lisez la version anglaise.

Mission:Apply authorization checks so every legitimate request still works and none of the illegitimate ones does.Contexte · Objectifs d'apprentissage ▾

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.

Mission: Apply authorization checks so every legitimate request still works and none of the illegitimate ones does.

Objectifs d'apprentissage

  • Distinguish authentication from authorization.
  • Implement object-level and tenant-level checks.
  • Recognise security through obscurity.
SimulationSimulé

Lancez la simulation pour voir la sortie.

Lancer la simulation
@GetMapping("/orders/{id}")public OrderDto get(@PathVariable String id, Authentication auth) {  return orders.findById(id).map(OrderDto::of).orElseThrow();   // authenticated ≠ authorized}

Simplification

Seven representative requests; each check is a declarative predicate. Modèle pédagogique — les chiffres illustrent un comportement, ce ne sont pas des benchmarks.

Concepts

Défis liés

Références