Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Add handler for no rules threat
Browse files Browse the repository at this point in the history
  • Loading branch information
dwisiswant0 committed Dec 16, 2021
1 parent 9184a44 commit 46209b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/runner/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func customs(options *common.Options) {
cat[custom[i].Name] = true

rules := custom[i].Rules
if len(rules) < 1 {
err = strings.Replace(errors.ErrNoThreatRules, ":category", custom[i].Name, -1)
errors.Exit(err)
}

for j := 0; j < len(rules); j++ {
matchers.IsBlank(rules[j].Element, "Custom threat rules element")
elm := fmt.Sprint("$", rules[j].Element)
Expand Down
1 change: 1 addition & 0 deletions pkg/errors/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
ErrNoInputConfig = "No config file specified"
ErrNoInputLog = "No input logs provided"
ErrNoPassZinc = "No password provided for Zinc log server; " + ErrCheckConfig
ErrNoThreatRules = "No rules for ':category' threat category; " + ErrCheckConfig
ErrNoUserZinc = "No username provided for Zinc log server; " + ErrCheckConfig
ErrParseConfig = "Can't parse config file: "
)

0 comments on commit 46209b5

Please sign in to comment.