Skip to content

Commit 7b21002

Browse files
committed
Make max arguments to parse configurable
1 parent 06c30dd commit 7b21002

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

waf/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
-- general --
44
nw_enabled = true
55
nw_location_denied = '@waf-blocked'
6+
nw_max_args = 300
67

78
-- rule type toggle --
89
nw_check_url = true

waf/init.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ nw_rules.args = {
228228
check = function()
229229
if nw_check_args then
230230
-- parse args
231-
local args_tab, err = ngx.req.get_uri_args()
231+
local args_tab, err = ngx.req.get_uri_args( nw_max_args )
232232
if err == "truncated" then
233-
-- More than 100 args were passed
234-
block( 'args', 'none', 'more than 100 args supplied')
233+
-- More than 'nw_max_args' args were passed
234+
block( 'args', 'none', 'more than ' .. nw_max_args .. ' args supplied')
235235
elseif err ~= nil or args_tab == nil then
236236
-- If anything was wrong retrieving the args, skip the checks
237237
return true
@@ -256,10 +256,10 @@ nw_rules.post = {
256256
ngx.req.read_body()
257257

258258
-- parse ags
259-
local args_tab, err = ngx.req.get_post_args()
259+
local args_tab, err = ngx.req.get_post_args( nw_max_args )
260260
if err == "truncated" then
261-
-- More than 100 args were passed
262-
block( 'post', 'none', 'more than 100 args supplied' )
261+
-- More than 'nw_max_args' args were passed
262+
block( 'post', 'none', 'more than ' .. nw_max_args .. ' args supplied')
263263
elseif err ~= nil or args_tab == nil then
264264
-- If anything was wrong retrieving the args, skip the checks
265265
return true

0 commit comments

Comments
 (0)