django smoke alarm

Security Community

Skill notes

When to Use

The project is Django/DRF and you need obvious security or reliability issues. A scanner reports many findings and you need a grounded triage. Before launch, deploy, CI hardening, or exposing new auth/API/upload/HTML surfaces. When adding or reviewing settings, DRF auth, OAuth/API keys, XML/Markdown/HTML rendering, import jobs, or admin previews.

Core Rule

Always classify scanner output before fixing: REAL — plausible exploit/data-loss/abuse path or broken production posture. HYGIENE — low-risk but worth making safer/clearer, often to reduce future mistakes. FALSE POSITIVE — scanner pattern is misleading; document why with code evidence. Do not create a giant undifferentiated fix list. The dragon is usually three lizards in a trench coat.

Phase 1: Prepare a Clean Scan

Never judge raw scanner counts from a working repo if it contains worktrees or generated/vendor folders. Exclude at minimum: If using djangoSecurityHunter, prefer a clean temp copy and scan-only env values: If the scanner cannot import settings, keep static findings but explicitly say which settings-backed checks were skipped.

Phase 2: Read the Rule Buckets, Not Just Counts

Group findings by risk surface: Production settings — DEBUG, SECRET_KEY, ALLOWED_HOSTS, HTTPS redirect, HSTS, secure cookies, CSRF trusted origins, CORS. DRF/API abuse — default authentication, permissions, throttles, pagination, auth-like routes, upload limits. Unsafe HTML — mark_safe, |safe, XML/Markdown renderers, admin previews, template tags, rich text blocks. Persistence races — exists/get + create, multi-save workflows, save() in loops, arithmetic updates without F(), missing uniqueness/idempotency.

Phase 3: Sample Before Fixing

For each noisy rule, inspect representative code before deciding.

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Security
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@tomevault-io · no license declared
Token usage
Lean
Setup complexity
Guided setup
External API key
Required · Vendor-specific
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
Python
Detected file/system behavior
  • Read-only
  • Write / modify
  • Env read
Network behavior
External requests
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

01
Phase 1: Prepare a Clean Scan

Never judge raw scanner counts from a working repo if it contains worktrees or generated/vendor folders. Exclude at minimum: If using `djangoSecurityHunter`, prefer a clean temp copy and scan-only env values: If the scanner cannot import settings, keep static findings but explicitly say which settings-backed checks were skipped.

02
Phase 2: Read the Rule Buckets, Not Just Counts

Group findings by risk surface: Production settings — `DEBUG`, `SECRET_KEY`, `ALLOWED_HOSTS`, HTTPS redirect, HSTS, secure cookies, CSRF trusted origins, CORS. DRF/API abuse — default authentication, permissions, throttles, pagination, auth-like routes, upload limits. Unsafe HTML — `mark_safe`, `|safe`, XML/Markdown renderers, admin previews, template tags, rich text blocks. Persistence races — `exists/get + create`, multi-save workflows, `save()` in loops, arithmetic updates without `F()`, missing uniqueness/idempotency.

03
Phase 3: Sample Before Fixing

For each noisy rule, inspect representative code before deciding.

04
Phase 4: Produce a Triage Table

Report a compact table: Finding · Classification · Evidence · Recommended move Missing HSTS · REAL · `settings.py` has no `SECURE_HSTS_SECONDS` under `DEBUG=False` · Add production security block or env-controlled settings Admin `mark_safe` preview · HYGIENE · URL is escaped, constant HTML otherwise · Convert to `format_html` AI pipeline multiple saves · FALSE POSITIVE/HYGIENE · Saves status before/after long external calls · Do not wrap whole function; maybe add comment/tests

05
Phase 5: Turn Findings into Project Policy

If the same issue could recur, add a project-local guardrail: `settings.py` production security block and test. DRF throttle defaults and per-route throttles for auth/OAuth/API-key endpoints. HTML renderer helper that escapes text by default and marks only known tags safe. Code-review note: “no `mark_safe` with interpolation; use `format_html`.”

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.