HIGH AI PREVALENCE: HIGH auth.nextauth.redirect-open
The NextAuth/Auth.js redirect callback returns the incoming url without validating it against baseUrl.
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
url is attacker-controllable (it comes from the callbackUrl request parameter), so returning it verbatim turns your sign-in flow into an open redirect: /api/auth/signin?callbackUrl=https://evil.example lands the user on the attacker's site after login. Only return a url you have confirmed is local, for example return url.startsWith(baseUrl) ? url : baseUrl (and resolve relative paths against baseUrl yourself).
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.nextauth.redirect-open -- <reason>