High severityJavaScript / TypeScriptAuthentication & SecretsHIGH confidence
Hardcoded JWT Secret
A JWT signing secret is hardcoded as a string literal in jwt.sign/verify.
Standards mapping
- OWASP ASVS
- V6.4.1 (L2)V2.10.4 (L2)
Vulnerable vs. safe
Flagged by this check
const t1 = jwt.sign(payload, "s3cretSigningKey");Passes - the safe pattern
const t2 = jwt.sign(payload, process.env.JWT_SECRET);Why it matters & how to fix it
A JWT signing secret is hardcoded as a string literal in jwt.sign/verify. Load the signing key from an environment variable or secrets manager, and rotate the exposed secret.
References
Rule ID integsec-js-hardcoded-jwt-secret - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - Authentication & SecretsHardcoded Secret
- JavaScript / TypeScript - Authentication & SecretsInsecure Cookie Flags
- JavaScript / TypeScript - Authentication & SecretsJWT Algorithm None
- JavaScript / TypeScript - Authentication & SecretsJWT Decode Without Verify
- JavaScript / TypeScript - Authentication & SecretsTLS Verification Disabled
- Python - Authentication & SecretsDjango Hardcoded Secret Key