From 8e6fe580fa25794673562d6e34c89741acf6581d Mon Sep 17 00:00:00 2001 From: Manuel Sommer Date: Fri, 3 May 2024 15:02:35 +0200 Subject: [PATCH] msdefender: migrate cve to unsaved_vulnerability_ids --- dojo/tools/ms_defender/parser.py | 6 ++++-- unittests/tools/test_ms_defender_parser.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dojo/tools/ms_defender/parser.py b/dojo/tools/ms_defender/parser.py index 3bcdf56e074..e112a5d72cb 100644 --- a/dojo/tools/ms_defender/parser.py +++ b/dojo/tools/ms_defender/parser.py @@ -80,7 +80,8 @@ def process_json(self, vulnerability): if vulnerability['fixingKbId'] is not None: finding.mitigation = vulnerability['fixingKbId'] if vulnerability['cveId'] is not None: - finding.cve = vulnerability['cveId'] + finding.unsaved_vulnerability_ids = list() + finding.unsaved_vulnerability_ids.append(vulnerability['cveId']) self.findings.append(finding) finding.unsaved_endpoints = list() @@ -130,7 +131,8 @@ def process_zip(self, vulnerability, machine): if vulnerability['fixingKbId'] is not None: finding.mitigation = vulnerability['fixingKbId'] if vulnerability['cveId'] is not None: - finding.cve = vulnerability['cveId'] + finding.unsaved_vulnerability_ids = list() + finding.unsaved_vulnerability_ids.append(vulnerability['cveId']) self.findings.append(finding) finding.unsaved_endpoints = list() if machine['computerDnsName'] is not None: diff --git a/unittests/tools/test_ms_defender_parser.py b/unittests/tools/test_ms_defender_parser.py index c4f899e3ab8..a0f5bc7caf4 100644 --- a/unittests/tools/test_ms_defender_parser.py +++ b/unittests/tools/test_ms_defender_parser.py @@ -3,7 +3,7 @@ from dojo.models import Test -class TestSDefenderParser(DojoTestCase): +class TestMSDefenderParser(DojoTestCase): def test_parse_many_findings(self): testfile = open("unittests/scans/ms_defender/report_many_vulns.json") @@ -24,7 +24,7 @@ def test_parse_one_finding(self): finding = findings[0] self.assertEqual("Low", finding.severity) self.assertEqual("CVE-1234-5678_fjweoifjewiofjweoifjeowifjowei", finding.title) - self.assertEqual("CVE-1234-5678", finding.cve) + self.assertEqual("CVE-1234-5678", finding.unsaved_vulnerability_ids[0]) def test_parse_no_finding(self): testfile = open("unittests/scans/ms_defender/report_no_vuln.json")