cve-check: Log if CVE_STATUS set but not reported for component
PATCH 1/1 cve-check: Log if CVE_STATUS set but not reported for component
From: Simone Weiß <[email protected]>
Log if the CVE_STATUS is set for a CVE, but the cve is not reported for a component. This should hopefully help to clean up not needed CVE_STATUS settings.
--- meta/classes/cve-check.bbclass | 3 +++ 1 file changed, 3 insertions(+)
meta/classes/cve-check.bbclass +3 -0
@@ -418,6 +418,9 @@ def check_cves(d, patched_cves): cves_status.append([product, False]) conn.close() + diff_ignore = list(set(cve_ignore) - set(cves_ignored)) + if diff_ignore: + bb.warn("Found CVE (%s) with CVE_STATUS set that is not found in database for this component" % " ".join(diff_ignore)) if not cves_in_recipe: bb.note("No CVE records for products in recipe %s" % (pn))
Signature · 1 line
2.39.2
Le ven. 23 févr. 2024 à 22:09, Simone Weiß <[email protected]> a écrit :
Quoted 6 lines
From: Simone Weiß <[email protected]>
Log if the
CVE_STATUSis set for a CVE, but the cve is not reported for a component. This should hopefully help to clean up not neededCVE_STATUSsettings.
Thank you for taking the time to do this :-)
Quoted 11 lines
Signed-off-by Simone Weiß <[email protected]>--- meta/classes/cve-check.bbclass | 3 +++ 1 file changed, 3 insertions(+)meta/classes/cve-check.bbclass +0
-0
meta/classes/cve-check.bbclass def check_cves(d, patched_cves): · line 425
Quoted 8 lines
meta/classes/cve-check.bbclass +3
-0@@ -418,6 +418,9 @@ def check_cves(d, patched_cves): cves_status.append([product, False]) conn.close() + diff_ignore = list(set(cve_ignore) - set(cves_ignored)) + if diff_ignore: + bb.warn("Found CVE (%s) with CVE_STATUS set that is not found in database for this component" % " ".join(diff_ignore))
A non-optional warning might be a bit harsh (Especially one that can come up after an independent NVD database update).
How about a new element in the output of cve_check (the build/tmp/log/cve/*.{txt,json} files)?
That way, someone looking for this info may find it, everyone else can (safely) ignore this.
Another way I see would be to make the warning optional by using QA_WARN&co but I'm not 100% sure it can be done...
Regards,
if not cves_in_recipe:
Quoted 16 lines
meta/classes/cve-check.bbclass +0
-1bb.note("No CVE records for products in recipe %s" % (pn)) --2.39.2
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#196113):
https://lists.openembedded.org/g/openembedded-core/message/196113
Mute This Topic: https://lists.openembedded.org/mt/104536878/4316185
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
Yoann Congal Smile ECS - Tech expert
Quoted 27 lines · Yoann CONGAL
Le ven. 23 févr. 2024 à 22:09, Simone Weiß <[email protected]> a écrit :
Quoted 8 lines
From: Simone Weiß <[email protected]>
Log if the
CVE_STATUSis set for a CVE, but the cve is not reported for a
component. This should hopefully help to clean up not neededCVE_STATUS
settings.Thank you for taking the time to do this :-)
Quoted 13 lines
Signed-off-by Simone Weiß <[email protected]>---
meta/classes/cve-check.bbclass | 3 +++1 file changed, 3 insertions(+)meta/classes/cve- renamed from meta/classes/cve-check.bbclass +0
-0check.bbclass
index5191d04303..b82a9e89ec100644meta/classes/cve-check.bbclass +0
-0@@ -418,6 +418,9 @@ def check_cves(d, patched_cves): cves_status.append([product, False])
Quoted 11 lines
meta/classes/cve-check.bbclass def check_cves(d, patched_cves): · line 424
Quoted 6 lines
meta/classes/cve-check.bbclass +3
-0conn.close() + diff_ignore = list(set(cve_ignore) - set(cves_ignored)) + if diff_ignore: + bb.warn("Found CVE (%s) with CVE_STATUS set that is not found in database for this component" % " ".join(diff_ignore))A non-optional warning might be a bit harsh (Especially one that can come up after an independent NVD database update).
I first had the same doubt, but then thought: hey it will only appear if cve checks are actually performed, which is not the default. And when you do that you get warnings anyway. You are right though.
Quoted 8 lines
How about a new element in the output of
cve_check(the build/tmp/log/cve/*.{txt,json} files)?
That way, someone looking for this info may find it, everyone else can (safely) ignore this.Another way I see would be to make the warning optional by using QA_WARN&co but I'm not 100% sure it can be done...
Good point. Sth like:
oe.qa.handle_error("cve_status_not_in_db", "%s Found CVE (%s) with CVE_STATUS set that are not found in database for this component" % (pn, " ".join(diff_ignore)), d)
should work.
Then the warning is only given if cve_status_not_in_db is appended to WARN_QA. I think this would be fine, also other classes besides insane.bbclass add to WARN_QA/ERROR_QA. I will check the docs and then most likely send v2.
Cheers
Simone
Quoted 4 lines
Regards,
Quoted 2 lines
if not
cves_in_recipe:
bb.note("No CVE records for products in recipe %s" % (pn))
Hello,
This change looks like the right way forward, but it will need two things first:
* dissolve cve-extra-exclusions.inc into recipes, as every exclusion in that file will generate a warning in all components except the one for which the exclusion actually is meant
* create a (per-recipe) variable to disable it, especially for kernels where we have auto-generated exclusion lists which do not match NVD DB state
Best Regards,
Peter
Quoted 10 lines · Peter Marko via lists.openembedded.org
Hello,
This change looks like the right way forward, but it will need two things first:
* dissolve cve-extra-exclusions.inc into recipes, as every exclusion in that file will generate a warning in all components except the one for which the exclusion actually is meant
* create a (per-recipe) variable to disable it, especially for kernels where we have auto-generated exclusion lists which do not match NVD DB state
Hi,
this is disabled per default, so I think those points are not to pressing.
Cheers,
Simone
Quoted 15 lines
Best Regards,
Peter-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#196131):
https://lists.openembedded.org/g/openembedded-core/message/196131
Mute This Topic: https://lists.openembedded.org/mt/104536878/8052774
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]
]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 10 lines · Peter Marko via lists.openembedded.org
Hello,
This change looks like the right way forward, but it will need two things first:
* dissolve cve-extra-exclusions.inc into recipes, as every exclusion in that file will generate a warning in all components except the one for which the exclusion actually is meant
* create a (per-recipe) variable to disable it, especially for kernels where we have auto-generated exclusion lists which do not match NVD DB state
WARN_QA:remove:pn-XXXX = "YYYY"
is possible with the version which was switched to use the central QA function.
Cheers,
Richard