Files
project-work/sources/django-sec-config-auditor.md

64 lines
3.0 KiB
Markdown

# Project Idea: Django Security Configuration Auditor
From the security audit, this was the first recommended project:
> **Django Security Configuration Auditor** - Scans Django settings for production readiness (DEBUG, SECRET_KEY, security headers, password validators, token expiry, etc.)
## How this fits the project rules
**✅ Real task** - This is a genuine security tool that Django projects need. The NearBeach audit itself revealed exactly the kinds of issues this tool would catch (hardcoded SECRET_KEY, DEBUG=True, missing security headers, non-expiring tokens).
**✅ Checkable** - Clear completion criteria:
- Run against a test Django project with known issues → tool reports them
- Run against a hardened Django project → tool reports clean
- CLI with exit codes for CI/CD integration
**✅ Big enough** - Multiple components:
- Settings parser (handles `settings.py`, `local_settings.py`, environment-based configs)
- Rule engine (50+ security checks across categories)
- CLI with multiple output formats (JSON, SARIF, human-readable)
- CI/CD integration (GitHub Actions, GitLab CI)
- Extensible rule system for custom checks
**✅ Not already solved** - Existing tools like `django-check-secrets` or `bandit` don't do Django-specific settings analysis comprehensively.
**✅ Safe** - No credentials, no external API calls, pure static analysis.
---
## Suggested Task Breakdown (for 8-15 turns)
| Turn | Focus |
|------|-------|
| 1-2 | Project scaffold: CLI entry point, settings discovery/loading |
| 3-4 | Core rule engine + first 10 rules (SECRET_KEY, DEBUG, ALLOWED_HOSTS, security headers) |
| 5-6 | More rules: password validators, token settings, CORS, CSP, file upload settings |
| 7-8 | Output formats (JSON, SARIF, table), exit codes |
| 9-10 | CI/CD integration examples, GitHub Action |
| 11+ | Extensibility: custom rules, config file, ignore patterns |
---
## Why this is a strong choice for this project
1. **You're the target user** - You just did a manual audit of NearBeach. This tool would automate what you did.
2. **Leverages the repo** - NearBeach's own `local/settings.py` is the perfect test case (has the CRITICAL issues).
3. **Clear "Other notes for reviewer"** - You can explain: "I built this because I manually audited NearBeach and found 17 issues. This tool would have caught them all automatically."
4. **Measurable completion** - Run it on NearBeach zip → shows 17 findings. Fix settings → shows 0.
---
## Questions before we start
1. **Scope**: Just Django settings, or also scan `requirements.txt` / `pyproject.toml` for vulnerable dependencies?
2. **Language**: Python (obviously), but any preference on CLI framework (Click, Typer, argparse)?
3. **Test strategy**: Use NearBeach as the primary test fixture, or create a separate minimal Django project with injected issues?
---
## Next Steps
If proceeding with this as the task:
1. Draft the **Task brief** (description, completion criteria, other notes) for LiveCompare
2. Mount the NearBeach zip
3. Begin the session