diff --git a/docs/content/en/open_source/upgrading/2.52.md b/docs/content/en/open_source/upgrading/2.52.md index c15bad237f8..04a206c74ff 100644 --- a/docs/content/en/open_source/upgrading/2.52.md +++ b/docs/content/en/open_source/upgrading/2.52.md @@ -5,6 +5,20 @@ weight: -20251006 description: MobSF parsers & Helm chart changes. --- +## Fix UI overwriting service field from parsers + +The web form in the UI by default sends an empty string, which ended up overwriting the service value provided by parsers. + +Only a few parsers do this, so the impact of this fix is low: + +- Trivy Scan +- Trivy Operator Scan +- Hydra Scan +- JFrog Xray API Summary Artifact Scan +- StackHawk HawkScan + +See [PR 13517](https://github.com/DefectDojo/django-DefectDojo/pull/13517) for more details. + ## Deduplication fix of `UNIQUE_ID_OR_HASH_CODE` A bug was fixed in the `UNIQUE_ID_OR_HASH_CODE` algorithm where it stopped processing candidate findings with equal `unique_id_from_tool` or `hash_code` value. Strictly speaking this is not a breaking change, but we wanted to make you aware that you can see more (better) more deduplicatation for parsers using this algorithm. diff --git a/dojo/engagement/views.py b/dojo/engagement/views.py index a02ff45f6aa..b45b417e39c 100644 --- a/dojo/engagement/views.py +++ b/dojo/engagement/views.py @@ -962,19 +962,19 @@ def process_form( "active": None, "verified": None, "scan_type": request.POST.get("scan_type"), - "test_title": form.cleaned_data.get("test_title"), + "test_title": form.cleaned_data.get("test_title") or None, "tags": form.cleaned_data.get("tags"), - "version": form.cleaned_data.get("version"), - "branch_tag": form.cleaned_data.get("branch_tag", None), - "build_id": form.cleaned_data.get("build_id", None), - "commit_hash": form.cleaned_data.get("commit_hash", None), - "api_scan_configuration": form.cleaned_data.get("api_scan_configuration", None), - "service": form.cleaned_data.get("service", None), + "version": form.cleaned_data.get("version") or None, + "branch_tag": form.cleaned_data.get("branch_tag") or None, + "build_id": form.cleaned_data.get("build_id") or None, + "commit_hash": form.cleaned_data.get("commit_hash") or None, + "api_scan_configuration": form.cleaned_data.get("api_scan_configuration") or None, + "service": form.cleaned_data.get("service") or None, "close_old_findings": form.cleaned_data.get("close_old_findings", None), "apply_tags_to_findings": form.cleaned_data.get("apply_tags_to_findings", False), "apply_tags_to_endpoints": form.cleaned_data.get("apply_tags_to_endpoints", False), "close_old_findings_product_scope": form.cleaned_data.get("close_old_findings_product_scope", None), - "group_by": form.cleaned_data.get("group_by", None), + "group_by": form.cleaned_data.get("group_by") or None, "create_finding_groups_for_all_findings": form.cleaned_data.get("create_finding_groups_for_all_findings", None), "environment": self.get_development_environment(environment_name=form.cleaned_data.get("environment")), }) diff --git a/dojo/importers/default_reimporter.py b/dojo/importers/default_reimporter.py index 17775eb22ae..a1625a85f33 100644 --- a/dojo/importers/default_reimporter.py +++ b/dojo/importers/default_reimporter.py @@ -170,7 +170,11 @@ def process_findings( # we need to make sure there are no side effects such as closing findings # for findings with a different service value # https://github.com/DefectDojo/django-DefectDojo/issues/12754 - original_findings = self.test.finding_set.all().filter(service=self.service) + if self.service is not None: + original_findings = self.test.finding_set.all().filter(service=self.service) + else: + original_findings = self.test.finding_set.all().filter(Q(service__isnull=True) | Q(service__exact="")) + logger.debug(f"original_findings_qyer: {original_findings.query}") self.original_items = list(original_findings) logger.debug(f"original_items: {[(item.id, item.hash_code) for item in self.original_items]}") diff --git a/dojo/models.py b/dojo/models.py index 2c283c8d795..dccfbaa4c7e 100644 --- a/dojo/models.py +++ b/dojo/models.py @@ -3010,6 +3010,7 @@ def hash_fields(self, fields_to_hash): if hasattr(settings, "HASH_CODE_FIELDS_ALWAYS"): for field in settings.HASH_CODE_FIELDS_ALWAYS: if getattr(self, field): + deduplicationLogger.debug("adding HASH_CODE_FIELDS_ALWAYSfield %s to hash_fields: %s", field, getattr(self, field)) fields_to_hash += str(getattr(self, field)) logger.debug("fields_to_hash : %s", fields_to_hash) diff --git a/dojo/templates/dojo/view_finding.html b/dojo/templates/dojo/view_finding.html index a992a22d401..c8f79b63b25 100755 --- a/dojo/templates/dojo/view_finding.html +++ b/dojo/templates/dojo/view_finding.html @@ -538,9 +538,7 @@
| Service | - {% endif %} {% if finding.file_path %}Location | {% endif %} @@ -571,13 +569,11 @@
|---|---|
| {{ finding.service }} | - {% endif %} {% if finding.file_path %}diff --git a/dojo/test/views.py b/dojo/test/views.py index ad98b4e17a9..b5777f15cac 100644 --- a/dojo/test/views.py +++ b/dojo/test/views.py @@ -905,15 +905,15 @@ def process_form( "minimum_severity": form.cleaned_data.get("minimum_severity"), "do_not_reactivate": form.cleaned_data.get("do_not_reactivate"), "tags": form.cleaned_data.get("tags"), - "version": form.cleaned_data.get("version"), - "branch_tag": form.cleaned_data.get("branch_tag", None), - "build_id": form.cleaned_data.get("build_id", None), - "commit_hash": form.cleaned_data.get("commit_hash", None), - "api_scan_configuration": form.cleaned_data.get("api_scan_configuration", None), - "service": form.cleaned_data.get("service", None), + "version": form.cleaned_data.get("version") or None, + "branch_tag": form.cleaned_data.get("branch_tag") or None, + "build_id": form.cleaned_data.get("build_id") or None, + "commit_hash": form.cleaned_data.get("commit_hash") or None, + "api_scan_configuration": form.cleaned_data.get("api_scan_configuration") or None, + "service": form.cleaned_data.get("service") or None, "apply_tags_to_findings": form.cleaned_data.get("apply_tags_to_findings", False), "apply_tags_to_endpoints": form.cleaned_data.get("apply_tags_to_endpoints", False), - "group_by": form.cleaned_data.get("group_by", None), + "group_by": form.cleaned_data.get("group_by") or None, "close_old_findings": form.cleaned_data.get("close_old_findings", None), "create_finding_groups_for_all_findings": form.cleaned_data.get("create_finding_groups_for_all_findings", None), }) |