Skip to content

Commit 6acc640

Browse files
committed
fix(nvd_source): fix configuration without nodes
https://nvd.nist.gov/vuln/detail/cve-2025-40939 has the following configurations: [{}] This will result in a crash as current code wrongly assumes that all configuration object has a nodes parameter Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 161560d commit 6acc640

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ jobs:
637637
egress-policy: block
638638
allowed-endpoints: >
639639
access.redhat.com:443
640+
amazonaws.com:443
640641
api.github.com:443
641642
azure.archive.ubuntu.com:80
642643
csrc.nist.gov:443

cve_bin_tool/data_sources/nvd_source.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ def format_data(self, all_cve_entries):
181181
# return list of versions
182182
affects_list = []
183183
if "configurations" in cve_item:
184-
for node in cve_item["configurations"]["nodes"]:
185-
affects_list.extend(self.parse_node(node))
186-
if "children" in node:
187-
for child in node["children"]:
188-
affects_list.extend(self.parse_node(child))
184+
if "nodes" in cve_item["configurations"]:
185+
for node in cve_item["configurations"]["nodes"]:
186+
affects_list.extend(self.parse_node(node))
187+
if "children" in node:
188+
for child in node["children"]:
189+
affects_list.extend(self.parse_node(child))
189190

190191
for affects in affects_list:
191192
affects["cve_id"] = cve["ID"]
@@ -351,12 +352,13 @@ def format_data_api2(self, all_cve_entries):
351352
affects_list = []
352353
if "configurations" in cve_item:
353354
for configuration in cve_item["configurations"]:
354-
for node in configuration["nodes"]:
355-
self.LOGGER.debug(f"Processing {node} for {cve_item['id']}")
356-
affects_list.extend(self.parse_node_api2(node))
357-
if "children" in node:
358-
for child in node["children"]:
359-
affects_list.extend(self.parse_node_api2(child))
355+
if "nodes" in configuration:
356+
for node in configuration["nodes"]:
357+
self.LOGGER.debug(f"Processing {node} for {cve_item['id']}")
358+
affects_list.extend(self.parse_node_api2(node))
359+
if "children" in node:
360+
for child in node["children"]:
361+
affects_list.extend(self.parse_node_api2(child))
360362
else:
361363
LOGGER.debug(f"No configuration information for {cve_item['id']}")
362364
for affects in affects_list:

0 commit comments

Comments
 (0)