Keeping secrets secret in Django
summary
Explains that Django’s SECRET_KEY is used for cryptographic signing (sessions, password reset tokens, messages), shows signing/unsigning code, and demonstrates that changing keys breaks signatures unless added to secret key fallbacks. Presents a practical tool django-root-secrets: generate a per-environment root key, encrypt individual secrets into the repo, and decrypt at runtime with management commands. Covers leak mitigation: least-privilege, short-lived credentials, rotation cadence, and that the package reduces distribution from dozens of secrets to one per environment.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 0:22What is a secret?
- 2:04Django secret key explained
- 6:59Cryptographic signing in Django
- 12:18Generating secure secret keys
- 18:40Secret key rotation impact
- 21:07Managing secrets in Django
- 24:37Root encryption key approach
- 27:05Who can access secrets?
- 28:56Handling secret leaks
- 31:03Q&A session
