aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/feed.go
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-02-01 08:31:50 -0500
committerPaul Duncan <pabs@pablotron.org>2022-02-01 08:31:50 -0500
commit2632e8a18ce586fa0d40ac71d4b23e8cfb6d508b (patch)
treec5b0ba679cd68ed32db4061a388c2adc3a8b0acd /internal/feed/feed.go
parente66d260451c7be2129b3820069042d0ef4c57665 (diff)
downloadcvez-2632e8a18ce586fa0d40ac71d4b23e8cfb6d508b.tar.bz2
cvez-2632e8a18ce586fa0d40ac71d4b23e8cfb6d508b.zip
internal/feed: add v3privilegesrequired tests
Diffstat (limited to 'internal/feed/feed.go')
-rw-r--r--internal/feed/feed.go32
1 files changed, 1 insertions, 31 deletions
diff --git a/internal/feed/feed.go b/internal/feed/feed.go
index 38a7767..4b18b9d 100644
--- a/internal/feed/feed.go
+++ b/internal/feed/feed.go
@@ -29,36 +29,6 @@ const (
// TODO: parse cpe
-// CVSS privileges required
-type PrivilegesRequired int
-
-// Unmarshal CVSS privileges required from JSON.
-func (me *PrivilegesRequired) 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 "LOW":
- *me = Low
- case "MEDIUM":
- *me = Medium
- case "HIGH":
- *me = High
- default:
- // return error
- return fmt.Errorf("unknown privileges required: %s", s)
- }
-
- // return success
- return nil
-}
-
// CVSS user interaction
type UserInteraction int
@@ -459,7 +429,7 @@ type CvssV3 struct {
AttackComplexity V3AttackComplexity `json:"attackComplexity"`
// privileges required
- PrivilegesRequired PrivilegesRequired `json:"privilegesRequired"`
+ PrivilegesRequired V3PrivilegesRequired `json:"privilegesRequired"`
// user interaction
UserInteraction UserInteraction `json:"userInteraction"`