]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
cve-update-nvd2-native: handle all configuration nodes, not just first
authorRoss Burton <ross.burton@arm.com>
Fri, 23 Jun 2023 12:32:49 +0000 (13:32 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 27 Jun 2023 15:23:34 +0000 (16:23 +0100)
Some CVEs, such as CVE-2013-6629, list multiple configurations which are
vulnerable. The current JSON parser only considers the first
configuration.

Instead, consider every configuration. We don't yet handle the AND/OR
logical operators, but this is a step in the right direction.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/meta/cve-update-nvd2-native.bb

index 2b585983ac7e52d189c9b6cfc702b2b6901af0d8..0c627ef2623ac77f4def7cb9d1696940d19887b3 100644 (file)
@@ -323,11 +323,12 @@ def update_db(conn, elt):
                 [cveId, cveDesc, cvssv2, cvssv3, date, accessVector]).close()
 
     try:
-        configurations = elt['cve']['configurations'][0]['nodes']
-        for config in configurations:
-            parse_node_and_insert(conn, config, cveId)
+        for config in elt['cve']['configurations']:
+            # This is suboptimal as it doesn't handle AND/OR and negate, but is better than nothing
+            for node in config["nodes"]:
+                parse_node_and_insert(conn, node, cveId)
     except KeyError:
-        bb.debug(2, "Entry without a configuration")
+        bb.debug(2, "CVE %s has no configurations" % cveId)
 
 do_fetch[nostamp] = "1"