|
Line 0
Link Here
|
|
|
1 |
--- test/test-cases/regression/variable-TX.json.orig 2020-01-13 13:09:28 UTC |
| 2 |
+++ test/test-cases/regression/variable-TX.json |
| 3 |
@@ -80,5 +80,143 @@ |
| 4 |
"SecRule REQUEST_HEADERS \"@rx ([A-z]+)\" \"id:1,log,pass,capture,id:14\"", |
| 5 |
"SecRule TX:0 \"@rx ([A-z]+)\" \"id:15\"" |
| 6 |
] |
| 7 |
+ }, |
| 8 |
+ { |
| 9 |
+ "enabled":1, |
| 10 |
+ "version_min":300000, |
| 11 |
+ "title":"Testing Variables :: capture group match after unused group", |
| 12 |
+ "client":{ |
| 13 |
+ "ip":"200.249.12.31", |
| 14 |
+ "port":123 |
| 15 |
+ }, |
| 16 |
+ "server":{ |
| 17 |
+ "ip":"200.249.12.31", |
| 18 |
+ "port":80 |
| 19 |
+ }, |
| 20 |
+ "request":{ |
| 21 |
+ "uri":"/?key=aadd", |
| 22 |
+ "method":"GET" |
| 23 |
+ }, |
| 24 |
+ "response":{ |
| 25 |
+ "headers":{ |
| 26 |
+ "Date":"Mon, 13 Jul 2015 20:02:41 GMT", |
| 27 |
+ "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT", |
| 28 |
+ "Content-Type":"text/html" |
| 29 |
+ }, |
| 30 |
+ "body":[ |
| 31 |
+ "no need." |
| 32 |
+ ] |
| 33 |
+ }, |
| 34 |
+ "expected":{ |
| 35 |
+ "debug_log":"Added regex subexpression TX\\.3: dd[\\s\\S]*Target value: \"dd\" \\(Variable\\: TX\\:3[\\s\\S]*Rule returned 1" |
| 36 |
+ }, |
| 37 |
+ "rules":[ |
| 38 |
+ "SecRuleEngine On", |
| 39 |
+ "SecRule ARGS \"@rx (aa)(bb|cc)?(dd)\" \"id:1,log,pass,capture,id:16\"", |
| 40 |
+ "SecRule TX:3 \"@streq dd\" \"id:19,phase:2,log,pass\"" |
| 41 |
+ ] |
| 42 |
+ }, |
| 43 |
+ { |
| 44 |
+ "enabled":1, |
| 45 |
+ "version_min":300000, |
| 46 |
+ "title":"Testing Variables :: empty capture group match followed by nonempty capture group", |
| 47 |
+ "client":{ |
| 48 |
+ "ip":"200.249.12.31", |
| 49 |
+ "port":123 |
| 50 |
+ }, |
| 51 |
+ "server":{ |
| 52 |
+ "ip":"200.249.12.31", |
| 53 |
+ "port":80 |
| 54 |
+ }, |
| 55 |
+ "request":{ |
| 56 |
+ "uri":"/?key=aadd", |
| 57 |
+ "method":"GET" |
| 58 |
+ }, |
| 59 |
+ "response":{ |
| 60 |
+ "headers":{ |
| 61 |
+ "Date":"Mon, 13 Jul 2015 20:02:41 GMT", |
| 62 |
+ "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT", |
| 63 |
+ "Content-Type":"text/html" |
| 64 |
+ }, |
| 65 |
+ "body":[ |
| 66 |
+ "no need." |
| 67 |
+ ] |
| 68 |
+ }, |
| 69 |
+ "expected":{ |
| 70 |
+ "debug_log":"Added regex subexpression TX\\.3: dd[\\s\\S]*Target value: \"dd\" \\(Variable\\: TX\\:3[\\s\\S]*Rule returned 1" |
| 71 |
+ }, |
| 72 |
+ "rules":[ |
| 73 |
+ "SecRuleEngine On", |
| 74 |
+ "SecRule ARGS \"@rx (aa)(bb|cc|)(dd)\" \"id:18,phase:1,log,pass,capture\"", |
| 75 |
+ "SecRule TX:3 \"@streq dd\" \"id:19,phase:2,log,pass\"" |
| 76 |
+ ] |
| 77 |
+ }, |
| 78 |
+ { |
| 79 |
+ "enabled":1, |
| 80 |
+ "version_min":300000, |
| 81 |
+ "title":"Testing Variables :: repeating capture group -- alternates", |
| 82 |
+ "client":{ |
| 83 |
+ "ip":"200.249.12.31", |
| 84 |
+ "port":123 |
| 85 |
+ }, |
| 86 |
+ "server":{ |
| 87 |
+ "ip":"200.249.12.31", |
| 88 |
+ "port":80 |
| 89 |
+ }, |
| 90 |
+ "request":{ |
| 91 |
+ "uri":"/?key=_abc123_", |
| 92 |
+ "method":"GET" |
| 93 |
+ }, |
| 94 |
+ "response":{ |
| 95 |
+ "headers":{ |
| 96 |
+ "Date":"Mon, 13 Jul 2015 20:02:41 GMT", |
| 97 |
+ "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT", |
| 98 |
+ "Content-Type":"text/html" |
| 99 |
+ }, |
| 100 |
+ "body":[ |
| 101 |
+ "no need." |
| 102 |
+ ] |
| 103 |
+ }, |
| 104 |
+ "expected":{ |
| 105 |
+ "debug_log":"Added regex subexpression TX\\.2: abc[\\s\\S]*Added regex subexpression TX\\.3: 123" |
| 106 |
+ }, |
| 107 |
+ "rules":[ |
| 108 |
+ "SecRuleEngine On", |
| 109 |
+ "SecRule ARGS \"@rx _((?:(abc)|(123))+)_\" \"id:18,phase:1,log,pass,capture\"" |
| 110 |
+ ] |
| 111 |
+ }, |
| 112 |
+ { |
| 113 |
+ "enabled":1, |
| 114 |
+ "version_min":300000, |
| 115 |
+ "title":"Testing Variables :: repeating capture group -- same (nested)", |
| 116 |
+ "client":{ |
| 117 |
+ "ip":"200.249.12.31", |
| 118 |
+ "port":123 |
| 119 |
+ }, |
| 120 |
+ "server":{ |
| 121 |
+ "ip":"200.249.12.31", |
| 122 |
+ "port":80 |
| 123 |
+ }, |
| 124 |
+ "request":{ |
| 125 |
+ "uri":"/?key=a:5a:8a:9", |
| 126 |
+ "method":"GET" |
| 127 |
+ }, |
| 128 |
+ "response":{ |
| 129 |
+ "headers":{ |
| 130 |
+ "Date":"Mon, 13 Jul 2015 20:02:41 GMT", |
| 131 |
+ "Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT", |
| 132 |
+ "Content-Type":"text/html" |
| 133 |
+ }, |
| 134 |
+ "body":[ |
| 135 |
+ "no need." |
| 136 |
+ ] |
| 137 |
+ }, |
| 138 |
+ "expected":{ |
| 139 |
+ "debug_log":"Added regex subexpression TX\\.1: 5[\\s\\S]*Added regex subexpression TX\\.2: 8[\\s\\S]*Added regex subexpression TX\\.3: 9" |
| 140 |
+ }, |
| 141 |
+ "rules":[ |
| 142 |
+ "SecRuleEngine On", |
| 143 |
+ "SecRule ARGS \"@rx a:([0-9])(?:a:([0-9])(?:a:([0-9]))*)*\" \"id:18,phase:1,log,pass,capture\"" |
| 144 |
+ ] |
| 145 |
} |
| 146 |
] |