From c061c6deed093311611796ad532c27b51b9c7048 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 4 Jan 2025 18:43:41 +0100 Subject: [PATCH 1/2] match all findings on reimport --- dojo/importers/default_reimporter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dojo/importers/default_reimporter.py b/dojo/importers/default_reimporter.py index 0c4159ed669..78ecb8e2a0c 100644 --- a/dojo/importers/default_reimporter.py +++ b/dojo/importers/default_reimporter.py @@ -204,11 +204,11 @@ def process_findings( deduplicationLogger.debug(f"found {len(matched_findings)} findings matching with current new finding") # Determine how to proceed based on whether matches were found or not if matched_findings: - existing_finding = matched_findings[0] - finding, force_continue = self.process_matched_finding( - unsaved_finding, - existing_finding, - ) + for existing_finding in matched_findings: + finding, force_continue = self.process_matched_finding( + unsaved_finding, + existing_finding, + ) # Determine if we should skip the rest of the loop if force_continue: continue From f736c7a4627394bead7cd24aff09c84066dba503 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 5 Jan 2025 21:25:37 +0100 Subject: [PATCH 2/2] move rest of the loop --- dojo/importers/default_reimporter.py | 30 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/dojo/importers/default_reimporter.py b/dojo/importers/default_reimporter.py index 78ecb8e2a0c..8cc04a1ab6e 100644 --- a/dojo/importers/default_reimporter.py +++ b/dojo/importers/default_reimporter.py @@ -209,19 +209,23 @@ def process_findings( unsaved_finding, existing_finding, ) - # Determine if we should skip the rest of the loop - if force_continue: - continue - # Update endpoints on the existing finding with those on the new finding - if finding.dynamic_finding: - logger.debug( - "Re-import found an existing dynamic finding for this new " - "finding. Checking the status of endpoints", - ) - self.endpoint_manager.update_endpoint_status( - existing_finding, - unsaved_finding, - self.user, + # Determine if we should skip the rest of the loop + if force_continue: + continue + + last_existing_finding = existing_finding + + if last_existing_finding is not None: + # Update endpoints on the existing finding with those on the new finding + if finding.dynamic_finding: + logger.debug( + "Re-import found an existing dynamic finding for this new " + "finding. Checking the status of endpoints", + ) + self.endpoint_manager.update_endpoint_status( + last_existing_finding, + unsaved_finding, + self.user, ) else: finding = self.process_finding_that_was_not_matched(unsaved_finding)