Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msdefender: migrate cve to unsaved_vulnerability_ids #10109

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dojo/tools/ms_defender/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions unittests/tools/test_ms_defender_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
Loading