All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v5 3/3] package/pkg-utils/cve.py: Manage case when package version doesn't exist
Date: Mon, 21 Sep 2020 12:15:15 +0200	[thread overview]
Message-ID: <20200921101515.132359-4-gregory.clement@bootlin.com> (raw)
In-Reply-To: <20200921101515.132359-1-gregory.clement@bootlin.com>

Until now, when a package didn't report a version, then the CVE
comparison was just skipped. It leads most of the time to declare the
package not affected by the CVE.

Instead of it, report the CVE_UNKNOWN status in order to be aware that
the CVE related to this package has to be checked.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
 support/scripts/cve.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/support/scripts/cve.py b/support/scripts/cve.py
index 6396019e0e..3cc01248b2 100755
--- a/support/scripts/cve.py
+++ b/support/scripts/cve.py
@@ -198,6 +198,7 @@ class CVE:
         if self.identifier in cve_ignore_list:
             return self.CVE_DOESNT_AFFECT
 
+        unknown_pkg_version = False
         pkg_version = distutils.version.LooseVersion(version)
         if not hasattr(pkg_version, "version"):
             print("Cannot parse package '%s' version '%s'" % (name, version))
@@ -212,6 +213,7 @@ class CVE:
                 print("No CVE affected version")
                 continue
             if not pkg_version:
+                unknown_pkg_version = True
                 continue
 
             if cpe['v_start']:
@@ -241,4 +243,7 @@ class CVE:
             # We're in the version range affected by this CVE
             return self.CVE_AFFECTS
 
-        return self.CVE_DOESNT_AFFECT
+        if unknown_pkg_version:
+            return self.CVE_UNKNOWN
+        else:
+            return self.CVE_DOESNT_AFFECT
-- 
2.28.0

  parent reply	other threads:[~2020-09-21 10:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 10:15 [Buildroot] [PATCH v5 0/3] Improving CVE reporting Gregory CLEMENT
2020-09-21 10:15 ` [Buildroot] [PATCH v5 1/3] support/script/pkg-stats: Manage the CVEs that need to be check Gregory CLEMENT
2022-01-09 16:33   ` Thomas Petazzoni
2020-09-21 10:15 ` [Buildroot] [PATCH v5 2/3] support/script/cve-checker: " Gregory CLEMENT
2022-01-09 16:33   ` Thomas Petazzoni
2020-09-21 10:15 ` Gregory CLEMENT [this message]
2022-01-09 16:34   ` [Buildroot] [PATCH v5 3/3] package/pkg-utils/cve.py: Manage case when package version doesn't exist Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200921101515.132359-4-gregory.clement@bootlin.com \
    --to=gregory.clement@bootlin.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.