MEDIUM AI PREVALENCE: MEDIUM auth.rust.jwt.no-aud-validation
JWT audience (aud) validation is disabled by setting validate_aud: false on the jsonwebtoken Validation.
Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
With the audience check turned off, a token minted for a different service is accepted by decode, so an attacker can replay a token issued for another audience against this API.
Keep validate_aud at its default true and declare the audience you expect via validation.set_audience(&["my-api"]), so only tokens whose aud claim matches your service are accepted.
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.rust.jwt.no-aud-validation -- <reason>