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 calculation of CVSSv3.1 environmental scores #89

Merged
merged 1 commit into from
May 23, 2024

Conversation

nscuro
Copy link
Contributor

@nscuro nscuro commented May 22, 2024

  • Fixed environmental score calculation by using base score values if the environmental score values are null or NOT_DEFINED ("X") -> otherwise the environmental score is zero if not all fields are set
  • Adds check for negative values in CvssV3#roundNearestTenth

Extracted from #17 by @michael-hinterdorfer.

Aligns CvssV3_1#calculateScore with the calculator from first.org (https://www.first.org/cvss/calculator/cvsscalc31.js).

Aside from fixing the score calculation, it also streamlines the calculation logic by removing unnecessary nesting.

* Fixed environmental score calculation by using base score values if the environmental score values are null or NOT_DEFINED ("X") -> otherwise the environmental score is zero if not all fields are set
* Adds check for negative values in `CvssV3#roundNearestTenth`

Extracted from stevespringett#17

Aligns `CvssV3_1#calculateScore` with the calculator from first.org (https://www.first.org/cvss/calculator/cvsscalc31.js).

Aside from fixing the score calculation, it also streamlines the calculation logic by removing unnecessary nesting.

Co-authored-by: Michael Hinterdorfer <[email protected]>
@stevespringett stevespringett merged commit 1f215cd into stevespringett:master May 23, 2024
2 checks passed
@nscuro nscuro deleted the cleanup-pr-17 branch May 23, 2024 16:43
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.

2 participants