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(nvd): handle 'unknown' score value and prevent ValueError #4772

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JigyasuRajput
Copy link
Contributor

Fixes #4675

Description:

  • The issue arises when the score field in a CVE entry is set to "unknown", which causes an error while trying to convert it to a float.

Changes made:

  • Introduced a check to handle the "unknown" score value before attempting to convert it to a float.
  • If the score is "unknown", it is set to "invalid", preventing the ValueError and allowing the CVE processing to continue.
  • This ensures the CVE is processed even if no CVSS score is allocated.

@JigyasuRajput
Copy link
Contributor Author

Hey! @terriko,

Is there anything I need to change or improve? Let me know if any further modifications are required. Thanks!

Copy link
Contributor

@terriko terriko left a comment

Choose a reason for hiding this comment

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

I suspect we want to be able to tell the difference between a score being listed as unknown (which typically means it hasn't been set and may not have been reviewed) vs invalid (which means it was set incorrectly).

Can you swap this so the unknowns don't get overwritten to be invalid?

@JigyasuRajput
Copy link
Contributor Author

Thanks for the feedback! I've updated the logic to ensure that 'unknown' scores remain unchanged. Now, the conversion attempt only happens for scores that are not 'unknown', and any truly invalid values are still handled properly.

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.

fix: [bug description] ValueError raised whilst using NVD API2
2 participants