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

Validate CVSS vectors that grype reports on #1441

Open
wagoodman opened this issue Aug 17, 2023 · 2 comments
Open

Validate CVSS vectors that grype reports on #1441

wagoodman opened this issue Aug 17, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@wagoodman
Copy link
Contributor

wagoodman commented Aug 17, 2023

(a topic from the OSS community meeting today from @pandatix)

Today grype outputs CVSS information in the JSON output, however, this is unprocessed vectors from upstream data providers. Ideally we should be validating these vectors and reporting issues (at least with log.warning()) when there are CVSS vectors reported which are not valid.

Things to consider:

  • should this validation be upstream in grype-db or vunnel? (probably not since that would mean showing a warning no one would see or suppressing potentially useful information from the user)
  • how should validation be expressed? (logger only? probably should not affect the return code, but up for a conversation on this)

dev note: a lib for consideration https://github.com/pandatix/go-cvss

@wagoodman wagoodman added the enhancement New feature or request label Aug 17, 2023
@pandatix
Copy link

pandatix commented Oct 6, 2023

To help you implement this, and Go folks around here, I documented an efficient way to handle and verify CVSS vectors at https://github.com/pandatix/go-cvss#how-to-determine-cvss-version.

As the idea here is to check whether a CVSS vector is valid or not, you only need to handle the errors (validation is achieved on parsing).

@wagoodman
Copy link
Contributor Author

Based on the conversation from the community meeting, I wanted to drop a few implementations paths here.

Assuming grype-db was the right spot for checking cvss information, I think there are two locations that could make sense:

I think validating on write makes sense, given that they are records that will certainly be in the DB, something which is not necessarily true when simply creating cvss objects.

Either way, the logic for validating should probably live on the cvss object itself, even though it would be invoked when writing

On further thought, I don't think vunnel is the right place for this (but that's certainly debatable) since we don't necessarily use all data from the providers. It might be that there are invalid CVSS vectors that we aren't packing into the DB, in which case messaging out maintainers to take care of such invalid values would not be a good use of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants