RedHatProductSecurity / cvss

CVSS2/3/4 library with interactive calculator for Python 2 and Python 3
GNU Lesser General Public License v3.0
79 stars 28 forks source link

KeyError thrown for missing mandatory metric #19

Closed bac closed 5 years ago

bac commented 5 years ago

At this line in parse_vector a dictionary lookup on 'S' is made. S is a mandatory metric but that check is not made until after parse_vector.

As a result, initializing a CVSS3 with an invalid vector missing 'S' raises a KeyError instead of the expected CVSS3MandatoryError.

https://github.com/skontar/cvss/blob/master/cvss/cvss3.py#L147

skontar commented 5 years ago

Hi! Thanks for reporting the issue. I have created a fix for it, would you mind reviewing it? Thanks!

skontar commented 5 years ago

Fixed.