The better-auth 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 cookie, CSRF token, and verification token better-auth issues. 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.BETTER_AUTH_SECRET (better-auth also falls back to the BETTER_AUTH_SECRET / AUTH_SECRET env vars automatically if you omit the option). Add the variable to .env.example with a placeholder and rotate any secret that has shipped.
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.betterauth.hardcoded-secret -- <reason>