Fix rule-update-target exclusions for plain (non-regex) variables

This commit is contained in:
martinhsv
2020-02-05 06:57:01 -08:00
committed by Felipe Zimmerle
parent f7e4c1d9f5
commit 1b1fdc055b
5 changed files with 92 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
{
"enabled":1,
"version_min":300000,
"title":"SecRuleUpdateTargetById",
"title":"SecRuleUpdateTargetById - exclude whole collection",
"client":{
"ip":"200.249.12.31",
"port":123
@@ -34,6 +34,7 @@
"http_code": 200
},
"rules":[
"SecRuleEngine On",
"SecRuleUpdateTargetById 1 !ARGS",
"SecRule ARGS \"@contains value\" \"id:1,pass,t:trim,tag:'test',deny\""
]
@@ -41,7 +42,7 @@
{
"enabled":1,
"version_min":300000,
"title":"SecRuleUpdateTargetById",
"title":"SecRuleUpdateTargetById - exclude using regex",
"client":{
"ip":"200.249.12.31",
"port":123
@@ -56,7 +57,7 @@
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?mixpanel$=value&mixpanel$=other_value",
"uri":"/?mixpanel=value&mixpanel=other_value",
"method":"GET"
},
"response":{
@@ -73,8 +74,49 @@
"http_code": 200
},
"rules":[
"SecRuleEngine On",
"SecRuleUpdateTargetById 1 !ARGS:/mixpanel$/",
"SecRule ARGS \"@contains value\" \"id:1,pass,t:trim,tag:'test',deny\""
]
},
{
"enabled":1,
"version_min":300000,
"title":"SecRuleUpdateTargetById - exclude using full name",
"client":{
"ip":"200.249.12.31",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?mixpanel=value",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"http_code": 200
},
"rules":[
"SecRuleEngine On",
"SecRuleUpdateTargetById 1 !ARGS:mixpanel",
"SecRule ARGS \"@contains value\" \"id:1,t:trim,tag:'test',deny\""
]
}
]

View File

@@ -238,5 +238,45 @@
"SecRuleUpdateTargetByTag test !ARGS:'/^ref/'",
"SecRule ARGS \"@contains something\" \"id:1,pass,t:trim,tag:'test',deny\""
]
},
{
"enabled":1,
"version_min":300000,
"title":"SecRuleUpdateTargetByTag Test (7/6) Exclusion by full name",
"client":{
"ip":"200.249.12.31",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?key=value&ref=something",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"http_code": 200
},
"rules":[
"SecRuleEngine On",
"SecRuleUpdateTargetByTag test !ARGS:ref",
"SecRule ARGS \"@contains something\" \"id:1,pass,t:trim,tag:'test',deny\""
]
}
]