Skip to content

Commit 1db84c8

Browse files
tags: prevent validation from removing tags (#12400)
* tags: prevent validation from removing tags * tags: prevent validation from removing tags smoke test * tags: prevent validation from removing tags smoke test * tags: prevent validation from removing tags remove ui test
1 parent 662fbb0 commit 1db84c8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

dojo/forms.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ class Meta:
341341

342342
def clean_tags(self):
343343
tag_validator(self.cleaned_data.get("tags"))
344+
return self.cleaned_data.get("tags")
344345

345346

346347
class DeleteProductForm(forms.ModelForm):
@@ -608,6 +609,7 @@ def clean(self):
608609

609610
def clean_tags(self):
610611
tag_validator(self.cleaned_data.get("tags"))
612+
return self.cleaned_data.get("tags")
611613

612614
# date can only be today or in the past, not the future
613615
def clean_scan_date(self):
@@ -717,6 +719,7 @@ def clean(self):
717719

718720
def clean_tags(self):
719721
tag_validator(self.cleaned_data.get("tags"))
722+
return self.cleaned_data.get("tags")
720723

721724
# date can only be today or in the past, not the future
722725
def clean_scan_date(self):
@@ -1033,6 +1036,7 @@ def is_valid(self):
10331036

10341037
def clean_tags(self):
10351038
tag_validator(self.cleaned_data.get("tags"))
1039+
return self.cleaned_data.get("tags")
10361040

10371041
class Meta:
10381042
model = Engagement
@@ -1091,6 +1095,7 @@ class Meta:
10911095

10921096
def clean_tags(self):
10931097
tag_validator(self.cleaned_data.get("tags"))
1098+
return self.cleaned_data.get("tags")
10941099

10951100

10961101
class DeleteTestForm(forms.ModelForm):
@@ -1190,6 +1195,7 @@ def clean(self):
11901195

11911196
def clean_tags(self):
11921197
tag_validator(self.cleaned_data.get("tags"))
1198+
return self.cleaned_data.get("tags")
11931199

11941200
class Meta:
11951201
model = Finding
@@ -1270,6 +1276,7 @@ def clean(self):
12701276

12711277
def clean_tags(self):
12721278
tag_validator(self.cleaned_data.get("tags"))
1279+
return self.cleaned_data.get("tags")
12731280

12741281
class Meta:
12751282
model = Finding
@@ -1330,6 +1337,7 @@ def clean(self):
13301337

13311338
def clean_tags(self):
13321339
tag_validator(self.cleaned_data.get("tags"))
1340+
return self.cleaned_data.get("tags")
13331341

13341342
class Meta:
13351343
model = Finding
@@ -1455,6 +1463,7 @@ def clean(self):
14551463

14561464
def clean_tags(self):
14571465
tag_validator(self.cleaned_data.get("tags"))
1466+
return self.cleaned_data.get("tags")
14581467

14591468
def _post_clean(self):
14601469
super()._post_clean()
@@ -1534,6 +1543,7 @@ def clean(self):
15341543

15351544
def clean_tags(self):
15361545
tag_validator(self.cleaned_data.get("tags"))
1546+
return self.cleaned_data.get("tags")
15371547

15381548
class Meta:
15391549
fields = ["title", "cwe", "vulnerability_ids", "cvssv3", "severity", "description", "mitigation", "impact", "references", "tags"]
@@ -1567,6 +1577,7 @@ class Meta:
15671577

15681578
def clean_tags(self):
15691579
tag_validator(self.cleaned_data.get("tags"))
1580+
return self.cleaned_data.get("tags")
15701581

15711582

15721583
class DeleteFindingTemplateForm(forms.ModelForm):
@@ -1623,6 +1634,7 @@ def clean(self):
16231634

16241635
def clean_tags(self):
16251636
tag_validator(self.cleaned_data.get("tags"))
1637+
return self.cleaned_data.get("tags")
16261638

16271639
class Meta:
16281640
model = Finding
@@ -1676,6 +1688,7 @@ def clean(self):
16761688

16771689
def clean_tags(self):
16781690
tag_validator(self.cleaned_data.get("tags"))
1691+
return self.cleaned_data.get("tags")
16791692

16801693

16811694
class AddEndpointForm(forms.Form):
@@ -1742,6 +1755,7 @@ def clean(self):
17421755

17431756
def clean_tags(self):
17441757
tag_validator(self.cleaned_data.get("tags"))
1758+
return self.cleaned_data.get("tags")
17451759

17461760

17471761
class DeleteEndpointForm(forms.ModelForm):

dojo/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,4 +2677,5 @@ def tag_validator(value: str | list[str], exception_class: Callable = Validation
26772677
error_messages.append(f"Value must be a string or list of strings: {value} - {type(value)}.")
26782678

26792679
if error_messages:
2680+
logger.debug(f"Tag validation failed: {error_messages}")
26802681
raise exception_class(error_messages)

0 commit comments

Comments
 (0)