Skip to contentSkip to conversation

cve-check.bbclass: add layer to cve log

PATCH In review akuster 2 participants 5 messages Feb 8, 2021 – Feb 9, 2021

lore
Share & tools
lore

akuster

author
#0 lore raw

PATCH 1/2 cve-check.bbclass: add layer to cve log

Lets include whcih layer a package belongs to and
add it to the cve logs

---
 meta/classes/cve-check.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes/cve-check.bbclass +4 -0
index ed86403b6bc..061af7a2760 100644
@@ -335,6 +335,9 @@ def cve_write_data(d, patched, unpatched, whitelisted, cve_data):
     """
 
     cve_file = d.getVar("CVE_CHECK_LOG")
+    fdir_name  = d.getVar("FILE_DIRNAME")
+    layer = fdir_name.split("/")[-3]
+
     nvd_link = "https://web.nvd.nist.gov/view/vuln/detail?vulnId="
     write_string = ""
     unpatched_cves = []
@@ -344,6 +347,7 @@ def cve_write_data(d, patched, unpatched, whitelisted, cve_data):
         is_patched = cve in patched
         if is_patched and (d.getVar("CVE_CHECK_REPORT_PATCHED") != "1"):
             continue
+        write_string += "LAYER: %s\n" % layer
         write_string += "PACKAGE NAME: %s\n" % d.getVar("PN")
         write_string += "PACKAGE VERSION: %s%s\n" % (d.getVar("EXTENDPE"), d.getVar("PV"))
         write_string += "CVE: %s\n" % cve
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 cve-check: add include/exclude layers

There are times when exluding or including a layer may be desired. This provide the framwork for that via two variables. The default is all layers in bblayers.

CVE_CHECK_LAYER_INCLUDELIST
CVE_CHECK_LAYER_EXCLUDELIST

---
 meta/classes/cve-check.bbclass | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
meta/classes/cve-check.bbclass +17 -0
index 061af7a2760..112ee3379d3 100644
@@ -53,6 +53,13 @@ CVE_CHECK_PN_WHITELIST ?= ""
 #
 CVE_CHECK_WHITELIST ?= ""
 
+# Layers to be excluded
+CVE_CHECK_LAYER_EXCLUDELIST ??= ""
+
+# Layers to be included 
+CVE_CHECK_LAYER_INCLUDELIST ??= ""
+
+
 # set to "alphabetical" for version using single alphabetical character as increament release
 CVE_VERSION_SUFFIX ??= ""
 
@@ -334,10 +341,20 @@ def cve_write_data(d, patched, unpatched, whitelisted, cve_data):
     CVE manifest if enabled.
     """
 
+
     cve_file = d.getVar("CVE_CHECK_LOG")
     fdir_name  = d.getVar("FILE_DIRNAME")
     layer = fdir_name.split("/")[-3]
 
+    include_layers = d.getVar("CVE_CHECK_LAYER_INCLUDELIST").split()
+    exclude_layers = d.getVar("CVE_CHECK_LAYER_EXCLUDELIST").split()
+
+    if exclude_layers and layer in exclude_layers:
+        return
+
+    if include_layers and layer not in include_layers:
+        return
+
     nvd_link = "https://web.nvd.nist.gov/view/vuln/detail?vulnId="
     write_string = ""
     unpatched_cves = []
Signature · 1 line
2.25.1
#2 lore raw

Re: [OE-core] [PATCH 2/2] cve-check: add include/exclude layers

Quoted 6 lines · akuster

There are times when exluding or including a layer may be desired. This provide the framwork for that via two variables. The default is all layers in bblayers.

CVE_CHECK_LAYER_INCLUDELIST
CVE_CHECK_LAYER_EXCLUDELIST

Do we need to document these?

Cheers,

Richard

author
#3 lore raw

Re: [OE-core] [PATCH 2/2] cve-check: add include/exclude layers

Quoted 8 lines · Richard Purdie
Quoted 6 lines · akuster

There are times when exluding or including a layer may be desired. This provide the framwork for that via two variables. The default is all layers in bblayers.

CVE_CHECK_LAYER_INCLUDELIST
CVE_CHECK_LAYER_EXCLUDELIST

Do we need to document these?

Yes if and when the patches are accepted.  By doc do you mean the manuals or documentation.conf?

- armin

Quoted 5 lines

Cheers,

Richard

#4 lore raw

Re: [OE-core] [PATCH 2/2] cve-check: add include/exclude layers

Quoted 7 lines · On Mon, 2021-02-08 at 07:55 -0800, akuster808 wrote:
Quoted 5 lines · Richard Purdie
Quoted 4 lines · akuster

There are times when exluding or including a layer may be desired. This provide the framwork for that via two variables. The default is all layers in bblayers.

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

CVE_CHECK_LAYER_INCLUDELIST
CVE_CHECK_LAYER_EXCLUDELIST

Do we need to document these?

Yes if and when the patches are accepted.  By doc do you mean the manuals or documentation.conf?

I was thinking the of the manuals but both may make sense. The patch is in so looking forward to the docs updated, thanks! :)

Cheers,

Richard