HIGH-Severity Jinja2 XSS Vulnerability in erd.py Script (B701) - Autoescape Set to False
A high-severity security vulnerability has been flagged in the codebase, exposing a potential cross-site scripting (XSS) risk. The automated scanner Bandit identified rule B701 in the file `scripts/erd/erd.py` at line 174. The core issue is that the Jinja2 template engine is configured with `autoescape=False` by default, which fails to sanitize user input and could allow an attacker to inject malicious scripts.
The vulnerability is classified under CWE-94 (Improper Control of Generation of Code) and carries a HIGH severity rating. The specific file, `erd.py`, is part of the project's scripts, suggesting this code may be used for generating reports or documentation. The lack of auto-escaping means any user-controlled data passed to this Jinja2 environment could be executed as code in a victim's browser, leading to data theft or session hijacking.
A remediation plan is already in motion, with an assignee named 'Devin' tasked to investigate, implement a fix, and open a pull request. The recommended mitigation is to explicitly set `autoescape=True` or utilize Jinja2's `select_autoescape()` function. The fingerprint `eeea32e236ffe70d8eda` uniquely identifies this finding for tracking. This vulnerability underscores the critical need for secure default configurations in web-facing template code, especially in auxiliary scripts that might be overlooked during security reviews.