diff --git a/pkg/scanner/detectors/customrule/filters/filters.go b/pkg/scanner/detectors/customrule/filters/filters.go index b4840afc1..2dc9b1a8a 100644 --- a/pkg/scanner/detectors/customrule/filters/filters.go +++ b/pkg/scanner/detectors/customrule/filters/filters.go @@ -1,6 +1,7 @@ package filters import ( + "fmt" "regexp" "slices" "strconv" @@ -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