Openembedded Core Discussions
 help / color / mirror / Atom feed
* [scarthgap][PATCH 0/2] Scope global CVE exclusions by product
@ 2026-11-20  9:23 P. Tatrai
  2026-11-20  9:23 ` [scarthgap][PATCH 1/2] cve-check: keep global CVE exclusions out of unrelated reports P. Tatrai
  2026-11-20  9:23 ` [scarthgap][PATCH 2/2] cve-exclusions: qualify global assessments by product P. Tatrai
  0 siblings, 2 replies; 5+ messages in thread
From: P. Tatrai @ 2026-11-20  9:23 UTC (permalink / raw)
  To: openembedded-core; +Cc: Peter Tatrai

From: Peter Tatrai <peter.tatrai.ext@siemens.com>

The Scarthgap SPDX 3.0 backport did not bring over product filtering
for CVE_STATUS assessments. As a result, global exclusions can appear
in CVE-check and SPDX/VEX reports for recipes they do not apply to.

The first patch adapts Wrynose's parser and matcher while retaining
Scarthgap's existing APIs and the behavior of unscoped entries. The
second qualifies the existing global exclusions without adding or
removing assessments.

Peter Tatrai (2):
  cve-check: keep global CVE exclusions out of unrelated reports
  cve-exclusions: qualify global assessments by product

 meta/classes/vex.bbclass                      |  1 -
 .../distro/include/cve-extra-exclusions.inc   | 24 +++---
 meta/lib/oe/cve_check.py                      | 76 +++++++++++++++++--
 meta/lib/oe/spdx30_tasks.py                   |  1 -
 meta/lib/oeqa/selftest/cases/cve_check.py     | 48 ++++++++++++
 5 files changed, 129 insertions(+), 21 deletions(-)


base-commit: fc4316861becc9f0d41857b49f6438929ab4c291
-- 
2.39.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [scarthgap][PATCH 1/2] cve-check: keep global CVE exclusions out of unrelated reports
  2026-11-20  9:23 [scarthgap][PATCH 0/2] Scope global CVE exclusions by product P. Tatrai
@ 2026-11-20  9:23 ` P. Tatrai
  2026-11-26 15:15   ` [OE-core] " Yoann Congal
  2026-11-20  9:23 ` [scarthgap][PATCH 2/2] cve-exclusions: qualify global assessments by product P. Tatrai
  1 sibling, 1 reply; 5+ messages in thread
From: P. Tatrai @ 2026-11-20  9:23 UTC (permalink / raw)
  To: openembedded-core; +Cc: Peter Tatrai

From: Peter Tatrai <peter.tatrai.ext@siemens.com>

The Scarthgap SPDX 3.0 backport [1] did not bring over product
filtering for CVE_STATUS assessments. The follow-up [2] made SPDX
export all CVE_STATUS assessments, exposing the same problem in SPDX
that already affected CVE-check reports.

Global exclusion lists are loaded for every recipe. Without product
filtering, assessments intended for one product can appear in the
CVE-check and SPDX/VEX reports of unrelated packages.

Backport the scoped parser from OE-Core commit abca80a716e9 and the
product matcher from 452e605b55ad as they appear in Wrynose. Preserve
Scarthgap's tuple and set APIs and the behavior of unscoped entries.

[1] Scarthgap SPDX 3.0 backport:
https://git.openembedded.org/openembedded-core/commit/?id=9c9b9545049a
[2] Export all CVE_STATUS assessments:
https://git.openembedded.org/openembedded-core/commit/?id=9a204670b1c0

Signed-off-by: Peter Tatrai <peter.tatrai.ext@siemens.com>
---
 meta/classes/vex.bbclass                  |  1 -
 meta/lib/oe/cve_check.py                  | 76 ++++++++++++++++++++---
 meta/lib/oe/spdx30_tasks.py               |  1 -
 meta/lib/oeqa/selftest/cases/cve_check.py | 48 ++++++++++++++
 4 files changed, 117 insertions(+), 9 deletions(-)

diff --git a/meta/classes/vex.bbclass b/meta/classes/vex.bbclass
index 97213ea..3c44dbb 100644
--- a/meta/classes/vex.bbclass
+++ b/meta/classes/vex.bbclass
@@ -141,7 +141,6 @@ python do_generate_vex () {
     for cve_id in (d.getVarFlags("CVE_STATUS") or {}):
         mapping, detail, description = decode_cve_status(d, cve_id)
         if not mapping or not detail:
-            bb.warn(f"Skipping {cve_id} — missing or unknown CVE status")
             continue
         cve_data[cve_id] = {
             "abbrev-status": mapping,
diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py
index 7c09b78..9620dc5 100644
--- a/meta/lib/oe/cve_check.py
+++ b/meta/lib/oe/cve_check.py
@@ -227,22 +227,84 @@ def convert_cve_version(version):
 
 def decode_cve_status(d, cve):
     """
-    Convert CVE_STATUS into status, detail and description.
+    Convert a matching CVE_STATUS into status, detail and description.
+
+    Keep the Scarthgap tuple API for cve-check and existing SPDX consumers.
     """
-    status = d.getVarFlag("CVE_STATUS", cve)
+    status = decode_cve_status_scoped(d, cve)
     if not status:
         return ("", "", "")
+    # Scarthgap applies unscoped statuses even when CVE_PRODUCT is empty.
+    unscoped = status["vendor"] == status["product"] == "*"
+    if not unscoped and not has_cve_product_match(status, d.getVar("CVE_PRODUCT") or ""):
+        return ("", "", "")
+    return (status["mapping"], status["detail"], status["description"])
+
+
+def has_cve_product_match(detailed_status, products):
+    """
+    Check product/vendor match between detailed_status from decode_cve_status and a string of
+    products (like from CVE_PRODUCT)
+    """
+    for product in products.split():
+        vendor = "*"
+        if ":" in product:
+            vendor, product = product.split(":", 1)
+
+        if (vendor == detailed_status["vendor"] or detailed_status["vendor"] == "*") and \
+            (product == detailed_status["product"] or detailed_status["product"] == "*"):
+            return True
 
-    status_split = status.split(':', 1)
-    detail = status_split[0]
-    description = status_split[1].strip() if (len(status_split) > 1) else ""
+    #if no match, return False
+    return False
 
+
+def decode_cve_status_scoped(d, cve):
+    """
+    Convert CVE_STATUS into status, vendor, product, detail and description.
+    """
+    status = d.getVarFlag("CVE_STATUS", cve)
+    if not status:
+        return {}
+
+    status_split = status.split(':', 4)
+    status_out = {}
+    status_out["detail"] = status_split[0]
+    product = "*"
+    vendor = "*"
+    description = ""
+    if len(status_split) >= 4 and status_split[1].strip() == "cpe":
+        # Both vendor and product are mandatory if cpe: present, the syntax is then:
+        # detail: cpe:vendor:product:description
+        vendor = status_split[2].strip()
+        product = status_split[3].strip()
+        description = status_split[4].strip()
+    elif len(status_split) >= 2 and status_split[1].strip() == "cpe":
+        # Malformed CPE
+        bb.warn(
+            'Invalid CPE information for CVE_STATUS[%s] = "%s", not setting CPE'
+            % (cve, status)
+        )
+    else:
+        # Other case: no CPE, the syntax is then:
+        # detail: description
+        description = status.split(':', 1)[1].strip() if (len(status_split) > 1) else ""
+
+    status_out["vendor"] = vendor
+    status_out["product"] = product
+    status_out["description"] = description
+
+    detail = status_out["detail"]
     status_mapping = d.getVarFlag("CVE_CHECK_STATUSMAP", detail)
     if status_mapping is None:
-        bb.warn('Invalid detail "%s" for CVE_STATUS[%s] = "%s", fallback to Unpatched' % (detail, cve, status))
+        bb.warn(
+            'Invalid detail "%s" for CVE_STATUS[%s] = "%s", fallback to Unpatched'
+            % (detail, cve, status)
+        )
         status_mapping = "Unpatched"
+    status_out["mapping"] = status_mapping
 
-    return (status_mapping, detail, description)
+    return status_out
 
 def extend_cve_status(d):
     # do this only once in case multiple classes use this
diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
index 0e9c6fa..539901f 100644
--- a/meta/lib/oe/spdx30_tasks.py
+++ b/meta/lib/oe/spdx30_tasks.py
@@ -470,7 +470,6 @@ def _get_cves_info(d):
     for cve_id in (d.getVarFlags("CVE_STATUS") or {}):
         mapping, detail, description = oe.cve_check.decode_cve_status(d, cve_id)
         if not mapping or not detail:
-            bb.warn(f"Skipping {cve_id} — missing or unknown CVE status")
             continue
         yield cve_id, mapping, detail, description
         patched_cves.discard(cve_id)
diff --git a/meta/lib/oeqa/selftest/cases/cve_check.py b/meta/lib/oeqa/selftest/cases/cve_check.py
index 60cecd1..8cd5eb9 100644
--- a/meta/lib/oeqa/selftest/cases/cve_check.py
+++ b/meta/lib/oeqa/selftest/cases/cve_check.py
@@ -11,6 +11,54 @@ from oeqa.utils.commands import bitbake, get_bb_vars
 
 class CVECheck(OESelftestTestCase):
 
+    def test_scoped_status(self):
+        import bb
+        from oe.cve_check import decode_cve_status, extend_cve_status, get_patched_cves
+        from unittest.mock import patch
+
+        d = bb.data.init()
+        cve = "CVE-2020-0001"
+        d.setVarFlag("CVE_CHECK_STATUSMAP", "fixed-version", "Patched")
+        d.setVarFlag("CVE_CHECK_STATUSMAP", "ignored", "Ignored")
+        d.setVarFlag("CVE_STATUS", cve, "fixed-version: cpe:oracle:berkeley_db: Fixed: see upstream")
+        for product, expected in (
+            ("oracle:berkeley_db", ("Patched", "fixed-version", "Fixed: see upstream")),
+            ("other:berkeley_db", ("", "", "")),
+            ("oracle:zlib", ("", "", "")),
+            ("zlib:zlib oracle:berkeley_db", ("Patched", "fixed-version", "Fixed: see upstream")),
+        ):
+            with self.subTest(product=product):
+                d.setVar("CVE_PRODUCT", product)
+                self.assertEqual(decode_cve_status(d, cve), expected)
+                with patch("oe.patch.src_patches", return_value=[]):
+                    self.assertEqual(get_patched_cves(d), {cve} if expected[0] else set())
+
+        d.setVar("CVE_PRODUCT", "zlib")
+        d.setVarFlag("CVE_STATUS", cve, "ignored: Existing unscoped reason: unchanged")
+        self.assertEqual(decode_cve_status(d, cve),
+                         ("Ignored", "ignored", "Existing unscoped reason: unchanged"))
+        d.setVar("CVE_STATUS_GROUPS", "SCOPED_GROUP")
+        d.setVar("SCOPED_GROUP", cve)
+        d.setVarFlag("SCOPED_GROUP", "status", "ignored: cpe:*:zlib: Matching group")
+        extend_cve_status(d)
+        self.assertEqual(decode_cve_status(d, cve), ("Ignored", "ignored", "Matching group"))
+        d.setVar("CVE_PRODUCT", "glibc")
+        self.assertEqual(decode_cve_status(d, cve), ("", "", ""))
+
+    def test_scoped_status_spdx(self):
+        import bb
+        import oe.spdx30_tasks
+        from unittest.mock import patch
+
+        d = bb.data.init()
+        d.setVar("CVE_PRODUCT", "zlib:zlib")
+        d.setVarFlag("CVE_CHECK_STATUSMAP", "ignored", "Ignored")
+        d.setVarFlag("CVE_STATUS", "CVE-2020-0001", "ignored: cpe:*:berkeley_db: Not zlib")
+        d.setVarFlag("CVE_STATUS", "CVE-2020-0002", "ignored: cpe:*:zlib: Matches zlib")
+        with patch("oe.patch.src_patches", return_value=[]):
+            self.assertEqual(list(oe.spdx30_tasks._get_cves_info(d)),
+                             [("CVE-2020-0002", "Ignored", "ignored", "Matches zlib")])
+
     def test_version_compare(self):
         from oe.cve_check import Version
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [scarthgap][PATCH 2/2] cve-exclusions: qualify global assessments by product
  2026-11-20  9:23 [scarthgap][PATCH 0/2] Scope global CVE exclusions by product P. Tatrai
  2026-11-20  9:23 ` [scarthgap][PATCH 1/2] cve-check: keep global CVE exclusions out of unrelated reports P. Tatrai
@ 2026-11-20  9:23 ` P. Tatrai
  2026-11-26 15:21   ` [OE-core] " Yoann Congal
  1 sibling, 1 reply; 5+ messages in thread
From: P. Tatrai @ 2026-11-20  9:23 UTC (permalink / raw)
  To: openembedded-core; +Cc: Peter Tatrai

From: Peter Tatrai <peter.tatrai.ext@siemens.com>

Apply Wrynose product scopes without changing Scarthgap's assessment set
or descriptions. Keep these exclusions out of reports for unrelated
recipes.

Signed-off-by: Peter Tatrai <peter.tatrai.ext@siemens.com>
---
 .../distro/include/cve-extra-exclusions.inc   | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/meta/conf/distro/include/cve-extra-exclusions.inc b/meta/conf/distro/include/cve-extra-exclusions.inc
index fcef6a1..54bfac3 100644
--- a/meta/conf/distro/include/cve-extra-exclusions.inc
+++ b/meta/conf/distro/include/cve-extra-exclusions.inc
@@ -16,11 +16,11 @@
 #
 
 # strace https://nvd.nist.gov/vuln/detail/CVE-2000-0006
-CVE_STATUS[CVE-2000-0006] = "upstream-wontfix: CVE is more than 20 years old \
+CVE_STATUS[CVE-2000-0006] = "upstream-wontfix: cpe:*:strace: CVE is more than 20 years old \
 with no resolution evident. Broken links in CVE database references make resolution impractical."
 
 # epiphany https://nvd.nist.gov/vuln/detail/CVE-2005-0238
-CVE_STATUS[CVE-2005-0238] = "upstream-wontfix: \
+CVE_STATUS[CVE-2005-0238] = "upstream-wontfix: cpe:*:epiphany: \
 The issue here is spoofing of domain names using characters from other character sets. \
 There has been much discussion amongst the epiphany and webkit developers and \
 whilst there are improvements about how domains are handled and displayed to the user \
@@ -28,7 +28,7 @@ there is unlikely ever to be a single fix to webkit or epiphany which addresses
 problem. There isn't any mitigation or fix or way to progress this further."
 
 # glibc https://nvd.nist.gov/vuln/detail/CVE-2010-4756
-CVE_STATUS[CVE-2010-4756] = "upstream-wontfix: \
+CVE_STATUS[CVE-2010-4756] = "upstream-wontfix: cpe:*:glibc: \
 Issue is memory exhaustion via glob() calls, e.g. from within an ftp server \
 Best discussion in https://bugzilla.redhat.com/show_bug.cgi?id=681681 \
 Upstream don't see it as a security issue, ftp servers shouldn't be passing \
@@ -38,7 +38,7 @@ this to libc glob. Upstream have no plans to add BSD's GLOB_LIMIT or similar."
 # go https://nvd.nist.gov/vuln/detail/CVE-2020-29511
 CVE_STATUS_GROUPS += "CVE_STATUS_GO"
 CVE_STATUS_GO = "CVE-2020-29509 CVE-2020-29511"
-CVE_STATUS_GO[status] = "not-applicable-config: \
+CVE_STATUS_GO[status] = "not-applicable-config: cpe:golang:go: \
 The encoding/xml package in go can potentially be used for security exploits if not used correctly \
 CVE applies to a netapp product as well as flagging a general issue. We don't ship anything \
 exposing this interface in an exploitable way"
@@ -50,7 +50,7 @@ CVE-2015-2656 CVE-2015-4754 CVE-2015-4764 CVE-2015-4774 CVE-2015-4775 CVE-2015-4
 CVE-2015-4778 CVE-2015-4779 CVE-2015-4780 CVE-2015-4781 CVE-2015-4782 CVE-2015-4783 CVE-2015-4784 \
 CVE-2015-4785 CVE-2015-4786 CVE-2015-4787 CVE-2015-4788 CVE-2015-4789 CVE-2015-4790 CVE-2016-0682 \
 CVE-2016-0689 CVE-2016-0692 CVE-2016-0694 CVE-2016-3418 CVE-2020-2981"
-CVE_STATUS_DB[status] = "upstream-wontfix: Since Oracle relicensed bdb, the open source community is slowly but surely \
+CVE_STATUS_DB[status] = "upstream-wontfix: cpe:*:berkeley_db: Since Oracle relicensed bdb, the open source community is slowly but surely \
 replacing bdb with supported and open source friendly alternatives. As a result this CVE is unlikely to ever be fixed."
 
 # Kernel CVEs that are generic but can't be added to the kernel's hand-maintained cve-exclusion.inc
@@ -60,25 +60,25 @@ replacing bdb with supported and open source friendly alternatives. As a result
 # For OE-Core our policy is to stay as close to the kernel stable releases as we can. This should
 # ensure the bulk of the major kernel CVEs are fixed and we don't dive into each individual issue
 # as the stable maintainers are much more able to do that.
-CVE_STATUS[CVE-1999-0524] = "ignored: issue is that ICMP exists, can be filewalled if required"
-CVE_STATUS[CVE-2008-4609] = "ignored: describes design flaws in TCP"
-CVE_STATUS[CVE-2010-4563] = "ignored: low impact, only enables detection of hosts which are sniffing network traffic"
-CVE_STATUS[CVE-2011-0640] = "ignored: requires physical access and any mitigation would mean USB is impractical to use"
+CVE_STATUS[CVE-1999-0524] = "ignored: cpe:*:linux_kernel: issue is that ICMP exists, can be filewalled if required"
+CVE_STATUS[CVE-2008-4609] = "ignored: cpe:*:linux_kernel: describes design flaws in TCP"
+CVE_STATUS[CVE-2010-4563] = "ignored: cpe:*:linux_kernel: low impact, only enables detection of hosts which are sniffing network traffic"
+CVE_STATUS[CVE-2011-0640] = "ignored: cpe:*:linux_kernel: requires physical access and any mitigation would mean USB is impractical to use"
 
 # qemu:qemu-native:qemu-system-native https://nvd.nist.gov/vuln/detail/CVE-2021-20255
-CVE_STATUS[CVE-2021-20255] = "upstream-wontfix: \
+CVE_STATUS[CVE-2021-20255] = "upstream-wontfix: cpe:*:qemu: \
 There was a proposed patch https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg06098.html \
 qemu maintainers say the patch is incorrect and should not be applied \
 The issue is of low impact, at worst sitting in an infinite loop rather than exploitable."
 
 # qemu:qemu-native:qemu-system-native https://nvd.nist.gov/vuln/detail/CVE-2019-12067
-CVE_STATUS[CVE-2019-12067] = "upstream-wontfix: \
+CVE_STATUS[CVE-2019-12067] = "upstream-wontfix: cpe:*:qemu: \
 There was a proposed patch but rejected by upstream qemu. It is unclear if the issue can \
 still be reproduced or where exactly any bug is. \
 We'll pick up any fix when upstream accepts one."
 
 # nasm:nasm-native https://nvd.nist.gov/vuln/detail/CVE-2020-18974
-CVE_STATUS[CVE-2020-18974] = "upstream-wontfix: \
+CVE_STATUS[CVE-2020-18974] = "upstream-wontfix: cpe:*:netwide_assembler: \
 It is a fuzzing related buffer overflow. It is of low impact since most devices \
 wouldn't expose an assembler. The upstream is inactive and there is little to be \
 done about the bug, ignore from an OE perspective."
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [OE-core] [scarthgap][PATCH 1/2] cve-check: keep global CVE exclusions out of unrelated reports
  2026-11-20  9:23 ` [scarthgap][PATCH 1/2] cve-check: keep global CVE exclusions out of unrelated reports P. Tatrai
@ 2026-11-26 15:15   ` Yoann Congal
  0 siblings, 0 replies; 5+ messages in thread
From: Yoann Congal @ 2026-11-26 15:15 UTC (permalink / raw)
  To: peter.tatrai.ext, openembedded-core

Hello,

On Fri Nov 20, 2026 at 10:23 AM CET, Peter via openembedded-core Tatrai wrote:
> From: Peter Tatrai <peter.tatrai.ext@siemens.com>
>
> The Scarthgap SPDX 3.0 backport [1] did not bring over product
> filtering for CVE_STATUS assessments. The follow-up [2] made SPDX
> export all CVE_STATUS assessments, exposing the same problem in SPDX
> that already affected CVE-check reports.
>
> Global exclusion lists are loaded for every recipe. Without product
> filtering, assessments intended for one product can appear in the
> CVE-check and SPDX/VEX reports of unrelated packages.

Can you put an extracts/examples of that please? Like before/after this
patch?

That sounds like a good bug to fix but I need more details since the
backport is not trivial.

> Backport the scoped parser from OE-Core commit abca80a716e9 and the
> product matcher from 452e605b55ad as they appear in Wrynose. Preserve
> Scarthgap's tuple and set APIs and the behavior of unscoped entries.

I have no idea if that makes sense but I suspect this would be easier to
review if the 2 squashed commit were backported separately (one in each
scarthgap patch): That way, I could compare the merged wrynose ones
with yours.

If applicable, please split the 2 commits for the next iteration.

> [1] Scarthgap SPDX 3.0 backport:
> https://git.openembedded.org/openembedded-core/commit/?id=9c9b9545049a
> [2] Export all CVE_STATUS assessments:
> https://git.openembedded.org/openembedded-core/commit/?id=9a204670b1c0
>
> Signed-off-by: Peter Tatrai <peter.tatrai.ext@siemens.com>
> ---
>  meta/classes/vex.bbclass                  |  1 -
>  meta/lib/oe/cve_check.py                  | 76 ++++++++++++++++++++---
>  meta/lib/oe/spdx30_tasks.py               |  1 -
>  meta/lib/oeqa/selftest/cases/cve_check.py | 48 ++++++++++++++
>  4 files changed, 117 insertions(+), 9 deletions(-)
>
> diff --git a/meta/classes/vex.bbclass b/meta/classes/vex.bbclass
> index 97213ea..3c44dbb 100644
> --- a/meta/classes/vex.bbclass
> +++ b/meta/classes/vex.bbclass
> @@ -141,7 +141,6 @@ python do_generate_vex () {
>      for cve_id in (d.getVarFlags("CVE_STATUS") or {}):
>          mapping, detail, description = decode_cve_status(d, cve_id)
>          if not mapping or not detail:
> -            bb.warn(f"Skipping {cve_id} — missing or unknown CVE status")

Was this warn removal voluntary? If yes, then this should be explained
in the commit message.

>              continue
>          cve_data[cve_id] = {
>              "abbrev-status": mapping,
> diff --git a/meta/lib/oe/cve_check.py b/meta/lib/oe/cve_check.py
> index 7c09b78..9620dc5 100644
> --- a/meta/lib/oe/cve_check.py
> +++ b/meta/lib/oe/cve_check.py
> @@ -227,22 +227,84 @@ def convert_cve_version(version):
>  
>  def decode_cve_status(d, cve):
>      """
> -    Convert CVE_STATUS into status, detail and description.
> +    Convert a matching CVE_STATUS into status, detail and description.
> +
> +    Keep the Scarthgap tuple API for cve-check and existing SPDX consumers.

While referencing scarthgap in the commit message is fair, I don't think
it's necessary in the code itself, where the "Scarthgap tuple API" is
simply the current API. And you won't document a change you won't make
in the code.

This looks like a LLM output. Please review our AI-Assisted Contribution
Policy[0] and update your contribution if that apply.

>      """
> -    status = d.getVarFlag("CVE_STATUS", cve)
> +    status = decode_cve_status_scoped(d, cve)
>      if not status:
>          return ("", "", "")
> +    # Scarthgap applies unscoped statuses even when CVE_PRODUCT is empty.

(Same: scarthgap reference in code)

> +    unscoped = status["vendor"] == status["product"] == "*"
> +    if not unscoped and not has_cve_product_match(status, d.getVar("CVE_PRODUCT") or ""):
> +        return ("", "", "")
> +    return (status["mapping"], status["detail"], status["description"])
> +
> +
> +def has_cve_product_match(detailed_status, products):
> +    """
> +    Check product/vendor match between detailed_status from decode_cve_status and a string of
> +    products (like from CVE_PRODUCT)
> +    """
> +    for product in products.split():
> +        vendor = "*"
> +        if ":" in product:
> +            vendor, product = product.split(":", 1)
> +
> +        if (vendor == detailed_status["vendor"] or detailed_status["vendor"] == "*") and \
> +            (product == detailed_status["product"] or detailed_status["product"] == "*"):
> +            return True
>  
> -    status_split = status.split(':', 1)
> -    detail = status_split[0]
> -    description = status_split[1].strip() if (len(status_split) > 1) else ""
> +    #if no match, return False
> +    return False
>  
> +
> +def decode_cve_status_scoped(d, cve):
> +    """
> +    Convert CVE_STATUS into status, vendor, product, detail and description.
> +    """
> +    status = d.getVarFlag("CVE_STATUS", cve)
> +    if not status:
> +        return {}
> +
> +    status_split = status.split(':', 4)
> +    status_out = {}
> +    status_out["detail"] = status_split[0]
> +    product = "*"
> +    vendor = "*"
> +    description = ""
> +    if len(status_split) >= 4 and status_split[1].strip() == "cpe":
> +        # Both vendor and product are mandatory if cpe: present, the syntax is then:
> +        # detail: cpe:vendor:product:description
> +        vendor = status_split[2].strip()
> +        product = status_split[3].strip()
> +        description = status_split[4].strip()
> +    elif len(status_split) >= 2 and status_split[1].strip() == "cpe":
> +        # Malformed CPE
> +        bb.warn(
> +            'Invalid CPE information for CVE_STATUS[%s] = "%s", not setting CPE'
> +            % (cve, status)
> +        )
> +    else:
> +        # Other case: no CPE, the syntax is then:
> +        # detail: description
> +        description = status.split(':', 1)[1].strip() if (len(status_split) > 1) else ""
> +
> +    status_out["vendor"] = vendor
> +    status_out["product"] = product
> +    status_out["description"] = description
> +
> +    detail = status_out["detail"]
>      status_mapping = d.getVarFlag("CVE_CHECK_STATUSMAP", detail)
>      if status_mapping is None:
> -        bb.warn('Invalid detail "%s" for CVE_STATUS[%s] = "%s", fallback to Unpatched' % (detail, cve, status))
> +        bb.warn(
> +            'Invalid detail "%s" for CVE_STATUS[%s] = "%s", fallback to Unpatched'
> +            % (detail, cve, status)
> +        )
>          status_mapping = "Unpatched"
> +    status_out["mapping"] = status_mapping
>  
> -    return (status_mapping, detail, description)
> +    return status_out
>  
>  def extend_cve_status(d):
>      # do this only once in case multiple classes use this
> diff --git a/meta/lib/oe/spdx30_tasks.py b/meta/lib/oe/spdx30_tasks.py
> index 0e9c6fa..539901f 100644
> --- a/meta/lib/oe/spdx30_tasks.py
> +++ b/meta/lib/oe/spdx30_tasks.py
> @@ -470,7 +470,6 @@ def _get_cves_info(d):
>      for cve_id in (d.getVarFlags("CVE_STATUS") or {}):
>          mapping, detail, description = oe.cve_check.decode_cve_status(d, cve_id)
>          if not mapping or not detail:
> -            bb.warn(f"Skipping {cve_id} — missing or unknown CVE status")

(same: undocumented warn() removal)

>              continue
>          yield cve_id, mapping, detail, description
>          patched_cves.discard(cve_id)
> diff --git a/meta/lib/oeqa/selftest/cases/cve_check.py b/meta/lib/oeqa/selftest/cases/cve_check.py
> index 60cecd1..8cd5eb9 100644
> --- a/meta/lib/oeqa/selftest/cases/cve_check.py
> +++ b/meta/lib/oeqa/selftest/cases/cve_check.py
> @@ -11,6 +11,54 @@ from oeqa.utils.commands import bitbake, get_bb_vars
>  
>  class CVECheck(OESelftestTestCase):
>  
> +    def test_scoped_status(self):
> +        import bb
> +        from oe.cve_check import decode_cve_status, extend_cve_status, get_patched_cves
> +        from unittest.mock import patch
> +
> +        d = bb.data.init()
> +        cve = "CVE-2020-0001"
> +        d.setVarFlag("CVE_CHECK_STATUSMAP", "fixed-version", "Patched")
> +        d.setVarFlag("CVE_CHECK_STATUSMAP", "ignored", "Ignored")
> +        d.setVarFlag("CVE_STATUS", cve, "fixed-version: cpe:oracle:berkeley_db: Fixed: see upstream")
> +        for product, expected in (
> +            ("oracle:berkeley_db", ("Patched", "fixed-version", "Fixed: see upstream")),
> +            ("other:berkeley_db", ("", "", "")),
> +            ("oracle:zlib", ("", "", "")),
> +            ("zlib:zlib oracle:berkeley_db", ("Patched", "fixed-version", "Fixed: see upstream")),
> +        ):
> +            with self.subTest(product=product):
> +                d.setVar("CVE_PRODUCT", product)
> +                self.assertEqual(decode_cve_status(d, cve), expected)
> +                with patch("oe.patch.src_patches", return_value=[]):
> +                    self.assertEqual(get_patched_cves(d), {cve} if expected[0] else set())
> +
> +        d.setVar("CVE_PRODUCT", "zlib")
> +        d.setVarFlag("CVE_STATUS", cve, "ignored: Existing unscoped reason: unchanged")
> +        self.assertEqual(decode_cve_status(d, cve),
> +                         ("Ignored", "ignored", "Existing unscoped reason: unchanged"))
> +        d.setVar("CVE_STATUS_GROUPS", "SCOPED_GROUP")
> +        d.setVar("SCOPED_GROUP", cve)
> +        d.setVarFlag("SCOPED_GROUP", "status", "ignored: cpe:*:zlib: Matching group")
> +        extend_cve_status(d)
> +        self.assertEqual(decode_cve_status(d, cve), ("Ignored", "ignored", "Matching group"))
> +        d.setVar("CVE_PRODUCT", "glibc")
> +        self.assertEqual(decode_cve_status(d, cve), ("", "", ""))
> +
> +    def test_scoped_status_spdx(self):
> +        import bb
> +        import oe.spdx30_tasks
> +        from unittest.mock import patch
> +
> +        d = bb.data.init()
> +        d.setVar("CVE_PRODUCT", "zlib:zlib")
> +        d.setVarFlag("CVE_CHECK_STATUSMAP", "ignored", "Ignored")
> +        d.setVarFlag("CVE_STATUS", "CVE-2020-0001", "ignored: cpe:*:berkeley_db: Not zlib")
> +        d.setVarFlag("CVE_STATUS", "CVE-2020-0002", "ignored: cpe:*:zlib: Matches zlib")
> +        with patch("oe.patch.src_patches", return_value=[]):
> +            self.assertEqual(list(oe.spdx30_tasks._get_cves_info(d)),
> +                             [("CVE-2020-0002", "Ignored", "ignored", "Matches zlib")])
> +
>      def test_version_compare(self):
>          from oe.cve_check import Version
>  

Regards,

[0]: https://docs.yoctoproject.org/dev/contributor-guide/ai-assisted-contribution-policy.html
-- 
Yoann Congal
Smile ECS


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] [scarthgap][PATCH 2/2] cve-exclusions: qualify global assessments by product
  2026-11-20  9:23 ` [scarthgap][PATCH 2/2] cve-exclusions: qualify global assessments by product P. Tatrai
@ 2026-11-26 15:21   ` Yoann Congal
  0 siblings, 0 replies; 5+ messages in thread
From: Yoann Congal @ 2026-11-26 15:21 UTC (permalink / raw)
  To: peter.tatrai.ext, openembedded-core

Hello,

On Fri Nov 20, 2026 at 10:23 AM CET, Peter via openembedded-core Tatrai wrote:
> From: Peter Tatrai <peter.tatrai.ext@siemens.com>
>
> Apply Wrynose product scopes without changing Scarthgap's assessment set
> or descriptions. Keep these exclusions out of reports for unrelated
> recipes.

How did you checked that this did not had unintended consequences like
re-opening a fixed CVE?

You can put what check you did and the result in your v2?

>
> Signed-off-by: Peter Tatrai <peter.tatrai.ext@siemens.com>
> ---
>  .../distro/include/cve-extra-exclusions.inc   | 24 +++++++++----------
>  1 file changed, 12 insertions(+), 12 deletions(-)

Thanks!
-- 
Yoann Congal
Smile ECS


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-26 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20  9:23 [scarthgap][PATCH 0/2] Scope global CVE exclusions by product P. Tatrai
2026-11-20  9:23 ` [scarthgap][PATCH 1/2] cve-check: keep global CVE exclusions out of unrelated reports P. Tatrai
2026-11-26 15:15   ` [OE-core] " Yoann Congal
2026-11-20  9:23 ` [scarthgap][PATCH 2/2] cve-exclusions: qualify global assessments by product P. Tatrai
2026-11-26 15:21   ` [OE-core] " Yoann Congal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox