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

feat(detector, contrib/trivy-to-vuls): collect vendor severity and cvss #1921

Merged
merged 1 commit into from
May 17, 2024

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented May 15, 2024

What did you implement:

Fixes #1919

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

vuls lockfile scan

  • config.toml
[servers.pseudo]
type = "pseudo"
lockfiles = ["integration/data/lockfile/juddiv3-war-3.3.5.war"]

before

$ vuls scan
$ vuls report --refresh-cve
$ cat results/2024-05-16T00-24-28+0900/pseudo.json | jq '.scannedCves."CVE-2022-22965".cveContents[][] | {type,cveID,cvss2Score,cvss2Vector,cvss2Severity,cvss3Score,cvss3Vector,cvss3Severity}'
{
  "type": "nvd",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 7.5,
  "cvss2Vector": "AV:N/AC:L/Au:N/C:P/I:P/A:P",
  "cvss2Severity": "HIGH",
  "cvss3Score": 9.8,
  "cvss3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
  "cvss3Severity": "CRITICAL"
}
{
  "type": "nvd",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 0,
  "cvss2Vector": "",
  "cvss2Severity": "",
  "cvss3Score": 0,
  "cvss3Vector": "",
  "cvss3Severity": ""
}
{
  "type": "trivy",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 0,
  "cvss2Vector": "",
  "cvss2Severity": "",
  "cvss3Score": 0,
  "cvss3Vector": "",
  "cvss3Severity": "CRITICAL"
}

after

$ vuls scan
$ vuls report --refresh-cve
$ cat results/2024-05-16T00-24-28+0900/pseudo.json | jq '.scannedCves."CVE-2022-22965".cveContents[][] | {type,cveID,cvss2Score,cvss2Vector,cvss2Severity,cvss3Score,cvss3Vector,cvss3Severity}'
{
  "type": "nvd",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 7.5,
  "cvss2Vector": "AV:N/AC:L/Au:N/C:P/I:P/A:P",
  "cvss2Severity": "HIGH",
  "cvss3Score": 9.8,
  "cvss3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
  "cvss3Severity": "CRITICAL"
}
{
  "type": "nvd",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 0,
  "cvss2Vector": "",
  "cvss2Severity": "",
  "cvss3Score": 0,
  "cvss3Vector": "",
  "cvss3Severity": ""
}
{
  "type": "trivy:ghsa",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 0,
  "cvss2Vector": "",
  "cvss2Severity": "",
  "cvss3Score": 9.8,
  "cvss3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
  "cvss3Severity": ""
}
{
  "type": "trivy:ghsa",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 0,
  "cvss2Vector": "",
  "cvss2Severity": "",
  "cvss3Score": 0,
  "cvss3Vector": "",
  "cvss3Severity": "CRITICAL"
}
{
  "type": "trivy:nvd",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 7.5,
  "cvss2Vector": "AV:N/AC:L/Au:N/C:P/I:P/A:P",
  "cvss2Severity": "",
  "cvss3Score": 9.8,
  "cvss3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
  "cvss3Severity": ""
}
{
  "type": "trivy:nvd",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 0,
  "cvss2Vector": "",
  "cvss2Severity": "",
  "cvss3Score": 0,
  "cvss3Vector": "",
  "cvss3Severity": "CRITICAL"
}
{
  "type": "trivy:redhat",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 0,
  "cvss2Vector": "",
  "cvss2Severity": "",
  "cvss3Score": 8.1,
  "cvss3Vector": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
  "cvss3Severity": ""
}
{
  "type": "trivy:redhat",
  "cveID": "CVE-2022-22965",
  "cvss2Score": 0,
  "cvss2Vector": "",
  "cvss2Severity": "",
  "cvss3Score": 0,
  "cvss3Vector": "",
  "cvss3Severity": "HIGH"
}

vuls tui
image

trivy-to-vuls

unit test: contrib/trivy/parser/v2/parser_test.go

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 May 15, 2024
@MaineK00n MaineK00n marked this pull request as ready for review May 15, 2024 15:53
@MaineK00n MaineK00n requested a review from shino May 15, 2024 15:54
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.

Perfect!!

@MaineK00n MaineK00n merged commit 878c25b into master May 17, 2024
7 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/trivy-to-vuls branch May 17, 2024 10:11
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.

The enhancement of the amount of cveContents information included in trivy-to-vuls
2 participants