Skip to content

Commit bae01df

Browse files
defender: fix no vulnerabilities check (#12448)
1 parent 05a74d5 commit bae01df

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

dojo/tools/ms_defender/parser.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,20 @@ def get_findings(self, file, test):
3434
input_zip = zipfile.ZipFile(file.name, "r")
3535
else:
3636
input_zip = zipfile.ZipFile(file, "r")
37+
3738
zipdata = {name: input_zip.read(name) for name in input_zip.namelist()}
38-
if zipdata.get("vulnerabilities/") is None:
39-
return []
4039
vulnerabilityfiles = []
4140
machinefiles = []
4241
for content in list(zipdata):
4342
if "vulnerabilities/" in content and content != "vulnerabilities/":
4443
vulnerabilityfiles.append(content)
4544
if "machines/" in content and content != "machines/":
4645
machinefiles.append(content)
46+
47+
if len(vulnerabilityfiles) == 0:
48+
logger.debug("No vulnerabilities.json files found in the vulnerabilities/ folder")
49+
return []
50+
4751
vulnerabilities = []
4852
machines = {}
4953
for vulnerabilityfile in vulnerabilityfiles:

0 commit comments

Comments
 (0)