Repository navigation
fix: keep the dot in NVD CVSS vector strings - #5971
Merged
Merged
Conversation
Signed-off-by: Jaswanthmadimi <masa22ise@cmrit.ac.in>
Collaborator
|
All tests passed, merge time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
format_data_api2cleansCVSS_vectorwithre.sub("[^A-Za-z0-9:/]", "", ...).That filter also removes
., so every NVD CVSS 3.x vector is stored without thedot in its version prefix:
CVSS:3.1/AV:N/...becomesCVSS:31/AV:N/..., andCVSS:3.0/becomesCVSS:30/. Thecvsslibrary rejects these vectors. OSVvectors are stored with the dot (via
CVSS3.clean_vector()), so today the twosources store vectors in different forms. CVSS 2 vectors have no prefix and are
not affected.
Change
.in the filter. Everything else it removed is still removed.format_data_api2on a minimal NVD API 2.0 record:a
CVSS:3.1/vector is stored unchanged, and a vector surrounded by junkcharacters (space, quotes,
;<>, newline) is still cleaned without losingthe dot.
Effect for users
After the next database update, NVD vectors in output that shows them (for
example CSV and JSON) read
CVSS:3.1/...instead ofCVSS:31/.... Scores andseverities don't change. Existing databases keep the old form until they are
refreshed.
Testing
main, only because of the missing dot, and pass withthis change.
pytest test/test_source_nvd.py test/test_source_osv.py test/test_cvedb.py test/test_nvd_api.py test/test_fetch_json_db.py: 33 passed, 12 skipped(network/long tests). Before: 31 passed, 12 skipped; the difference is the 2
new tests.
This also matters for CVSS 4.0 support (#4238): with the current filter,
CVSS:4.0/vectors would be stored asCVSS:40/. The same filter change is partof #4944 by @JigyasuRajput; this PR splits it out as a standalone fix.