Skip to contentSkip to conversation

support/scripts/cve.py: handle missing nodes in cpe configurations

PATCH In review Daniel Lang via buildroot 1 participant 2 messages Aug 23, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/scripts/cve.py: handle missing nodes in cpe configurations

Recent updates to the CPE database make the script fail with:

File "buildroot/support/scripts/cve.py", line 173, in each_cpe
for node in nodes['nodes']:
~~~~~^^^^^^^^^
KeyError: 'nodes'

---
 support/scripts/cve.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/scripts/cve.py +1 -1
index 1cbe24c02d..ba41762fa0 100755
@@ -170,7 +170,7 @@ class CVE:
 
     def each_cpe(self):
         for nodes in self.nvd_cve.get('configurations', []):
-            for node in nodes['nodes']:
+            for node in nodes.get('nodes', []):
                 for cpe in self.parse_node(node):
                     yield cpe
 
Signature · 6 lines
2.50.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Daniel, All,

Le 23/08/2025 à 06:58, Daniel Lang via buildroot a écrit :

Quoted 1 line

Recent updates to the CPE database make the script fail with:

Do you have any info about those updates?

Thomas noticed that we didn't receive any "Daily results" email today (the last one was the 22/08/2025). He just sent the same patch [1] with a slightly improved commit log.

We need this fix today in order to receive the "Daily results" email tomorrow. I'll merge Thomas's patch now, but thanks for your contribution!

[1]
https://lore.kernel.org/buildroot/[email protected]/T/#u

Best regards,
Romain

Quoted 16 lines

File "buildroot/support/scripts/cve.py", line 173, in each_cpe
for node in nodes['nodes']:
~~~~~^^^^^^^^^
KeyError: 'nodes'

---
 support/scripts/cve.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/scripts/cve.py +0 -0
index 1cbe24c02d..ba41762fa0 100755

support/scripts/cve.py class CVE: · line 176

Quoted 8 lines
support/scripts/cve.py +1 -1
@@ -170,7 +170,7 @@ class CVE:
 
     def each_cpe(self):
         for nodes in self.nvd_cve.get('configurations', []):
-            for node in nodes['nodes']:
+            for node in nodes.get('nodes', []):
                 for cpe in self.parse_node(node):
                     yield cpe
 

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot