Skip to content

Commit

Permalink
make priority method more generic in oval struct
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimassaguerpla committed Jul 1, 2016
1 parent bff3991 commit 45afaf2
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions utils/oval/oval.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,23 @@ func link(def definition) (link string) {
}

func priority(def definition) types.Priority {
// The OVAL files provided by SUSE doesn't include any priority/severity yet.
return types.Unknown
// Parse the priority.
priority := strings.TrimSpace(def.Title[strings.LastIndex(def.Title, "(")+1 : len(def.Title)-1])

// Normalize the priority.
switch priority {
case "Low":
return types.Low
case "Moderate":
return types.Medium
case "Important":
return types.High
case "Critical":
return types.Critical
default:
log.Warning("could not determine vulnerability priority from: %s.", priority)
return types.Unknown
}
}

func getCriterions(node criteria) [][]criterion {
Expand Down

0 comments on commit 45afaf2

Please sign in to comment.