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: [bug description] ValueError raised whilst using NVD API2 #4675

Open
anthonyharrison opened this issue Jan 6, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@anthonyharrison
Copy link
Contributor

Description

│ xxxxxxx/lib/python3.10/site-packages/cve_bin_tool/data_sources/nvd_source.py:315 in format_data_api2 │
│ │
│ 312 │ │ │ │
│ 313 │ │ │ # score should be numeric │
│ 314 │ │ │ try: │
│ 315 │ │ │ │ cve["score"] = float(cve["score"]) │
│ 316 │ │ │ except ValueError: │
│ 317 │ │ │ │ self.logger.debug(f"Score for {cve['id']} is invalid: {cve['score']}") │
│ 318 │ │ │ │ cve["score"] = "invalid" │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: could not convert string to float: 'unknown'

To reproduce

Update the CVE database to latest version

cve-bin-tool -u now -n api2 .update

Expected behaviour:

CVE is processed even if no CVSS score allocated

Actual behaviour:

ValueError raised and database update fails

Version/platform info

Version of CVE-bin-tool( e.g. output of cve-bin-tool --version): 3.4
Installed from pypi or github? Github

Anything else?

Whilst ValueError should handle the condition, suggest adding a guard statement if cve["score"] != "unknown": before the try/except statement.

Seems to work with -n json-mirror

@anthonyharrison anthonyharrison added the bug Something isn't working label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant