mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 11:16:33 +03:00
Adds support to JSON request body parser
This commit is contained in:
84
test/test-cases/regression/request-body-parser-json.json
Normal file
84
test/test-cases/regression/request-body-parser-json.json
Normal file
@@ -0,0 +1,84 @@
|
||||
[
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing JSON request body parser 1/1",
|
||||
"expected":{
|
||||
"debug_log": "Target value: \"bar\" \\(Variable: ARGS:foo\\)"
|
||||
},
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
"port":123
|
||||
},
|
||||
"request":{
|
||||
"headers":{
|
||||
"Host":"localhost",
|
||||
"User-Agent":"curl/7.38.0",
|
||||
"Accept":"*/*",
|
||||
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"uri":"/?key=value&key=other_value",
|
||||
"method":"POST",
|
||||
"body": [
|
||||
"{",
|
||||
" \"foo\":\"bar\",",
|
||||
" \"mod\":\"sec\"",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
"server":{
|
||||
"ip":"200.249.12.31",
|
||||
"port":80
|
||||
},
|
||||
"rules":[
|
||||
"SecRuleEngine On",
|
||||
"SecRequestBodyAccess On",
|
||||
"SecRule REQUEST_HEADERS:Content-Type \"application/json\" \"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON\"",
|
||||
"SecRule ARGS:foo \"bar\" \"id:'200441',phase:3,log\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing JSON request body parser 1/1",
|
||||
"expected":{
|
||||
"debug_log": "Target value: \"bar\" \\(Variable: ARGS:first_level.first_key\\)"
|
||||
},
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
"port":123
|
||||
},
|
||||
"request":{
|
||||
"headers":{
|
||||
"Host":"localhost",
|
||||
"User-Agent":"curl/7.38.0",
|
||||
"Accept":"*/*",
|
||||
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"uri":"/?key=value&key=other_value",
|
||||
"method":"POST",
|
||||
"body": [
|
||||
"{",
|
||||
"\"first_level\":",
|
||||
"{",
|
||||
" \"first_key\":\"bar\",",
|
||||
" \"second_key\":\"sec\"",
|
||||
"}",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
"server":{
|
||||
"ip":"200.249.12.31",
|
||||
"port":80
|
||||
},
|
||||
"rules":[
|
||||
"SecRuleEngine On",
|
||||
"SecRequestBodyAccess On",
|
||||
"SecRule REQUEST_HEADERS:Content-Type \"application/json\" \"id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON\"",
|
||||
"SecRule ARGS \"bar\" \"id:'200441',phase:3,log\""
|
||||
]
|
||||
}
|
||||
]
|
||||
|
Reference in New Issue
Block a user