mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Fix: Lua scripts cannot read whole collection at once
This commit is contained in:
13
test/test-cases/data/match-getvars-args.lua
Normal file
13
test/test-cases/data/match-getvars-args.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
function main()
|
||||
local d = m.getvars("ARGS");
|
||||
local size = #d;
|
||||
m.log(9,"ARGS count read =" .. tostring(size));
|
||||
|
||||
ret = nil
|
||||
|
||||
if ( #d == 2 ) then
|
||||
return nil
|
||||
end
|
||||
|
||||
return "Unexpected result"
|
||||
end
|
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing LUA :: m.set TX (1/6)",
|
||||
"title":"Testing LUA :: m.set TX (1/7)",
|
||||
"resource":"lua",
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
@@ -44,7 +44,7 @@
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing LUA :: m.set IP (2/6)",
|
||||
"title":"Testing LUA :: m.set IP (2/7)",
|
||||
"resource":"lua",
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
@@ -86,7 +86,7 @@
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing LUA :: m.set GLOBAL (3/6)",
|
||||
"title":"Testing LUA :: m.set GLOBAL (3/7)",
|
||||
"resource":"lua",
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
@@ -128,7 +128,7 @@
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing LUA :: m.set RESOURCE (4/6)",
|
||||
"title":"Testing LUA :: m.set RESOURCE (4/7)",
|
||||
"resource":"lua",
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
@@ -170,7 +170,7 @@
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing LUA :: m.set SESSION (5/6)",
|
||||
"title":"Testing LUA :: m.set SESSION (5/7)",
|
||||
"resource":"lua",
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
@@ -212,7 +212,7 @@
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing LUA :: m.set USER (6/6)",
|
||||
"title":"Testing LUA :: m.set USER (6/7)",
|
||||
"resource":"lua",
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
@@ -250,5 +250,43 @@
|
||||
"SecRuleScript test-cases/data/setvar.lua \"id:2,pass\"",
|
||||
"SecRule USER.lua_set_var \"@contains 2\" \"id:3,t:none\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"enabled":1,
|
||||
"version_min":300000,
|
||||
"title":"Testing LUA :: m.getvars ARGS (8/8)",
|
||||
"resource":"lua",
|
||||
"client":{
|
||||
"ip":"200.249.12.31",
|
||||
"port":123
|
||||
},
|
||||
"server":{
|
||||
"ip":"200.249.12.31",
|
||||
"port":80
|
||||
},
|
||||
"request":{
|
||||
"headers":{
|
||||
"Host":"localhost",
|
||||
"User-Agent":"My sweet little browser",
|
||||
"Accept":"*/*",
|
||||
"Content-Length": "0"
|
||||
},
|
||||
"uri":"/whee?parm1=a&parm2=b",
|
||||
"method":"GET",
|
||||
"body": [ ]
|
||||
},
|
||||
"response":{
|
||||
"headers":{},
|
||||
"body":[
|
||||
"no need."
|
||||
]
|
||||
},
|
||||
"expected":{
|
||||
"http_code": 200
|
||||
},
|
||||
"rules":[
|
||||
"SecRuleEngine On",
|
||||
"SecRuleScript test-cases/data/match-getvars-args.lua \"id:2,phase:2,deny,status:403\""
|
||||
]
|
||||
}
|
||||
]
|
||||
|
Reference in New Issue
Block a user