|
@@ -16,7 +16,7 @@ func TestVPatchRuleString(t *testing.T) {
|
|
Match: match{Type: "regex", Value: "[^a-zA-Z]"},
|
|
Match: match{Type: "regex", Value: "[^a-zA-Z]"},
|
|
Transform: []string{"lowercase"},
|
|
Transform: []string{"lowercase"},
|
|
},
|
|
},
|
|
- expected: `SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:1136235475,phase:2,deny,log,msg:'Base Rule',t:lowercase"`,
|
|
|
|
|
|
+ expected: `SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:2203944045,phase:2,deny,log,msg:'Base Rule',tag:'crowdsec-Base Rule',t:lowercase"`,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: "Multiple Zones",
|
|
name: "Multiple Zones",
|
|
@@ -26,7 +26,7 @@ func TestVPatchRuleString(t *testing.T) {
|
|
Match: match{Type: "regex", Value: "[^a-zA-Z]"},
|
|
Match: match{Type: "regex", Value: "[^a-zA-Z]"},
|
|
Transform: []string{"lowercase"},
|
|
Transform: []string{"lowercase"},
|
|
},
|
|
},
|
|
- expected: `SecRule ARGS_GET:foo|ARGS_POST:foo "@rx [^a-zA-Z]" "id:2088895799,phase:2,deny,log,msg:'Multiple Zones',t:lowercase"`,
|
|
|
|
|
|
+ expected: `SecRule ARGS_GET:foo|ARGS_POST:foo "@rx [^a-zA-Z]" "id:3387135861,phase:2,deny,log,msg:'Multiple Zones',tag:'crowdsec-Multiple Zones',t:lowercase"`,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: "Basic AND",
|
|
name: "Basic AND",
|
|
@@ -47,8 +47,8 @@ func TestVPatchRuleString(t *testing.T) {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- expected: `SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:2323451654,phase:2,deny,log,msg:'Basic AND_and_0',t:lowercase,chain"
|
|
|
|
-SecRule ARGS_GET:bar "@rx [^a-zA-Z]" "id:2075918819,phase:2,deny,log,msg:'Basic AND_and_1',t:lowercase"`,
|
|
|
|
|
|
+ expected: `SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:4145519614,phase:2,deny,log,msg:'Basic AND',tag:'crowdsec-Basic AND',t:lowercase,chain"
|
|
|
|
+SecRule ARGS_GET:bar "@rx [^a-zA-Z]" "id:1865217529,phase:2,deny,log,msg:'Basic AND',tag:'crowdsec-Basic AND',t:lowercase"`,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: "Basic OR",
|
|
name: "Basic OR",
|
|
@@ -68,8 +68,8 @@ SecRule ARGS_GET:bar "@rx [^a-zA-Z]" "id:2075918819,phase:2,deny,log,msg:'Basic
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- expected: `SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:2720972114,phase:2,deny,log,msg:'Basic OR_or_0',t:lowercase,skip:1"
|
|
|
|
-SecRule ARGS_GET:bar "@rx [^a-zA-Z]" "id:2638639999,phase:2,deny,log,msg:'Basic OR_or_1',t:lowercase"`,
|
|
|
|
|
|
+ expected: `SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:651140804,phase:2,deny,log,msg:'Basic OR',tag:'crowdsec-Basic OR',t:lowercase,skip:1"
|
|
|
|
+SecRule ARGS_GET:bar "@rx [^a-zA-Z]" "id:271441587,phase:2,deny,log,msg:'Basic OR',tag:'crowdsec-Basic OR',t:lowercase"`,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: "OR AND mix",
|
|
name: "OR AND mix",
|
|
@@ -97,8 +97,9 @@ SecRule ARGS_GET:bar "@rx [^a-zA-Z]" "id:2638639999,phase:2,deny,log,msg:'Basic
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- expected: `SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:2720972114,phase:2,deny,log,msg:'Basic OR_or_0',t:lowercase,skip:1"
|
|
|
|
-SecRule ARGS_GET:bar "@rx [^a-zA-Z]" "id:2638639999,phase:2,deny,log,msg:'Basic OR_or_1',t:lowercase"`,
|
|
|
|
|
|
+ expected: `SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:1714963250,phase:2,deny,log,msg:'OR AND mix',tag:'crowdsec-OR AND mix',t:lowercase,skip:1"
|
|
|
|
+SecRule ARGS_GET:bar "@rx [^a-zA-Z]" "id:1519945803,phase:2,deny,log,msg:'OR AND mix',tag:'crowdsec-OR AND mix',t:lowercase"
|
|
|
|
+SecRule ARGS_GET:foo "@rx [^a-zA-Z]" "id:1519945803,phase:2,deny,log,msg:'OR AND mix',tag:'crowdsec-OR AND mix',t:lowercase"`,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
|