HIGH Severity XSS Vulnerability in Jinja2 Template (erd.py) - Autoescape Set to False
A high-severity security vulnerability has been flagged in a critical Jinja2 template configuration. The automated scanner Bandit identified rule B701 (CWE-94) in the file `scripts/erd/erd.py` at line 174. The core issue is that the Jinja2 environment is configured with `autoescape=False` by default, creating a direct path for potential Cross-Site Scripting (XSS) attacks if untrusted data is rendered. This misconfiguration leaves the application exposed to injection of malicious scripts, which could compromise user data and session integrity.
The vulnerability is specifically located within the entity-relationship diagram (ERD) generation script. The lack of automatic escaping means any user-controlled input passed to this template engine could be executed as code in a victim's browser. The finding carries a 'HIGH' severity rating, underscoring the immediate risk it poses to the application's security posture. A unique fingerprint (`eeea32e236ffe70d8eda`) has been generated to track this specific instance.
Remediation has been assigned: a developer named Devin is tasked with investigating, implementing a fix, and opening a pull request. The prescribed solution is to either enable `autoescape=True` or utilize Jinja2's `select_autoescape()` function to properly sanitize output. Until this patch is applied and merged, the associated script remains a potential attack vector, requiring urgent attention from the security and development teams to prevent exploitation.