From 25bb1f1bcc7252e93bd42067cac23a07b71fb8b9 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Thu, 29 Nov 2018 15:20:25 -0300 Subject: [PATCH] Changes ENV test case to read the default MODSECURTIY env var --- CHANGES | 2 + test/test-cases/regression/variable-ENV.json | 55 ++++++++++++++++++-- 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 6778d76c..9448c281 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ v3.0.4 - YYYY-MMM-DD (to be released) ------------------------------------- + - Changes ENV test case to read the default MODSECURTIY env var + [@zimmerle] - Regression: Sets MODSECURITY env var during the tests execution [@zimmerle] - Fix setenv action to strdup key=variable diff --git a/test/test-cases/regression/variable-ENV.json b/test/test-cases/regression/variable-ENV.json index b5d0c70b..c890b95c 100644 --- a/test/test-cases/regression/variable-ENV.json +++ b/test/test-cases/regression/variable-ENV.json @@ -2,7 +2,7 @@ { "enabled":1, "version_min":300000, - "title":"Testing Variables :: ENV (1/3)", + "title":"Testing Variables :: ENV (1/4)", "client":{ "ip":"200.249.12.31", "port":123 @@ -46,7 +46,7 @@ { "enabled":1, "version_min":300000, - "title":"Testing Variables :: ENV (2/3)", + "title":"Testing Variables :: ENV (2/4)", "client":{ "ip":"200.249.12.31", "port":123 @@ -80,17 +80,62 @@ ] }, "expected":{ - "debug_log":"Variable: ENV:TERM" + "debug_log":"regression tests\" .Variable: ENV:MODSECURITY." }, "rules":[ "SecRuleEngine On", - "SecRule ENV:TERM \"@contains test\" \"id:1,phase:3,pass,t:trim\"" + "SecRule ENV:MODSECURITY \"@contains test\" \"id:1,phase:3,pass,t:trim\"" ] }, { "enabled":1, "version_min":300000, - "title":"Testing Variables :: ENV (3/3)", + "title":"Testing Variables :: ENV (3/4)", + "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":"*/*", + "Content-Length": "27", + "Content-Type": "application/x-www-form-urlencoded" + }, + "uri":"/", + "method":"POST", + "body": [ + "param1=value1¶m2=value2" + ] + }, + "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":{ + "debug_log":"Target value: \"bar\" .Variable: ENV:modfoo." + }, + "rules":[ + "SecRuleEngine On", + "SecRule ARGS \"@contains value\" \"id:1,phase:3,pass,t:trim,setenv:modfoo=bar\"", + "SecRule ENV:modfoo \"@contains test\" \"id:2,phase:3,pass,t:trim\"" + ] + }, + { + "enabled":1, + "version_min":300000, + "title":"Testing Variables :: ENV (4/4)", "client":{ "ip":"200.249.12.31", "port":123