Skip to content

Commit

Permalink
Detect unknown CVSS version
Browse files Browse the repository at this point in the history
This change ensures the UnknownVersion exception is returned for
unknown cvss version prefix.
  • Loading branch information
TristanCacqueray committed Jul 18, 2024
1 parent eb8f7c1 commit 988f39e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions code/cvss/src/Security/CVSS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ parseCVSS :: Text -> Either CVSSError CVSS
parseCVSS txt
| "CVSS:3.1/" `Text.isPrefixOf` txt = CVSS CVSS31 <$> validateComponents True validateCvss31
| "CVSS:3.0/" `Text.isPrefixOf` txt = CVSS CVSS30 <$> validateComponents True validateCvss30
| "CVSS:" `Text.isPrefixOf` txt = Left UnknownVersion
| otherwise = CVSS CVSS20 <$> validateComponents False validateCvss20
where
validateComponents withPrefix validator = do
Expand Down

0 comments on commit 988f39e

Please sign in to comment.