Medium severityPythonOther Security ChecksMEDIUM confidence
Jinja2 Autoescape Off
Jinja2 Environment is created without autoescaping, so rendered variables are not HTML-escaped and are vulnerable to XSS (CWE-79).
Standards mapping
- OWASP Top 10
- A03:2021 - Injection
- OWASP ASVS
- V5.3.3 (L1)
Vulnerable vs. safe
Flagged by this check
env = jinja2.Environment(loader=FileSystemLoader("templates"))Passes - the safe pattern
safe_env = jinja2.Environment(loader=FileSystemLoader("templates"), autoescape=select_autoescape())Why it matters & how to fix it
Jinja2 Environment is created without autoescaping, so rendered variables are not HTML-escaped and are vulnerable to XSS (CWE-79). Pass autoescape=select_autoescape() (or autoescape=True) when constructing the Environment.
References
Rule ID integsec-python-jinja2-autoescape-off - 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 ChecksDjango Mark Safe
- Python - Other Security ChecksFlask Debug Enabled
- Python - Other Security ChecksFlask Render Template String
- Python - Other Security ChecksInsecure Tempfile Mktemp