Skip to content

Commit d4e7513

Browse files
🐛 fix nancy file format update #12860 (#13634)
1 parent 83834f0 commit d4e7513

File tree

3 files changed

+165
-5
lines changed

3 files changed

+165
-5
lines changed

dojo/tools/nancy/parser.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22

33
from cvss.cvss3 import CVSS3
4+
from cvss.cvss4 import CVSS4
45

56
from dojo.models import Finding
67

@@ -64,17 +65,18 @@ def get_items(self, vulnerable, test):
6465
out_of_scope=False,
6566
static_finding=True,
6667
dynamic_finding=False,
67-
vuln_id_from_tool=associated_vuln["Id"],
68+
vuln_id_from_tool=associated_vuln.get("Id", associated_vuln.get("ID")),
6869
references="\n".join(references),
6970
)
70-
7171
finding.unsaved_vulnerability_ids = vulnerability_ids
72-
72+
cvss_vector = associated_vuln["CvssVector"]
7373
# CVSSv3 vector
74-
if associated_vuln["CvssVector"]:
74+
if cvss_vector and cvss_vector.startswith("CVSS:3."):
7575
finding.cvssv3 = CVSS3(
7676
associated_vuln["CvssVector"]).clean_vector()
77-
77+
elif cvss_vector and cvss_vector.startswith("CVSS:4."):
78+
finding.cvssv4 = CVSS4(
79+
associated_vuln["CvssVector"]).clean_vector()
7880
# do we have a CWE?
7981
if associated_vuln["Title"].startswith("CWE-"):
8082
cwe = (associated_vuln["Title"]

0 commit comments

Comments
 (0)