The Real Fullstack

The Unverified Token

Tokens come from the identity provider. Why would anyone need to check them again?

エンジニア8 分コード課題フローシミュレーター
jwtoauth2spring-securitynode

この課題はまだ日本語に翻訳されていません。英語版を表示しています。

ミッション:Select the verification steps that accept every legitimate token and reject every forged, expired or misdirected one.背景 · 学習目標 ▾

Wrenly's orders API trusted the JWT payload after base64-decoding it: the gateway was supposed to verify tokens, but internal traffic bypasses the gateway. Security found edited tokens, alg:none tokens and tokens issued for another API in the access logs.

ミッション: Select the verification steps that accept every legitimate token and reject every forged, expired or misdirected one.

学習目標

  • Know what decoding vs verifying a JWT means.
  • Pin the algorithm and validate exp, iss and aud.
  • Avoid authorization rules based on untrusted claims.
シミュレーションシミュレーション値
clientidentity providerorders APIorders DB
シミュレーションを実行
// current: decodes the payload and trusts itconst claims = JSON.parse(Buffer.from(token.split('.')[1], 'base64url'));req.user = claims;

簡略化

Seven tokens with fixed properties. Real verification also handles key rotation (JWKS) and clock skew. 教育用モデルです。数値は挙動を示すためのもので、ベンチマークではありません。

コンセプト

先に取り組むと役立つ課題

関連する課題

参考資料