jwt.decode is told to skip the signature check

tx0/python:token-signature-ignoredrecommendedwarningsecurity, cwe-347

What it finds

jwt.decode(token, options={"verify_signature": False}): a token whose signature is not checked can be written by anyone, so the claims in it prove nothing (CWE-347).

Reported are calls of PyJWT's jwt.decode with verify=False, as older versions took it, or with "verify_signature": False in an options dict display.

From the rule's source, token_signature_ignored.rs.

Example from the rule's tests
import jwt  def claims(token, key):    a = jwt.decode(token, options={"verify_signature": False})tx0 reports: this token is decoded without checking its signature    b = jwt.decode(token, key, verify=False)tx0 reports: this token is decoded without checking    c = jwt.decode(token, key, algorithms=["HS256"])    d = jwt.decode(token, key, options={"verify_exp": False})    return a, b, c, d
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 from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:token-signature-ignored" = "warning"

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/python:token-signature-ignored] reason="..."

tx0 explain tx0/python:token-signature-ignored shows the same in the terminal. Found a false positive? Report it.