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

mvp for getting scores and severity of vulnerabilities #653

Closed
wants to merge 3 commits into from
Closed

mvp for getting scores and severity of vulnerabilities #653

wants to merge 3 commits into from

Conversation

matteoannotell
Copy link

@matteoannotell matteoannotell commented Jul 26, 2023

Purpose: we want to retrieve a measure of severity of the vulnerabilities detected, in order to suppress too noisy alerts.
To do so, we introduce an API call to

base_url = "https://services.nvd.nist.gov/rest/json/cve/1.0/"
url = f"{base_url}/{vulnerability_id}"

for each CVE vulnerability detected, either via pypi or via osv.
When the CVE is not present or not found in the database, we return None.

The layout of the tabular output has been changed accordingly to include two new columns, score and severity, which are respectively

first_item["impact"]["baseMetricV3"]["cvssV3"]["baseScore"]
first_item["impact"]["baseMetricV3"]["cvssV3"]["baseSeverity"]

The new output looks like this:

Found 2 known vulnerabilities in 2 packages
Name       Version ID               Fix Versions Severity Score
---------- ------- ---------------- ------------ -------- -----
py         1.11.0  PYSEC-2022-42969              HIGH     7.5
setuptools 65.5.0  PYSEC-2022-43012 65.5.1       MEDIUM   5.9

json and cyclonedx output have also been changed so that the severity and score will be visible therein.
Since NVD has a limit of 5 requests over a moving window of 30 seconds, we included the possibility of using an api-key from one's environment, if that is present (as NVD_API_KEY). This will increase the limit to 50 requests per 30 seconds, which should cover most use-cases.

A disclaimer for using NVD API has been added, for complying with NVD requests when using their product

@matteoannotell matteoannotell changed the title mvp for getting scores and severity mvp for getting scores and severity of vulnerabilities Jul 26, 2023
@matteoannotell
Copy link
Author

Closing this PR after discussion with maintainers

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.

1 participant