A JSON Web Token is created or checked with the none algorithm, which has no signature

tx0/java:unsigned-jwtdefaulterrorsecurity, cwe-347

What it finds

The none algorithm of JSON Web Tokens means the token carries no signature, so anyone can write one with any claims (CWE-347). Algorithm.none() of the auth0 library and SignatureAlgorithm.NONE of jjwt choose it.

Reported is Algorithm.none() and SignatureAlgorithm.NONE.

From the rule's source, unsigned_jwt.rs.

Example from the rule's tests
import com.auth0.jwt.algorithms.Algorithm;import io.jsonwebtoken.SignatureAlgorithm; class Tokens {  Object sign() {    Algorithm a = Algorithm.none();tx0 reports: carry no signature    SignatureAlgorithm b = SignatureAlgorithm.NONE;tx0 reports: carry no signature    return SignatureAlgorithm.HS256;  }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/java:unsigned-jwt" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/java:unsigned-jwt] reason="..."

tx0 explain tx0/java:unsigned-jwt shows the same in the terminal. Found a false positive? Report it.