Skip to content

Commit f156277

Browse files
🎉 Add fix_available information to jfrogondemand #12633 (#13124)
1 parent 3ab9c06 commit f156277

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

dojo/tools/jfrog_xray_on_demand_binary_scan/parser.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ def get_severity_justification(vulnerability):
102102
def process_component(component):
103103
mitigation = ""
104104
impact = "**Impact paths**\n\n- "
105+
fix_available = False
105106
fixed_versions = component.get("fixed_versions")
106107
if fixed_versions:
107108
mitigation = "**Versions containing a fix:**\n\n- "
108109
mitigation += "\n- ".join(fixed_versions)
110+
fix_available = True
109111
if "impact_paths" in component:
110112
refs = []
111113
impact_paths_l1 = component["impact_paths"]
@@ -117,7 +119,7 @@ def process_component(component):
117119
refs.append(item["full_path"])
118120
if refs:
119121
impact += "\n- ".join(sorted(set(refs))) # deduplication
120-
return mitigation, impact
122+
return mitigation, impact, fix_available
121123

122124

123125
def get_cve(vulnerability):
@@ -158,7 +160,7 @@ def get_item_set(vulnerability):
158160

159161
for component_name_with_version, component in vulnerability.get("components", {}).items():
160162
component_name, component_version = get_component_name_version(component_name_with_version)
161-
mitigation, impact = process_component(component)
163+
mitigation, impact, fix_available = process_component(component)
162164

163165
title = clean_title(vulnerability["summary"])
164166
# create the finding object
@@ -176,6 +178,7 @@ def get_item_set(vulnerability):
176178
dynamic_finding=False,
177179
cvssv3=cvssv3,
178180
vuln_id_from_tool=vuln_id_from_tool,
181+
fix_available=fix_available,
179182
)
180183
if vulnerability_ids:
181184
finding.unsaved_vulnerability_ids = vulnerability_ids

unittests/tools/test_jfrog_xray_on_demand_binary_scan_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def test_parse_file_with_one_vuln(self):
1919
self.assertEqual("gav://test", item.component_name)
2020
self.assertEqual("CVE-2014-0114", item.unsaved_vulnerability_ids[0])
2121
self.assertEqual("High", item.severity)
22+
self.assertEqual(True, item.fix_available)
2223

2324
def test_parse_file_with_many_vulns(self):
2425
testfile = (get_unit_tests_scans_path("jfrog_xray_on_demand_binary_scan") / "many_vulns.json").open(encoding="utf-8")

0 commit comments

Comments
 (0)