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(detector/cpe): do not overwrite distro advisories #2039

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

MaineK00n
Copy link
Collaborator

If this Pull Request is work in progress, Add a prefix of “[WIP]” in the title.

What did you implement:

There was a bug where when a vulnerability was detected on a CPE and that vulnerability had already been detected by another method, the information in DistroAdvisories was overwritten, resulting in the loss of the information from the previous detection.
For example, JVNDB-2024-000098 and JVNDB-2024-005553, both of which are related to CVE-2024-7263.

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

setup

$ go-cve-dictionary fetch jvn 2024
$ cat config.toml
...
[servers]
[servers.pseudo]
type = "pseudo"
cpeNames = [
  "cpe:2.3:a:kingsoft:wps_office:v12.2.0.13489:*:*:*:*:*:*:*",
  "cpe:2.3:a:kingsoft:wps_cloud:v11.2.0.10693:*:*:*:*:*:*:*"
]
$ vuls scan

before

$ vuls report --refresh-cve
$ cat results/2024-10-02T03-56-59+0900/pseudo.json | jq '.scannedCves."CVE-2024-7263".distroAdvisories'
[
  {
    "advisoryID": "JVNDB-2024-000098",
    "severity": "",
    "issued": "0001-01-01T00:00:00Z",
    "updated": "0001-01-01T00:00:00Z",
    "description": ""
  }
]

after

$ vuls report --refresh-cve
$ cat results/2024-10-02T03-56-59+0900/pseudo.json | jq '.scannedCves."CVE-2024-7263".distroAdvisories'
[
  {
    "advisoryID": "JVNDB-2024-000098",
    "severity": "",
    "issued": "0001-01-01T00:00:00Z",
    "updated": "0001-01-01T00:00:00Z",
    "description": ""
  },
  {
    "advisoryID": "JVNDB-2024-005553",
    "severity": "",
    "issued": "0001-01-01T00:00:00Z",
    "updated": "0001-01-01T00:00:00Z",
    "description": ""
  }
]

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 Oct 1, 2024
@MaineK00n MaineK00n requested a review from shino October 1, 2024 19:10
Copy link
Collaborator

@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.

Fabulous!

@MaineK00n MaineK00n merged commit 0e21ce2 into master Oct 2, 2024
7 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/patch-1 branch October 2, 2024 05:41
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