From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 3/3] support/scripts/pkg-stats: clarify when a CVE/CPE should report as N/A
Date: Wed, 19 May 2021 10:32:12 +0200 [thread overview]
Message-ID: <20210519083212.GI2268078@scaer> (raw)
In-Reply-To: <20210519024638.63607-3-matthew.weber@collins.com>
Matthew, All,
On 2021-05-18 21:46 -0500, Matthew Weber via buildroot spake thusly:
> - If a package doesn't have any versioning, ignore and state that
> - If a package is virtual, CVE=ignore and CPE state virtual
> - For any of these NA cases, don't provide search link and color box
> green
>
> Cc: Yann E. MORIN <yann.morin.1998@free.fr>
> Signed-off-by: Matthew Weber <matthew.weber@collins.com>
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> Changes v1 -> v2
> [Yann
> - Update coloring of case when package is virtual, color boxes green
> for N/A of CPE and CVEs
> ---
> support/scripts/pkg-stats | 24 +++++++++++++++++-------
> 1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> index 0c34388066..cc91d13167 100755
> --- a/support/scripts/pkg-stats
> +++ b/support/scripts/pkg-stats
> @@ -229,7 +229,10 @@ class Package:
> """
> var = self.pkgvar()
> if not self.is_actual_package:
> - self.status['cpe'] = ("na", "no valid package infra")
> + self.status['cpe'] = ("na", "N/A - virtual pkg")
> + return
> + if not self.current_version:
> + self.status['cpe'] = ("na", "no version information available")
> return
>
> if var in self.all_cpeids:
> @@ -587,7 +590,7 @@ def check_package_cves(nvd_path, packages):
> cpe_product_pkgs = defaultdict(list)
> for pkg in packages:
> if not pkg.is_actual_package:
> - pkg.status['cve'] = ("na", "no valid package infra")
> + pkg.status['cve'] = ("na", "N/A")
> continue
> if not pkg.current_version:
> pkg.status['cve'] = ("na", "no version information available")
> @@ -909,6 +912,8 @@ def dump_html_pkg(f, pkg):
> td_class.append("cve-ok")
> elif pkg.is_status_error("cve"):
> td_class.append("cve-nok")
> + elif pkg.is_status_na("cve") and not pkg.is_actual_package:
> + td_class.append("cve-ok")
> else:
> td_class.append("cve-unknown")
> f.write(" <td class=\"%s\">\n" % " ".join(td_class))
> @@ -936,18 +941,23 @@ def dump_html_pkg(f, pkg):
> td_class.append("cpe-ok")
> elif pkg.is_status_error("cpe"):
> td_class.append("cpe-nok")
> + elif pkg.is_status_na("cpe") and not pkg.is_actual_package:
> + td_class.append("cpe-ok")
> else:
> td_class.append("cpe-unknown")
> f.write(" <td class=\"%s\">\n" % " ".join(td_class))
> if pkg.cpeid:
> f.write(" <code>%s</code>\n" % pkg.cpeid)
> if not pkg.is_status_ok("cpe"):
> - if pkg.cpeid:
> - f.write(" <br/>%s <a href=\"https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword=%s\">(Search)</a>\n" % # noqa: E501
> - (pkg.status['cpe'][1], ":".join(pkg.cpeid.split(":")[0:5])))
> + if pkg.is_actual_package and pkg.current_version:
> + if pkg.cpeid:
> + f.write(" <br/>%s <a href=\"https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword=%s\">(Search)</a>\n" % # noqa: E501
> + (pkg.status['cpe'][1], ":".join(pkg.cpeid.split(":")[0:5])))
> + else:
> + f.write(" %s <a href=\"https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword=%s\">(Search)</a>\n" % # noqa: E501
> + (pkg.status['cpe'][1], pkg.name))
> else:
> - f.write(" %s <a href=\"https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword=%s\">(Search)</a>\n" %
> - (pkg.status['cpe'][1], pkg.name))
> + f.write(" %s\n" % pkg.status['cpe'][1])
>
> f.write(" </td>\n")
>
> --
> 2.17.1
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
next prev parent reply other threads:[~2021-05-19 8:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 2:46 [Buildroot] [PATCH v2 1/3] support/scripts/pkg-stats: verified CPE has a known id but not version Matthew Weber
2021-05-19 2:46 ` [Buildroot] [PATCH v2 2/3] support/scripts/pkg-stats: add is_actual_package() and rework has_valid_infra() Matthew Weber
2021-05-19 8:31 ` Yann E. MORIN
2021-05-19 2:46 ` [Buildroot] [PATCH v2 3/3] support/scripts/pkg-stats: clarify when a CVE/CPE should report as N/A Matthew Weber
2021-05-19 8:32 ` Yann E. MORIN [this message]
2021-05-19 8:31 ` [Buildroot] [PATCH v2 1/3] support/scripts/pkg-stats: verified CPE has a known id but not version Yann E. MORIN
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=20210519083212.GI2268078@scaer \
--to=yann.morin.1998@free.fr \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox