Skip to contentSkip to conversation

cve-check.bbclass: allow skiping non pbn

PATCH In review akuster 3 participants 3 messages Feb 15, 2021 – Feb 18, 2021

lore
Share & tools
lore

akuster

author
#0 lore raw

PATCH v2 1/1 cve-check.bbclass: allow skiping non pbn

I don't see the point in logging native, nativesdk etc. The bottom line is the BPN has the issue.

Allow folks to filter out those other package name variations via CVE_CHECK_MANIFEST_FILTER

--
[V2]
rename varible to CVE_CHECK_FILTER_BUILD_TOOLS

---
 meta/classes/cve-check.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/classes/cve-check.bbclass +9 -0
index 112ee3379d3..1bed815d8e4 100644
@@ -59,6 +59,7 @@ CVE_CHECK_LAYER_EXCLUDELIST ??= ""
 # Layers to be included 
 CVE_CHECK_LAYER_INCLUDELIST ??= ""
 
+CVE_CHECK_FILTER_BUILD_TOOLS ??="0"
 
 # set to "alphabetical" for version using single alphabetical character as increament release
 CVE_VERSION_SUFFIX ??= ""
@@ -96,6 +97,13 @@ python do_cve_check () {
     """
 
     if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
+        if d.getVar("CVE_CHECK_FILTER_BUILD_TOOLS") == "1":
+            # drop native, nativesdk, cross, etc
+            bpn = d.getVar("BPN")
+            pn = d.getVar("PN")
+            if bpn != pn:
+               return
+
         try:
             patched_cves = get_patches_cves(d)
         except FileNotFoundError:
@@ -164,6 +172,7 @@ def get_patches_cves(d):
     import re
 
     pn = d.getVar("PN")
+
     cve_match = re.compile("CVE:( CVE\-\d{4}\-\d+)+")
 
     # Matches last CVE-1234-211432 in the file name, also if written
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 2 lines · akuster

I don't see the point in logging native, nativesdk etc. The bottom line is the BPN has the issue.

There have been several cases where different build targets were applying different patches, e.g. CVE patched not applied in -native or -nativesdk build of the recipe.

That aside, I think this patch is ok.

Quoted 39 lines

Allow folks to filter out those other package name variations via CVE_CHECK_MANIFEST_FILTER

--
[V2]
rename varible to CVE_CHECK_FILTER_BUILD_TOOLS

---
 meta/classes/cve-check.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/classes/cve-check.bbclass +8 -0
index 112ee3379d3..1bed815d8e4 100644
@@ -59,6 +59,7 @@ CVE_CHECK_LAYER_EXCLUDELIST ??= ""
 # Layers to be included 
 CVE_CHECK_LAYER_INCLUDELIST ??= ""
 
+CVE_CHECK_FILTER_BUILD_TOOLS ??="0"
 
 # set to "alphabetical" for version using single alphabetical character as increament release
 CVE_VERSION_SUFFIX ??= ""
@@ -96,6 +97,13 @@ python do_cve_check () {
     """
 
     if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
+        if d.getVar("CVE_CHECK_FILTER_BUILD_TOOLS") == "1":
+            # drop native, nativesdk, cross, etc
+            bpn = d.getVar("BPN")
+            pn = d.getVar("PN")
+            if bpn != pn:
+               return
+
         try:
             patched_cves = get_patches_cves(d)
         except FileNotFoundError:

meta/classes/cve-check.bbclass def get_patches_cves(d): · line 175

Quoted 4 lines
meta/classes/cve-check.bbclass +1 -0
@@ -164,6 +172,7 @@ def get_patches_cves(d):
     import re
 
     pn = d.getVar("PN")
+

This hunk is not needed.

For the rest, Acked-by: Mikko Rapeli <[email protected]>

Cheers,

-Mikko

Quoted 10 lines
meta/classes/cve-check.bbclass +0 -0
     cve_match = re.compile("CVE:( CVE\-\d{4}\-\d+)+")
 
     # Matches last CVE-1234-211432 in the file name, also if written
Signature · 1 line
2.25.1
#2 lore raw
In reply to akuster
Quoted 2 lines · akuster

I don't see the point in logging native, nativesdk etc. The bottom line is the BPN has the issue.

Unless the base recipe doesn't exist, for example it's nativesdk or native specific.

Whilst native is build tool and so arguably not as relevant, nativesdk very much is a deployed artefact.

Ross