Skip to content

Commit

Permalink
feat: error early when pattern var is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
elsapet committed Jul 29, 2024
1 parent a179682 commit 6ca45ab
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 6ca45ab

Please sign in to comment.