From 305146681c43b2d5718f50c62600760a691db1da Mon Sep 17 00:00:00 2001 From: manuelsommer <47991713+manuel-sommer@users.noreply.github.com> Date: Wed, 28 Feb 2024 23:30:31 +0100 Subject: [PATCH] ASFF Parser: Respect `active` status based on `RecordState` field (#9567) * resolve asff parser doing * add unittest to retrigger unittests --- dojo/tools/asff/parser.py | 6 +++++- unittests/tools/test_asff_parser.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dojo/tools/asff/parser.py b/dojo/tools/asff/parser.py index e66102d0f46..c5831d025b3 100644 --- a/dojo/tools/asff/parser.py +++ b/dojo/tools/asff/parser.py @@ -34,6 +34,10 @@ def get_findings(self, file, test): else: mitigation = None references = None + if item.get("RecordState") and item.get("RecordState") == "ACTIVE": + active = True + else: + active = False finding = Finding( title=item.get("Title"), @@ -42,7 +46,7 @@ def get_findings(self, file, test): mitigation=mitigation, references=references, severity=self.get_severity(item.get("Severity")), - active=True, # TODO: manage attribute 'RecordState' + active=active, unique_id_from_tool=item.get("Id"), ) diff --git a/unittests/tools/test_asff_parser.py b/unittests/tools/test_asff_parser.py index 9426cd3fb61..bcbe7bb56b5 100644 --- a/unittests/tools/test_asff_parser.py +++ b/unittests/tools/test_asff_parser.py @@ -59,3 +59,4 @@ def test_asff_guardduty(self): for index, finding in enumerate(findings): self.common_check_finding(finding, data, index, guarddutydate=True) self.assertEqual(finding.unsaved_endpoints[0], Endpoint(host="10.0.0.1")) + self.assertTrue(finding.active)