diff --git a/parser/rule_parser.go b/parser/rule_parser.go index e61ef0e2..4d56abad 100644 --- a/parser/rule_parser.go +++ b/parser/rule_parser.go @@ -610,6 +610,11 @@ func (r *RuleParser) getConditions(conditionsInterface []interface{}) ([]engine. if err != nil { return nil, nil, err } + // There was no error so the conditions have all been filtered + // Return early to prevent constructing an empty rule + if len(conds) == 0 && len(conds) != len(iConditions) { + return []engine.ConditionEntry{}, nil, nil + } ce = engine.ConditionEntry{ From: from, As: as, @@ -631,6 +636,11 @@ func (r *RuleParser) getConditions(conditionsInterface []interface{}) ([]engine. if err != nil { return nil, nil, err } + // There was no error so the conditions have all been filtered + // Return early to prevent constructing an empty rule + if len(conds) == 0 && len(conds) != len(iConditions) { + return []engine.ConditionEntry{}, nil, nil + } ce = engine.ConditionEntry{ From: from, As: as,