JWT No Validation (ARCH4126)
Ce contenu n’est pas encore disponible dans votre langue.
Key java.security.jwt-no-validation · Severity error · Category security · CWE CWE-347
Decoding a JWT body without verifying its signature (e.g. just parsing the payload) lets attackers forge tokens and bypass authentication. Always validate the token with signature and claim checks.
Incorrect
Section titled “Incorrect”String[] parts = token.split("\\.");String payload = new String(Base64.getUrlDecoder().decode(parts[1]));Claims claims = mapper.readValue(payload, Claims.class); // signature not verifiedCorrect
Section titled “Correct”Claims claims = Jwts.parserBuilder() .setSigningKey(publicKey) .build() .parseClaimsJws(token) // verifies signature and expiry .getBody();Use a parser that verifies the JWT against the signing key; never decode the payload without validation.