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

Scores that differ from first.org calculator #3

Open
jzebor opened this issue Dec 14, 2023 · 2 comments
Open

Scores that differ from first.org calculator #3

jzebor opened this issue Dec 14, 2023 · 2 comments

Comments

@jzebor
Copy link

jzebor commented Dec 14, 2023

Comparing first.org and cvsspy scores uncovered a small inconsistency. Out of 50 example vectors, there are mismatches between implementations when first.org scores something as 4.3, cvss4py scores it as 4.2. Here are three cases which resulted in the mismatch. If I find more test cases that result in a mismatch I'll provide them.

Vector 1: CVSS:4.0/AV:P/AC:H/AT:N/PR:L/UI:A/VC:L/VI:H/VA:N/SC:N/SI:N/SA:L
Vector 2: CVSS:4.0/AV:L/AC:H/AT:N/PR:H/UI:P/VC:H/VI:L/VA:N/SC:N/SI:L/SA:L
Vector 3: CVSS:4.0/AV:P/AC:H/AT:P/PR:N/UI:P/VC:L/VI:H/VA:N/SC:L/SI:L/SA:N

First.org calculator scores as 4.3
cvss4py "score_vector" function scores as 4.2

@jzebor
Copy link
Author

jzebor commented Dec 14, 2023

Here is another vector that results in a mis-match.
CVSS:4.0/AV:A/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:U

first.org: 2.3
cvss4py: 2.2

@bjedwards
Copy link
Owner

So I think this is how python handles rounding vs javascript. Javascript does the "school" round ing which rounds half values up. Python has implemented the "correct" banker rounding which is "round half to even". I have replaced it, and the above work, I'll do some more testing to see if that was the issue on the rest.

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

No branches or pull requests

2 participants