Skip to content

Commit

Permalink
Return error if no placeholder function is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleyjkemp committed Sep 2, 2022
1 parent 21cd4e5 commit 5321737
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions evaluator/evaluate_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ func (rule *RuleEvaluator) getMatcherValues(ctx context.Context, matcher sigma.F
for _, value := range matcher.Values {
if strings.HasPrefix(value, "%") && strings.HasSuffix(value, "%") {
// expand placeholder to values
if rule.expandPlaceholder == nil {
return nil, fmt.Errorf("can't expand %s, no placeholder expander function defined", value)
}
placeholderValues, err := rule.expandPlaceholder(ctx, value)
if err != nil {
return nil, fmt.Errorf("failed to expand placeholder: %w", err)
Expand Down

0 comments on commit 5321737

Please sign in to comment.