Medium severityPythonOther Security ChecksMEDIUM confidence
Django Mark Safe
User input is passed to mark_safe()/format_html unescaped, disabling Django auto-escaping and allowing XSS (CWE-79).
Standards mapping
- OWASP Top 10
- A03:2021 - Injection
- OWASP ASVS
- V5.3.3 (L1)
Vulnerable vs. safe
Flagged by this check
return mark_safe(bio)Passes - the safe pattern
return mark_safe("<b>Static welcome banner</b>")Why it matters & how to fix it
User input is passed to mark_safe()/format_html unescaped, disabling Django auto-escaping and allowing XSS (CWE-79). Do not mark request-derived data safe; let the template engine escape it, or sanitize HTML with a vetted library (e.g. bleach/nh3) first.
References
Rule ID integsec-python-django-mark-safe - 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 - Other Security ChecksChild Process Shell True
- JavaScript / TypeScript - Other Security ChecksOpen Redirect Tainted Input
- Python - Other Security ChecksFlask Debug Enabled
- Python - Other Security ChecksFlask Render Template String
- Python - Other Security ChecksInsecure Tempfile Mktemp
- Python - Other Security ChecksJinja2 Autoescape Off