A NestJS JwtModule is configured with a hard-coded secret (or secretOrPrivateKey) 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 key signs and verifies every access token: committed to git it is one search away from compromise, letting an attacker forge tokens for any user.
Read it from the environment instead. Use JwtModule.registerAsync with ConfigService (useFactory: (config) => ({ secret: config.get('JWT_SECRET') })) or secret: process.env.JWT_SECRET, and add the variable to .env.example with a placeholder. Rotate the leaked value out of source control.
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.nestjs.jwt-hardcoded-secret -- <reason>