Skip to contentSkip to conversation

cve-update-db-native: remove

PATCH In review [email protected] 2 participants 5 messages Jun 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 cve-update-db-native: remove

From: Ross Burton <[email protected]>

The replacement cve-update-nvd2-native is working, so we can remove the old recipe now.

---
 meta/conf/distro/include/maintainers.inc      |   1 -
 meta/lib/oeqa/selftest/cases/distrodata.py    |   2 +-
 .../recipes-core/meta/cve-update-db-native.bb | 288 ------------------
 3 files changed, 1 insertion(+), 290 deletions(-)
 delete mode 100644 meta/recipes-core/meta/cve-update-db-native.bb
meta/conf/distro/include/maintainers.inc +0 -1
index 9bb5c5205c2..e27295a7cf5 100644
@@ -127,7 +127,6 @@ RECIPE_MAINTAINER:pn-cryptodev-module = "Robert Yang <[email protected]>
 RECIPE_MAINTAINER:pn-cryptodev-tests = "Robert Yang <[email protected]>"
 RECIPE_MAINTAINER:pn-cups = "Chen Qi <[email protected]>"
 RECIPE_MAINTAINER:pn-curl = "Robert Joslyn <[email protected]>"
-RECIPE_MAINTAINER:pn-cve-update-db-native = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-cve-update-nvd2-native = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-cwautomacros = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-db = "Unassigned <[email protected]>"
meta/lib/oeqa/selftest/cases/distrodata.py +1 -1
index c83a3a7bd67..111bd3c9beb 100644
@@ -92,7 +92,7 @@ The following recipes do not have a DESCRIPTION. Please add an entry for DESCRIP
 
         def is_maintainer_exception(entry):
             exceptions = ["musl", "newlib", "linux-yocto", "linux-dummy", "mesa-gl", "libgfortran", "libx11-compose-data",
-                          "cve-update-db-native","cve-update-nvd2-native",]
+                          "cve-update-nvd2-native",]
             for i in exceptions:
                  if i in entry:
                      return True
meta/recipes-core/meta/cve-update-db-native.bb deleted +0 -288

288 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/4 ghostscript: remove CVE_CHECK_IGNORE for CVE-2013-6629

From: Ross Burton <[email protected]>

This CVE now has a version range, indicating that this Ghostscript release isn't vulnerable.

---
 meta/recipes-extended/ghostscript/ghostscript_10.01.1.bb | 3 ---
 1 file changed, 3 deletions(-)
meta/recipes-extended/ghostscript/ghostscript_10.01.1.bb +0 -3
index f03ebf44789..0d41242bc2c 100644
@@ -18,9 +18,6 @@ DEPENDS = "tiff jpeg fontconfig cups libpng freetype zlib"
 UPSTREAM_CHECK_URI = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases"
 UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.tar"
 
-# We use a system libjpeg-turbo which has this fix
-CVE_CHECK_IGNORE += "CVE-2013-6629"
-
 def gs_verdir(v):
     return "".join(v.split("."))
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/4 cve-update-nvd2-native: handle all configuration nodes, not just first

In reply to [email protected]

From: Ross Burton <[email protected]>

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.

---
 meta/recipes-core/meta/cve-update-nvd2-native.bb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
meta/recipes-core/meta/cve-update-nvd2-native.bb +5 -4
index 2b585983ac7..0c627ef2623 100644
@@ -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"
 
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH 3/4] cve-update-nvd2-native: handle all configuration nodes, not just first

Quoted 31 lines · On Fri, 23 Jun 2023, 08:32 , <[email protected]> wrote:

From: Ross Burton <[email protected]>

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.

---
 meta/recipes-core/meta/cve-update-nvd2-native.bb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
meta/recipes-core/meta/cve-update-nvd2-native.bb +2 -3
index 2b585983ac7..0c627ef2623 100644
@@ -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

meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db(conn, elt): · line 333

Quoted 7 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3 -1
+            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"

Looks good to me, thank you Ross.

Regards,
Marta

Quoted 1 line
#4 lore raw

PATCH 4/4 cve-update-nvd2-native: use exact times, don't truncate

In reply to [email protected]

From: Ross Burton <[email protected]>

When requesting updates in a specific range, use the actual current time and database mtime instead of truncating to midnight, and explicitly set the timezone to UTC so that NIST don't treat the timestamps as _their_ local time when they're _our_ local time.

---
 meta/recipes-core/meta/cve-update-nvd2-native.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/meta/cve-update-nvd2-native.bb +2 -2
index 0c627ef2623..61f4d47f961 100644
@@ -172,8 +172,8 @@ def update_db_file(db_tmp_file, d, database_time):
     # The maximum range for time is 120 days
     # Force a complete update if our range is longer
     if (database_time != 0):
-        database_date = datetime.datetime.combine(datetime.date.fromtimestamp(database_time), datetime.time())
-        today_date = datetime.datetime.combine(datetime.date.today(), datetime.time())
+        database_date = datetime.datetime.fromtimestamp(database_time, tz=datetime.timezone.utc)
+        today_date = datetime.datetime.now(tz=datetime.timezone.utc)
         delta = today_date - database_date
         if delta.days < 120:
             bb.debug(2, "CVE database: performing partial update")
Signature · 1 line
2.34.1