The Real Fullstack

The Unverified Token

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

Ingénieur8 minDéfi de codeSimulateur de flux
jwtoauth2spring-securitynode

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

Mission:Select the verification steps that accept every legitimate token and reject every forged, expired or misdirected one.Contexte · Objectifs d'apprentissage ▾

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.

Mission: Select the verification steps that accept every legitimate token and reject every forged, expired or misdirected one.

Objectifs d'apprentissage

  • Know what decoding vs verifying a JWT means.
  • Pin the algorithm and validate exp, iss and aud.
  • Avoid authorization rules based on untrusted claims.
SimulationSimulé
clientidentity providerorders APIorders DB
Lancer la simulation
// current: decodes the payload and trusts itconst claims = JSON.parse(Buffer.from(token.split('.')[1], 'base64url'));req.user = claims;

Simplification

Seven tokens with fixed properties. Real verification also handles key rotation (JWKS) and clock skew. Modèle pédagogique — les chiffres illustrent un comportement, ce ne sont pas des benchmarks.

Concepts

Utile avant celui-ci

Défis liés

Références