config.json/scripts: Update to handle CVE checks for meta-oe
PATCH 1/1 config.json/scripts: Update to handle CVE checks for meta-oe
Backport the recent CVE script changes from the master branch and add in cvelayer.bbclass as a way to exclude specific paths from the CVE check. Master can use the layer overrides to do this but these are not present on kirkstone.
Signed-off-by Richard Purdie <[email protected]>
--- config.json | 33 ++++++++-- scripts/cve-generate-chartdata | 65 ++++++++++++++++++ scripts/cve-report.py | 30 +++++++++ scripts/cvecheck/cvelayer.bbclass | 9 +++ scripts/run-cvecheck | 106 ++++++++++++++++++++++-------- 5 files changed, 212 insertions(+), 31 deletions(-) create mode 100755 scripts/cve-generate-chartdata create mode 100755 scripts/cve-report.py create mode 100644 scripts/cvecheck/cvelayer.bbclass
config.json +28 -5
@@ -910,7 +910,7 @@ } }, "metrics" : { - "NEEDREPOS" : ["poky"], + "NEEDREPOS" : ["poky", "meta-openembedded"], "extravars" : [ "INHERIT += 'cve-check'", "BB_DISKMON_DIRS = ''",
@@ -920,12 +920,35 @@ "BB_SERVER_TIMEOUT = '0'" ], "step1" : { - "shortname" : "Generating patch metrics", - "EXTRACMDS" : ["../../yocto-autobuilder-helper/scripts/run-patchmetrics ../ ../meta/ ${HELPERRESULTSDIR}/../../patchmetrics . ${HELPERBRANCHNAME}"] + "shortname" : "Fetching metrics repositories", + "EXTRAPLAINCMDS" : [ + "git clone ssh://[email protected]/yocto-metrics && git clone ssh://[email protected]/yocto-metrics-meta-oe", + "install -D ${SCRIPTSDIR}/cvecheck/cvelayer.bbclass ./build/classes/cvelayer.bbclass" + ] }, "step2" : { - "shortname" : "Running CVE checks", - "EXTRACMDS" : ["../../yocto-autobuilder-helper/scripts/run-cvecheck ../ ../meta/ ${HELPERRESULTSDIR}/../../patchmetrics . ${HELPERBRANCHNAME}"] + "shortname" : "CVE checks for meta", + "EXTRACMDS" : ["${SCRIPTSDIR}/run-cvecheck --metrics ../yocto-metrics --branch ${HELPERBRANCHNAME} --results ${HELPERRESULTSDIR}/../../patchmetrics --push"] + }, + "step3" : { + "shortname" : "CVE checks for meta-oe", + "ADDLAYER" : [ + "${BUILDDIR}/../meta-openembedded/meta-oe", + "${BUILDDIR}/../meta-openembedded/meta-python", + "${BUILDDIR}/../meta-openembedded/meta-perl", + "${BUILDDIR}/../meta-openembedded/meta-networking", + "${BUILDDIR}/../meta-openembedded/meta-multimedia", + "${BUILDDIR}/../meta-openembedded/meta-gnome", + "${BUILDDIR}/../meta-openembedded/meta-xfce", + "${BUILDDIR}/../meta-openembedded/meta-filesystems", + "${BUILDDIR}/../meta-openembedded/meta-initramfs", + "${BUILDDIR}/../meta-openembedded/meta-webserver" + ], + "extravars" : [ + "INHERIT += 'cvelayer'", + "SKIP_PATHS += '${TOPDIR}/../meta'" + ], + "EXTRACMDS" : ["${SCRIPTSDIR}/run-cvecheck --metrics ../yocto-metrics-meta-oe --branch ${HELPERBRANCHNAME} --results ${HELPERRESULTSDIR}/../../patchmetrics-meta-oe --push"] } }, "meta-mingw" : {
scripts/cve-generate-chartdata new file +65 -0
65 lines not on this page · raw message
scripts/cve-report.py new file +30 -0
@@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import os, sys +import json + +jsonfile = sys.argv[1] + +#ignored_recipes = ("linux-yocto", "db", "db-native") +ignored_recipes = [] + +with open(jsonfile) as f: + cvedata = json.load(f) + +cves = dict() + +for recipe in cvedata['package']: + if recipe['name'] in ignored_recipes: + continue + if 'issue' not in recipe: + continue + for i in recipe['issue']: + if i['status'] == "Unpatched": + if i["id"] in cves: + cves[i["id"]] += ":" + recipe['name'] + else: + cves[i["id"]] = recipe['name'] + +print("Found %d unpatched CVEs" % len(cves)) +for cve in sorted(cves.keys()): + print("%s: %s https://web.nvd.nist.gov/view/vuln/detail?vulnId=%s *" % (cve, cves[cve], cve))
scripts/cvecheck/cvelayer.bbclass new file +9 -0
@@ -0,0 +1,9 @@ +do_cve_check[prefuncs] += "cvechecklayer" + +python cvechecklayer () { + file = d.getVar("FILE") + skips = [os.path.normpath(s) for s in (d.getVar("SKIP_PATHS") or "").split()] + for skip in skips: + if file.startswith(skip + "/"): + d.setVar("do_cve_check", "") +}
scripts/run-cvecheck +80 -26
128 lines not on this page · raw message
Signature · 1 line
2.39.2