Skip to content

Commit 195ea53

Browse files
committed
Sanitize test plan name in tree_view_html()
1 parent 1ae51fc commit 195ea53

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tcms/testplans/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from tcms.core.history import KiwiHistoricalRecords
1111
from tcms.core.models.base import UrlMixin
12+
from tcms.core.templatetags.extra_filters import bleach_input
1213
from tcms.management.models import Version
1314
from tcms.testcases.models import TestCasePlan
1415

@@ -213,6 +214,7 @@ def tree_view_html(self):
213214
if test_plan.pk == self.pk:
214215
active_class = "active"
215216

217+
plan_name = bleach_input(test_plan.name)
216218
result += f"""
217219
<!-- begin-node -->
218220
<div class="list-group-item {active_class}" style="border: none">
@@ -228,7 +230,7 @@ def tree_view_html(self):
228230
<div class="list-view-pf-description">
229231
<div class="list-group-item-text">
230232
<a href="{test_plan.get_absolute_url()}">
231-
TP-{test_plan.pk}: {test_plan.name}
233+
TP-{test_plan.pk}: {plan_name}
232234
</a>
233235
</div>
234236
</div>

0 commit comments

Comments
 (0)