Skip to content

Fix CVSS4 clean vector field ordering - Threat and Environmental metrics generate invalid vectors#72

Merged
superbuggy merged 1 commit intoRedHatProductSecurity:masterfrom
Urth:fix/clean-vector-field-order
Mar 26, 2025
Merged

Fix CVSS4 clean vector field ordering - Threat and Environmental metrics generate invalid vectors#72
superbuggy merged 1 commit intoRedHatProductSecurity:masterfrom
Urth:fix/clean-vector-field-order

Conversation

@Urth
Copy link
Contributor

@Urth Urth commented Mar 19, 2025

Fix CVSS4 vectors generated by this module to follow the ordering from the specifications[1]. Before this change all vectors with Threat and Environmental metrics would be invalid and rejected by other CVSS tools[2].

[1] https://www.first.org/cvss/v4-0/specification-document#Vector-String
[2] https://redhatproductsecurity.github.io/cvss-v4-calculator/

This is related to #66 but does not add input validation because the doc strings explicitly mention that fields may be out of order. I've updated the ordering of the other metrics lists in sync with the specification too.

@skontar skontar requested review from jsvob and superbuggy March 19, 2025 19:36
Copy link
Collaborator

@superbuggy superbuggy left a comment

Choose a reason for hiding this comment

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

At first pass this looks good; it may be worth citing the spec source URL in a code comment, as well. Thank you for your contribution!

Fix CVSS4 vectors generated by this module to follow the ordering from
the specifications[1]. Before this change all vectors with Threat and
Environmental metrics would be invalid and rejected by other CVSS
tools[2].

[1] https://www.first.org/cvss/v4-0/specification-document#Vector-String
[2] https://redhatproductsecurity.github.io/cvss-v4-calculator/
@Urth Urth force-pushed the fix/clean-vector-field-order branch from b7df6b9 to ae6d3f8 Compare March 20, 2025 12:50
@Urth
Copy link
Contributor Author

Urth commented Mar 20, 2025

@superbuggy I've added comments to the constants4 module and clean_vector function to point out the significance of the field ordering.

@skontar
Copy link
Collaborator

skontar commented Mar 26, 2025

@superbuggy , looks good now?

@superbuggy superbuggy merged commit 5f53333 into RedHatProductSecurity:master Mar 26, 2025
11 checks passed
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.

3 participants