The Real Fullstack

The Unverified Token

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

Engenheiro8 minDesafio de códigoSimulador de fluxo
jwtoauth2spring-securitynode

Este desafio ainda não foi traduzido para Português (Brasil). Você está lendo a versão em inglês.

Missão:Select the verification steps that accept every legitimate token and reject every forged, expired or misdirected one.Contexto · Objetivos de aprendizagem ▾

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.

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

Objetivos de aprendizagem

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

Simplificação

Seven tokens with fixed properties. Real verification also handles key rotation (JWKS) and clock skew. Modelo educacional — os números ilustram comportamento, não são benchmarks.

Conceitos

Útil antes deste

Desafios relacionados

Referências