Skip to content

Commit d8566c1

Browse files
authored
Enable jinja2 autoescape (#967)
As recommended by Bandit
1 parent b33bc8a commit d8566c1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cve_bin_tool/output_engine/html.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ def output_html(
6464

6565
# Template Directory contains all the html files
6666
templates_dir = os.path.join(root, "html_reports")
67-
templates_env = Environment(loader=FileSystemLoader([theme_dir, templates_dir]))
67+
templates_env = Environment(
68+
loader=FileSystemLoader([theme_dir, templates_dir]),
69+
autoescape=select_autoescape(["html"]),
70+
)
6871

6972
temp_base = "templates/base.html"
7073
temp_dash = "templates/dashboard.html"

cve_bin_tool/output_engine/print_mode.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def html_print_mode(
1717

1818
root = os.path.dirname(os.path.abspath(__file__))
1919
templates_dir = os.path.join(root, "print_mode")
20-
templates_env = Environment(loader=FileSystemLoader(templates_dir))
20+
templates_env = Environment(
21+
loader=FileSystemLoader(templates_dir),
22+
autoescape=select_autoescape(["html"]),
23+
)
2124

2225
temp_showcase = "templates/showcase.html"
2326
temp_content = "templates/content.html"

0 commit comments

Comments
 (0)