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}

簡略化

Seven representative requests; each check is a declarative predicate. 教育用モデルです。数値は挙動を示すためのもので、ベンチマークではありません。

コンセプト

関連する課題

参考資料