High severityRubyAuthentication & SecretsHIGH confidence
JWT Hardcoded Secret
A hard-coded string is used as the JWT signing/verification secret (CWE-798/CWE-321).
Standards mapping
- OWASP Top 10
- A02:2021 - Cryptographic Failures
- OWASP ASVS
- V6.4.1 (L2)
Vulnerable vs. safe
Flagged by this check
JWT.encode(payload, "s3cr3t-signing-key", "HS256")Passes - the safe pattern
JWT.encode(payload, ENV["JWT_SECRET"], "HS256")Why it matters & how to fix it
A hard-coded string is used as the JWT signing/verification secret (CWE-798/CWE-321). Load the signing key from a secret manager or environment variable, use a strong random key, and rotate any hard-coded value.
References
Rule ID integsec-ruby-jwt-hardcoded-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 JWT Secret
- 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