Skip to content

Commit 9c23523

Browse files
lme-ncaMaffooch
andauthored
risk accepted findings are no longer mitigated (#9050)
Co-authored-by: Cody Maffucci <cmmaffucci@gmail.com>
1 parent dc57b79 commit 9c23523

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

dojo/importers/default_reimporter.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,13 @@ def process_matched_special_status_finding(
476476
):
477477
self.unchanged_items.append(existing_finding)
478478
return existing_finding, True
479+
# If the finding is risk accepted and inactive in Defectdojo we do not sync the status from the scanner
480+
# We also need to add the finding to 'unchanged_items' as otherwise it will get mitigated by the reimporter
481+
# (Risk accepted findings are not set to mitigated by Defectdojo)
482+
# We however do not exit the loop as we do want to update the endpoints (in case some endpoints were fixed)
483+
elif existing_finding.risk_accepted and not existing_finding.active:
484+
self.unchanged_items.append(existing_finding)
485+
return existing_finding, False
479486
# The finding was not an exact match, so we need to add more details about from the
480487
# new finding to the existing. Return False here to make process further
481488
return existing_finding, False

unittests/test_import_reimport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ def test_import_reimport_keep_false_positive_and_out_of_scope(self):
11151115
active_findings_before = self.get_test_findings_api(test_id, active=True)
11161116
self.assert_finding_count_json(0, active_findings_before)
11171117

1118-
with assertTestImportModelsCreated(self, reimports=1, affected_findings=1, created=1):
1118+
with assertTestImportModelsCreated(self, reimports=1, affected_findings=1, created=1, untouched=1):
11191119
reimport0 = self.reimport_scan_with_params(test_id, self.zap_sample0_filename)
11201120

11211121
self.assertEqual(reimport0["test"], test_id)

0 commit comments

Comments
 (0)