From f05632acb6d09957d62d8d0f54e53c514302fca1 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Tue, 21 Jul 2015 23:07:07 -0300 Subject: [PATCH] Adds regression test for the REMOTE_ADDR variable --- .../regression/variable-REMOTE_ADDR.json | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 test/test-cases/regression/variable-REMOTE_ADDR.json diff --git a/test/test-cases/regression/variable-REMOTE_ADDR.json b/test/test-cases/regression/variable-REMOTE_ADDR.json new file mode 100644 index 00000000..d7767d45 --- /dev/null +++ b/test/test-cases/regression/variable-REMOTE_ADDR.json @@ -0,0 +1,88 @@ +[ + { + "enabled":1, + "version_min":300000, + "title":"Testing Variables :: REMOTE_ADDR", + "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":"/one/two/three?key1=value1&key2=v%20a%20l%20u%20e%202", + "protocol":"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":{ + "debug_log":"Target value: \"200.249.12.31\" \\(Variable: REMOTE_ADDR\\)" + }, + "rules":[ + "SecRuleEngine On", + "SecDebugLog \/tmp\/modsec_debug.log", + "SecDebugLogLevel 9", + "SecRule REMOTE_ADDR \"@contains test \" \"phase:3,pass,t:trim\"" + ] + }, + { + "enabled":1, + "version_min":300000, + "title":"Testing Variables :: REMOTE_ADDR", + "client":{ + "ip":"::1", + "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":"/one/two/three?key1=value1&key2=v%20a%20l%20u%20e%202", + "protocol":"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":{ + "debug_log":"Target value: \"::1\" \\(Variable: REMOTE_ADDR\\)" + }, + "rules":[ + "SecRuleEngine On", + "SecDebugLog \/tmp\/modsec_debug.log", + "SecDebugLogLevel 9", + "SecRule REMOTE_ADDR \"@contains test \" \"phase:3,pass,t:trim\"" + ] + } +] \ No newline at end of file