Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions dojo/tools/trivy/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ def get_result_items(self, test, results, service_name=None, artifact_name=""):
package_version = vuln.get("InstalledVersion", "")
references = "\n".join(vuln.get("References", []))
mitigation = vuln.get("FixedVersion", "")
fix_available = True
if mitigation == "":
fix_available = False
impact = vuln.get("Status", "")
status_fields = self.convert_trivy_status(vuln.get("Status", ""))
cwe = int(vuln["CweIDs"][0].split("-")[1]) if len(vuln.get("CweIDs", [])) > 0 else 0
Expand Down Expand Up @@ -317,6 +320,7 @@ def get_result_items(self, test, results, service_name=None, artifact_name=""):
cvssv3_score=cvssv3_score,
static_finding=True,
dynamic_finding=False,
fix_available=fix_available,
tags=[vul_type, target_class],
service=service_name,
**status_fields,
Expand Down Expand Up @@ -370,6 +374,7 @@ def get_result_items(self, test, results, service_name=None, artifact_name=""):
references=references,
description=description,
mitigation=misc_resolution,
fix_available=True,
static_finding=True,
dynamic_finding=False,
tags=[target_type, target_class],
Expand Down Expand Up @@ -402,6 +407,7 @@ def get_result_items(self, test, results, service_name=None, artifact_name=""):
line=secret_start_line,
static_finding=True,
dynamic_finding=False,
fix_available=True,
tags=[target_class],
service=service_name,
)
Expand Down Expand Up @@ -435,6 +441,7 @@ def get_result_items(self, test, results, service_name=None, artifact_name=""):
url=license_link,
static_finding=True,
dynamic_finding=False,
fix_available=True,
tags=[target_class],
service=service_name,
)
Expand Down
1 change: 1 addition & 0 deletions unittests/tools/test_trivy_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_scheme_2_many_vulns(self):
self.assertEqual("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", finding.cvssv3)
self.assertTrue(finding.static_finding)
self.assertFalse(finding.dynamic_finding)
self.assertTrue(finding.fix_available)

def test_misconfigurations_and_secrets(self):
with sample_path("misconfigurations_and_secrets.json").open(encoding="utf-8") as test_file:
Expand Down