python.django.secure_settings
Security
High
Detects missing Django security settings for production.
Why It Matters
Section titled “Why It Matters”Missing security settings:
- XSS attacks — No browser XSS filter
- Clickjacking — Site can be embedded in iframes
- Data leakage — Sensitive headers exposed
Example
Section titled “Example”# ❌ Before (missing security settings)DEBUG = True # In production!SECRET_KEY = 'hardcoded-key'# ✅ After (proper security settings)import os
DEBUG = FalseSECRET_KEY = os.environ['DJANGO_SECRET_KEY']
SECURE_BROWSER_XSS_FILTER = TrueSECURE_CONTENT_TYPE_NOSNIFF = TrueX_FRAME_OPTIONS = 'DENY'SECURE_HSTS_SECONDS = 31536000SECURE_HSTS_INCLUDE_SUBDOMAINS = TrueSECURE_SSL_REDIRECT = TrueWhat Unfault Detects
Section titled “What Unfault Detects”- DEBUG = True in production
- Hardcoded SECRET_KEY
- Missing security headers