diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-02-01 13:49:24 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-02-01 13:49:24 -0500 |
commit | 806a74bdff6cf2f014bb93d01d84611c9ef26e04 (patch) | |
tree | b8aa5bb2c9c57a1991b4ed82f02a3082982e8ee7 /internal/feed/feed.go | |
parent | ee4857cdd5416686e36624621b3460f1bc334c54 (diff) | |
download | cvez-806a74bdff6cf2f014bb93d01d84611c9ef26e04.tar.bz2 cvez-806a74bdff6cf2f014bb93d01d84611c9ef26e04.zip |
internal/feed: add severity, severity tests
Diffstat (limited to 'internal/feed/feed.go')
-rw-r--r-- | internal/feed/feed.go | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/internal/feed/feed.go b/internal/feed/feed.go index b8a3849..40e385d 100644 --- a/internal/feed/feed.go +++ b/internal/feed/feed.go @@ -21,36 +21,6 @@ const ( // TODO: parse cpe -// CVSS severity -type Severity int - -// Unmarshal CVSS severity from JSON. -func (me *Severity) UnmarshalJSON(b []byte) error { - // decode string, check for error - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - - // check value - switch s { - case "LOW": - *me = Low - case "MEDIUM": - *me = Medium - case "HIGH": - *me = High - case "CRITICAL": - *me = Critical - default: - // return error - return fmt.Errorf("unknown severity: %s", s) - } - - // return success - return nil -} - type V2AccessVector byte const ( @@ -372,7 +342,7 @@ type CvssV2 struct { // CVSS V2 base metrics type BaseMetricV2 struct { CvssV2 CvssV2 `json:"cvssV2"` - severity Severity `json:"severity"` + Severity Severity `json:"severity"` ExploitabilityScore Score `json:"impactScore"` ImpactScore Score `json:"impactScore"` InsufficientInfo bool `json:"acInsufInfo"` |