cisagov / cyhy-core

Core code for Cyber Hygiene (CyHy)
Other
7 stars 9 forks source link

Correct CVSS validation logic in the `cyhy-nvdsync` script #74

Closed mcdonnnj closed 1 year ago

mcdonnnj commented 1 year ago

๐Ÿ—ฃ Description

This pull request corrects an issue with the logic to validate CVSS data in the cyhy-nvdsync script.

๐Ÿ’ญ Motivation and context

The current logic will not provide an expected result if the list it is checking has a single element. This results in numerous CVE entries failing validation when they should be imported. As an example the 2023 feed only has a single CVE imported out of 3,229 total CVE records with the current logic.

๐Ÿงช Testing

I wrote a test script to validate functionality.

Current logic:

Year | Total  | Failed | Bug
2002 :   6769 :    100 :      0
2003 :   1553 :     50 :      0
2004 :   2707 :     63 :      0
2005 :   4765 :    141 :      0
2006 :   7142 :    151 :      2
2007 :   6579 :    124 :      2
2008 :   7174 :    173 :      3
2009 :   5028 :    127 :      5
2010 :   5199 :    161 :      7
2011 :   4834 :    232 :      4
2012 :   5846 :    427 :     11
2013 :   6695 :    549 :     19
2014 :   8960 :    640 :     68
2015 :   8692 :    760 :     95
2016 :  10536 :   1317 :     39
2017 :  16885 :   2387 :    138
2018 :  16935 :   1281 :     44
2019 :  16868 :   1441 :     46
2020 :  20026 :   1863 :    295
2021 :  21496 :   1479 :    857
2022 :  22473 :  13609 :  13095
2023 :   3229 :   3228 :   2957

This logic in this branch:

Year | Total  | Failed | Bug
2002 :   6769 :    100 :      0
2003 :   1553 :     50 :      0
2004 :   2707 :     63 :      0
2005 :   4765 :    141 :      0
2006 :   7142 :    149 :      0
2007 :   6579 :    122 :      0
2008 :   7174 :    170 :      0
2009 :   5028 :    122 :      0
2010 :   5199 :    154 :      0
2011 :   4834 :    228 :      0
2012 :   5846 :    416 :      0
2013 :   6695 :    530 :      0
2014 :   8960 :    572 :      0
2015 :   8692 :    665 :      0
2016 :  10536 :   1278 :      0
2017 :  16885 :   2249 :      0
2018 :  16935 :   1237 :      0
2019 :  16868 :   1395 :      0
2020 :  20026 :   1568 :      0
2021 :  21496 :    622 :      0
2022 :  22473 :    514 :      0
2023 :   3229 :    271 :      0

โœ… Pre-approval checklist