diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-02-01 14:34:34 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-02-01 14:34:34 -0500 |
commit | 68714974f6d2887f66101aa020e25faea1631467 (patch) | |
tree | 6ab88e16b9b95b8a290f40a82bceec2bd5971587 /internal/feed/feed.go | |
parent | 6f889af4b0d99ee714bfe33e7f864bc35f567097 (diff) | |
download | cvez-68714974f6d2887f66101aa020e25faea1631467.tar.bz2 cvez-68714974f6d2887f66101aa020e25faea1631467.zip |
internal/feed: add v2authentication, tests
Diffstat (limited to 'internal/feed/feed.go')
-rw-r--r-- | internal/feed/feed.go | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/internal/feed/feed.go b/internal/feed/feed.go index 56fc7d2..affa5d2 100644 --- a/internal/feed/feed.go +++ b/internal/feed/feed.go @@ -6,47 +6,12 @@ import ( ) const ( - None = iota // no priv req/user interaction - Low // low complexity/priv req - Medium // medium complexity/priv req - High // high complexity/priv req - - Critical // critical severity - - CvssVersion31 // CVSS version 3.1 - CvssVersion20 // CVSS version 2.0 - - Single // Single authentication + CvssVersion31 = iota // CVSS version 3.1 + CvssVersion20 // CVSS version 2.0 ) // TODO: parse cpe, cve id -// CVSS V2 authentication -type Authentication int - -// Unmarshal CVSS V2 authentication from JSON. -func (me *Authentication) 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 "NONE": - *me = None - case "SINGLE": - *me = Single - default: - // return error - return fmt.Errorf("unknown authentication: %s", s) - } - - // return success - return nil -} - // CVE metadata type CveMetadata struct { // CVE ID @@ -267,7 +232,7 @@ type CvssV2 struct { AccessComplexity V2AccessComplexity `json:"accessComplexity"` // authentication - Authentication Authentication `json:"authentication"` + Authentication V2Authentication `json:"authentication"` ConfidentialityImpact V2Impact `json:"confidentialityImpact"` IntegrityImpact V2Impact `json:"integrityImpact"` |