HIGH AI PREVALENCE: HIGH auth.nextauth.authorized-always-true
The NextAuth/Auth.js authorized callback returns true unconditionally.
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
This callback is the gate the middleware uses to protect routes, so returning a constant true authorizes every request and disables the protection entirely. Check the session instead, for example authorized: ({ auth }) => !!auth?.user, and return false (or a Response.redirect to your login page) when there is no signed-in user.
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.authorized-always-true -- <reason>