return an error if a custom rule has both and and or

This commit is contained in:
Sebastien Blot 2023-12-04 11:08:58 +01:00
parent 60faeaa7d7
commit 2a920124fe
No known key found for this signature in database
GPG key ID: DFC2902F40449F6A

View file

@ -82,6 +82,10 @@ func (m *ModsecurityRule) generateRuleID(rule *CustomRule, waapRuleName string,
func (m *ModsecurityRule) buildRules(rule *CustomRule, waapRuleName string, and bool, toSkip int, depth int) ([]string, error) {
ret := make([]string, 0)
if len(rule.And) != 0 && len(rule.Or) != 0 {
return nil, fmt.Errorf("cannot have both 'and' and 'or' in the same rule")
}
if rule.And != nil {
for c, andRule := range rule.And {
depth++