|
110 | 110 | get_system_setting, |
111 | 111 | is_finding_groups_enabled, |
112 | 112 | is_scan_file_too_large, |
| 113 | + tag_validator, |
113 | 114 | ) |
114 | 115 | from dojo.widgets import TableCheckboxWidget |
115 | 116 |
|
@@ -338,6 +339,9 @@ class Meta: |
338 | 339 | "business_criticality", "platform", "lifecycle", "origin", "user_records", "revenue", "external_audience", "enable_product_tag_inheritance", |
339 | 340 | "internet_accessible", "enable_simple_risk_acceptance", "enable_full_risk_acceptance", "disable_sla_breach_notifications"] |
340 | 341 |
|
| 342 | + def clean_tags(self): |
| 343 | + tag_validator(self.cleaned_data.get("tags")) |
| 344 | + |
341 | 345 |
|
342 | 346 | class DeleteProductForm(forms.ModelForm): |
343 | 347 | id = forms.IntegerField(required=True, |
@@ -602,6 +606,9 @@ def clean(self): |
602 | 606 |
|
603 | 607 | return cleaned_data |
604 | 608 |
|
| 609 | + def clean_tags(self): |
| 610 | + tag_validator(self.cleaned_data.get("tags")) |
| 611 | + |
605 | 612 | # date can only be today or in the past, not the future |
606 | 613 | def clean_scan_date(self): |
607 | 614 | date = self.cleaned_data.get("scan_date", None) |
@@ -708,6 +715,9 @@ def clean(self): |
708 | 715 |
|
709 | 716 | return cleaned_data |
710 | 717 |
|
| 718 | + def clean_tags(self): |
| 719 | + tag_validator(self.cleaned_data.get("tags")) |
| 720 | + |
711 | 721 | # date can only be today or in the past, not the future |
712 | 722 | def clean_scan_date(self): |
713 | 723 | date = self.cleaned_data.get("scan_date", None) |
@@ -1021,6 +1031,9 @@ def is_valid(self): |
1021 | 1031 | return False |
1022 | 1032 | return True |
1023 | 1033 |
|
| 1034 | + def clean_tags(self): |
| 1035 | + tag_validator(self.cleaned_data.get("tags")) |
| 1036 | + |
1024 | 1037 | class Meta: |
1025 | 1038 | model = Engagement |
1026 | 1039 | exclude = ("first_contacted", "real_start", "engagement_type", "inherited_tags", |
@@ -1076,6 +1089,9 @@ class Meta: |
1076 | 1089 | "environment", "percent_complete", "tags", "lead", "version", "branch_tag", "build_id", "commit_hash", |
1077 | 1090 | "api_scan_configuration"] |
1078 | 1091 |
|
| 1092 | + def clean_tags(self): |
| 1093 | + tag_validator(self.cleaned_data.get("tags")) |
| 1094 | + |
1079 | 1095 |
|
1080 | 1096 | class DeleteTestForm(forms.ModelForm): |
1081 | 1097 | id = forms.IntegerField(required=True, |
@@ -1172,6 +1188,9 @@ def clean(self): |
1172 | 1188 |
|
1173 | 1189 | return cleaned_data |
1174 | 1190 |
|
| 1191 | + def clean_tags(self): |
| 1192 | + tag_validator(self.cleaned_data.get("tags")) |
| 1193 | + |
1175 | 1194 | class Meta: |
1176 | 1195 | model = Finding |
1177 | 1196 | exclude = ("reporter", "url", "numerical_severity", "under_review", "reviewers", "cve", "inherited_tags", |
@@ -1249,6 +1268,9 @@ def clean(self): |
1249 | 1268 |
|
1250 | 1269 | return cleaned_data |
1251 | 1270 |
|
| 1271 | + def clean_tags(self): |
| 1272 | + tag_validator(self.cleaned_data.get("tags")) |
| 1273 | + |
1252 | 1274 | class Meta: |
1253 | 1275 | model = Finding |
1254 | 1276 | exclude = ("reporter", "url", "numerical_severity", "under_review", "reviewers", "cve", "inherited_tags", |
@@ -1306,6 +1328,9 @@ def clean(self): |
1306 | 1328 |
|
1307 | 1329 | return cleaned_data |
1308 | 1330 |
|
| 1331 | + def clean_tags(self): |
| 1332 | + tag_validator(self.cleaned_data.get("tags")) |
| 1333 | + |
1309 | 1334 | class Meta: |
1310 | 1335 | model = Finding |
1311 | 1336 | exclude = ("reporter", "url", "numerical_severity", "active", "false_p", "verified", "endpoint_status", "cve", "inherited_tags", |
@@ -1428,6 +1453,9 @@ def clean(self): |
1428 | 1453 |
|
1429 | 1454 | return cleaned_data |
1430 | 1455 |
|
| 1456 | + def clean_tags(self): |
| 1457 | + tag_validator(self.cleaned_data.get("tags")) |
| 1458 | + |
1431 | 1459 | def _post_clean(self): |
1432 | 1460 | super()._post_clean() |
1433 | 1461 |
|
@@ -1504,6 +1532,9 @@ def clean(self): |
1504 | 1532 |
|
1505 | 1533 | return cleaned_data |
1506 | 1534 |
|
| 1535 | + def clean_tags(self): |
| 1536 | + tag_validator(self.cleaned_data.get("tags")) |
| 1537 | + |
1507 | 1538 | class Meta: |
1508 | 1539 | fields = ["title", "cwe", "vulnerability_ids", "cvssv3", "severity", "description", "mitigation", "impact", "references", "tags"] |
1509 | 1540 | order = ("title", "cwe", "vulnerability_ids", "cvssv3", "severity", "description", "impact", "is_mitigated") |
@@ -1534,6 +1565,9 @@ class Meta: |
1534 | 1565 | order = ("title", "cwe", "vulnerability_ids", "cvssv3", "severity", "description", "impact") |
1535 | 1566 | exclude = ("numerical_severity", "is_mitigated", "last_used", "endpoint_status", "cve") |
1536 | 1567 |
|
| 1568 | + def clean_tags(self): |
| 1569 | + tag_validator(self.cleaned_data.get("tags")) |
| 1570 | + |
1537 | 1571 |
|
1538 | 1572 | class DeleteFindingTemplateForm(forms.ModelForm): |
1539 | 1573 | id = forms.IntegerField(required=True, |
@@ -1587,6 +1621,9 @@ def clean(self): |
1587 | 1621 | raise forms.ValidationError(msg) |
1588 | 1622 | return cleaned_data |
1589 | 1623 |
|
| 1624 | + def clean_tags(self): |
| 1625 | + tag_validator(self.cleaned_data.get("tags")) |
| 1626 | + |
1590 | 1627 | class Meta: |
1591 | 1628 | model = Finding |
1592 | 1629 | fields = ("severity", "date", "planned_remediation_date", "active", "verified", "false_p", "duplicate", "out_of_scope", |
@@ -1637,6 +1674,9 @@ def clean(self): |
1637 | 1674 |
|
1638 | 1675 | return cleaned_data |
1639 | 1676 |
|
| 1677 | + def clean_tags(self): |
| 1678 | + tag_validator(self.cleaned_data.get("tags")) |
| 1679 | + |
1640 | 1680 |
|
1641 | 1681 | class AddEndpointForm(forms.Form): |
1642 | 1682 | endpoint = forms.CharField(max_length=5000, required=True, label="Endpoint(s)", |
@@ -1700,6 +1740,9 @@ def clean(self): |
1700 | 1740 |
|
1701 | 1741 | return cleaned_data |
1702 | 1742 |
|
| 1743 | + def clean_tags(self): |
| 1744 | + tag_validator(self.cleaned_data.get("tags")) |
| 1745 | + |
1703 | 1746 |
|
1704 | 1747 | class DeleteEndpointForm(forms.ModelForm): |
1705 | 1748 | id = forms.IntegerField(required=True, |
|
0 commit comments