Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(suse): remove CVE ID suffix #385

Merged
merged 2 commits into from
Apr 23, 2024
Merged

fix(suse): remove CVE ID suffix #385

merged 2 commits into from
Apr 23, 2024

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Apr 22, 2024

What did you implement:

In the CVE part of OVAL provided by SUSE, information indicating the source such as "at NVD" and "at SUSE" has been added to the part where the CVE ID is expected.
However, due to this, when you want to search by CVE ID, it does not match completely and cannot be found. Therefore, in this PR, the suffix is removed from the CVE ID part. Source can also be determined from Href.

Also, when searching by CVE ID or Package, the definitions will be duplicated, so we use the definition ID to make them unique.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

RDB(SQLite3)

before

$ goval-dictionary fetch suse --suse-type suse-enterprise-server 15
$ goval-dictionary select --by-cveid suse.linux.enterprise.server 15.3 "CVE-2021-4024"
------------------
[]models.Definition{}

$ goval-dictionary select --by-cveid suse.linux.enterprise.server 15.3 "CVE-2021-4024 at NVD"
CVE-2021-4024
[{38295 19148 CVE-2021-4024 at SUSE  4.8/CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:L  moderate https://www.suse.com/security/cve/CVE-2021-4024/ } {38296 19148 CVE-2021-4024 at NVD  6.5/CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L  moderate https://nvd.nist.gov/vuln/detail/CVE-2021-4024 }]
------------------
[]models.Definition{
  models.Definition{
...

after

$ goval-dictionary fetch suse --suse-type suse-enterprise-server 15
$ goval-dictionary select --by-cveid suse.linux.enterprise.server 15.3 "CVE-2021-4024"
CVE-2021-4024
[{162559 81280 CVE-2021-4024  4.8/CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:L  moderate https://www.suse.com/security/cve/CVE-2021-4024/ } {162560 81280 CVE-2021-4024  6.5/CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L  moderate https://nvd.nist.gov/vuln/detail/CVE-2021-4024 }]
------------------
[]models.Definition{
  models.Definition{
...

Redis

before

$ docker run --rm -d -p 127.0.0.1:6379:6379 redis
$ goval-dictionary fetch suse --suse-type suse-enterprise-server 15 --dbtype redis --dbpath "redis://127.0.0.1:6379/1"
$ goval-dictionary select --by-cveid suse.linux.enterprise.server 15.3 "CVE-2021-4024" --dbtype redis --dbpath "redis://127.0.0.1:6379/1"
------------------
[]models.Definition{}

$ goval-dictionary select --by-cveid suse.linux.enterprise.server 15.3 "CVE-2021-4024 at NVD" --dbtype redis --dbpath "redis://127.0.0.1:6379/1"
CVE-2021-4024
[{0 0 CVE-2021-4024 at SUSE  4.8/CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:L  moderate https://www.suse.com/security/cve/CVE-2021-4024/ } {0 0 CVE-2021-4024 at NVD  6.5/CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L  moderate https://nvd.nist.gov/vuln/detail/CVE-2021-4024 }]
------------------
[]models.Definition{
  models.Definition{
...

after

$ docker run --rm -d -p 127.0.0.1:6379:6379 redis
$ goval-dictionary fetch suse --suse-type suse-enterprise-server 15 --dbtype redis --dbpath "redis://127.0.0.1:6379/1"
$ goval-dictionary select --by-cveid suse.linux.enterprise.server 15.3 "CVE-2021-4024" --dbtype redis --dbpath "redis://127.0.0.1:6379/1"
CVE-2021-4024
[{0 0 CVE-2021-4024  4.8/CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:L  moderate https://www.suse.com/security/cve/CVE-2021-4024/ } {0 0 CVE-2021-4024  6.5/CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L  moderate https://nvd.nist.gov/vuln/detail/CVE-2021-4024 }]
------------------
[]models.Definition{
  models.Definition{
...

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n self-assigned this Apr 22, 2024
@MaineK00n MaineK00n force-pushed the MaineK00n/fix-suse-cveid branch from 742d801 to afa2037 Compare April 23, 2024 03:15
@MaineK00n MaineK00n changed the title fix(db/suse): supports cases where CVE ID includes "at NVD", "at SUSE" fix(fetch/suse): remove CVE ID suffix Apr 23, 2024
@MaineK00n MaineK00n changed the title fix(fetch/suse): remove CVE ID suffix fix(suse): remove CVE ID suffix Apr 23, 2024
@MaineK00n MaineK00n requested a review from shino April 23, 2024 04:07
Copy link
Contributor

@shino shino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix!

@MaineK00n MaineK00n merged commit 6aa17be into master Apr 23, 2024
13 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/fix-suse-cveid branch April 23, 2024 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants