High severityPythonAuthentication & SecretsHIGH confidence
Django Hardcoded Secret Key
Django SECRET_KEY is hardcoded as a string literal (CWE-798).
Standards mapping
- OWASP ASVS
- V6.4.1 (L2)
Vulnerable vs. safe
Flagged by this check
SECRET_KEY = "django-insecure-9f8h2k3j4l5m6n7o8p9q"Passes - the safe pattern
SECRET_KEY = os.environ["DJANGO_SECRET_KEY"]Why it matters & how to fix it
Django SECRET_KEY is hardcoded as a string literal (CWE-798). This key signs sessions and CSRF tokens; committing it allows forgery. Read it from the environment: SECRET_KEY = os.environ["DJANGO_SECRET_KEY"], and rotate the exposed value.
References
Rule ID integsec-python-django-hardcoded-secret-key - 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