HIGH AI PREVALENCE: HIGH auth.nextauth.hardcoded-secret
The NextAuth/Auth.js secret is set to a hard-coded string literal.
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 value signs and encrypts every session JWT and CSRF token. Committed to git it is one search away from compromise, letting an attacker forge sessions for any user. Read it from the environment instead: secret: process.env.AUTH_SECRET (or NEXTAUTH_SECRET) and add the variable to .env.example with a placeholder.
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.hardcoded-secret -- <reason>