A jsonwebtoken Validation accepts both HMAC and asymmetric algorithms, enabling algorithm confusion.
Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
The accepted-algorithm list MIXES an HMAC family (Algorithm::HS256/HS384/HS512) with an asymmetric family (Algorithm::RS*/ES*/PS*). When both families are accepted, an attacker takes your RSA/EC PUBLIC key (which is not secret) and signs a forged token with HS*, using the public key bytes as the HMAC shared secret. decode then verifies that forged token as valid, letting the attacker mint arbitrary identities and claims.
Pin validation.algorithms to a SINGLE family you actually use, e.g. validation.algorithms = vec![Algorithm::RS256]; when your issuer signs with RSA, or vec![Algorithm::HS256] for a genuinely symmetric secret. Never accept an HMAC algorithm alongside an asymmetric one.
CWE-327: use of a broken or risky cryptographic algorithm/configuration.
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.rust.jwt.algorithm-confusion -- <reason>