Skip to content

Commit

Permalink
feat: error early when pattern var is not found (#1660)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsapet authored Jul 30, 2024
1 parent 20ef042 commit 6b61395
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/scanner/detectors/customrule/filters/filters.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package filters

import (
"fmt"
"regexp"
"slices"
"strconv"
Expand Down Expand Up @@ -203,6 +204,9 @@ func (filter *Rule) Evaluate(
patternVariables variableshape.Values,
) (*Result, error) {
node := patternVariables.Node(filter.Variable)
if node == nil {
return nil, fmt.Errorf("couldn't find node for var %s", filter.Variable.Name())
}
detections, err := detectorContext.Scan(node, filter.Rule, filter.TraversalStrategy)
if err != nil {
return nil, err
Expand Down

0 comments on commit 6b61395

Please sign in to comment.