MEDIUM AI PREVALENCE: HIGH auth.ruby.jwt.missing-algorithm-allowlist
JWT.decode is called with verification enabled (true) but no algorithm: / algorithms: option, so the library trusts whatever alg the token header names.
Why AI tools produce this: AI coding tools generate this anti-pattern by default, it appears in a large share of AI-written auth code.
Why this matters
An attacker can switch the algorithm, e.g. present an HS256 token signed with your RSA public key as if it were the HMAC secret, and the signature check passes (algorithm-confusion, CWE-347).
Always pin the accepted algorithm(s): JWT.decode(token, key, true, { algorithm: 'HS256' }) JWT.decode(token, public_key, true, { algorithms: ['RS256'] }) ruby-jwt's own docs mark this allow-list as mandatory for safe decoding.
VULNERABLE
SAFE
Suppressing this rule
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.
// oauthlint-disable-next-line auth.ruby.jwt.missing-algorithm-allowlist -- <reason>