Skip to content

Commit

Permalink
Fixed severity parsing for templates with commas
Browse files Browse the repository at this point in the history
  • Loading branch information
Ice3man543 committed Mar 13, 2021
1 parent 31094ab commit f6fc4e5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions v2/internal/runner/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,18 @@ func (r *Runner) listAvailableTemplates() {

func hasMatchingSeverity(templateSeverity string, allowedSeverities []string) bool {
for _, s := range allowedSeverities {
s = strings.ToLower(s)
if s != "" && strings.HasPrefix(templateSeverity, s) {
return true
finalSeverities := []string{}
if strings.Contains(s, ",") {
finalSeverities = strings.Split(s, ",")
} else {
finalSeverities = append(finalSeverities, s)
}

for _, sev := range finalSeverities {
sev = strings.ToLower(sev)
if sev != "" && strings.HasPrefix(templateSeverity, sev) {
return true
}
}
}
return false
Expand Down

0 comments on commit f6fc4e5

Please sign in to comment.