Skip to content

Commit 191dba9

Browse files
committed
Format regression test JSON files
by running the following command: ``` (cd test; ./regression_tests format) ```
1 parent 37e1f13 commit 191dba9

File tree

195 files changed

+22639
-19363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+22639
-19363
lines changed

test/test-cases/regression/action-allow.json

Lines changed: 94 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,129 @@
11
[
22
{
3-
"enabled":1,
4-
"version_min":300000,
5-
"title":"Testing allow action (1/3)",
6-
"expected":{
7-
"debug_log": "Skipped rule id 'action-allow.json:3' as request trough the utilization of an `allow' action",
8-
"http_code": 200
3+
"enabled": 1,
4+
"version_min": 300000,
5+
"title": "Testing allow action (1/3)",
6+
"client": {
7+
"ip": "200.249.12.31",
8+
"port": 123
99
},
10-
"client":{
11-
"ip":"200.249.12.31",
12-
"port":123
10+
"server": {
11+
"ip": "200.249.12.31",
12+
"port": 80
1313
},
14-
"request":{
15-
"headers":{
16-
"Host":"localhost",
17-
"User-Agent":"curl/7.38.0",
18-
"Accept":"*/*",
19-
"User-Agent":"My sweet little browser",
14+
"request": {
15+
"headers": {
16+
"Host": "localhost",
17+
"User-Agent": "curl/7.38.0",
18+
"Accept": "*/*",
19+
"User-Agent": "My sweet little browser",
2020
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
2121
},
22-
"uri":"/?key=value&key=other_value",
23-
"method":"GET"
22+
"uri": "/?key=value&key=other_value",
23+
"method": "GET",
24+
"body": [
25+
""
26+
]
2427
},
25-
"server":{
26-
"ip":"200.249.12.31",
27-
"port":80
28+
"response": {
29+
"headers": {
30+
31+
},
32+
"body": [
33+
""
34+
]
2835
},
29-
"rules":[
36+
"expected": {
37+
"debug_log": "Skipped rule id 'action-allow.json:3' as request trough the utilization of an `allow' action",
38+
"http_code": 200
39+
},
40+
"rules": [
3041
"SecRuleEngine On",
3142
"SecAction \"phase:1,allow,msg:'ALLOWED',id:500065\"",
3243
"SecAction \"phase:1,deny,msg:'DENIED',id:500066\""
3344
]
3445
},
3546
{
36-
"enabled":1,
37-
"version_min":300000,
38-
"title":"Testing allow action (2/3)",
39-
"expected":{
40-
"debug_log": "",
41-
"http_code": 500
47+
"enabled": 1,
48+
"version_min": 300000,
49+
"title": "Testing allow action (2/3)",
50+
"client": {
51+
"ip": "200.249.12.31",
52+
"port": 123
4253
},
43-
"client":{
44-
"ip":"200.249.12.31",
45-
"port":123
54+
"server": {
55+
"ip": "200.249.12.31",
56+
"port": 80
4657
},
47-
"request":{
48-
"headers":{
49-
"Host":"localhost",
50-
"User-Agent":"curl/7.38.0",
51-
"Accept":"*/*",
52-
"User-Agent":"My sweet little browser",
58+
"request": {
59+
"headers": {
60+
"Host": "localhost",
61+
"User-Agent": "curl/7.38.0",
62+
"Accept": "*/*",
63+
"User-Agent": "My sweet little browser",
5364
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
5465
},
55-
"uri":"/?key=value&key=other_value",
56-
"method":"GET"
66+
"uri": "/?key=value&key=other_value",
67+
"method": "GET",
68+
"body": [
69+
""
70+
]
5771
},
58-
"server":{
59-
"ip":"200.249.12.31",
60-
"port":80
72+
"response": {
73+
"headers": {
74+
75+
},
76+
"body": [
77+
""
78+
]
79+
},
80+
"expected": {
81+
"http_code": 500
6182
},
62-
"rules":[
83+
"rules": [
6384
"SecRuleEngine On",
6485
"SecAction \"phase:1,allow:request,msg:'ALLOWED',id:500065\"",
6586
"SecRule ARGS \"@contains value\" \"id:1,t:trim,status:500,deny,phase:3\""
6687
]
6788
},
6889
{
69-
"enabled":1,
70-
"version_min":300000,
71-
"title":"Testing allow action (3/3)",
72-
"expected":{
73-
"debug_log": "",
74-
"http_code": 500
90+
"enabled": 1,
91+
"version_min": 300000,
92+
"title": "Testing allow action (3/3)",
93+
"client": {
94+
"ip": "200.249.12.31",
95+
"port": 123
7596
},
76-
"client":{
77-
"ip":"200.249.12.31",
78-
"port":123
97+
"server": {
98+
"ip": "200.249.12.31",
99+
"port": 80
79100
},
80-
"request":{
81-
"headers":{
82-
"Host":"localhost",
83-
"User-Agent":"curl/7.38.0",
84-
"Accept":"*/*",
85-
"User-Agent":"My sweet little browser",
101+
"request": {
102+
"headers": {
103+
"Host": "localhost",
104+
"User-Agent": "curl/7.38.0",
105+
"Accept": "*/*",
106+
"User-Agent": "My sweet little browser",
86107
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
87108
},
88-
"uri":"/?key=value&key=other_value",
89-
"method":"GET"
109+
"uri": "/?key=value&key=other_value",
110+
"method": "GET",
111+
"body": [
112+
""
113+
]
90114
},
91-
"server":{
92-
"ip":"200.249.12.31",
93-
"port":80
115+
"response": {
116+
"headers": {
117+
118+
},
119+
"body": [
120+
""
121+
]
122+
},
123+
"expected": {
124+
"http_code": 500
94125
},
95-
"rules":[
126+
"rules": [
96127
"SecRuleEngine On",
97128
"SecAction \"phase:1,allow:phase,msg:'ALLOWED',id:500065\"",
98129
"SecRule ARGS \"@contains value\" \"id:1,t:trim,status:500,deny,phase:3\""

test/test-cases/regression/action-block.json

Lines changed: 63 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,86 @@
11
[
22
{
3-
"enabled":1,
4-
"version_min":300000,
5-
"title":"Testing 'block' action without desruptive action",
6-
"expected":{
7-
"parser_error": "Line: 1. Column: 16. SecDefaultAction must specify a disruptive action."
3+
"enabled": 1,
4+
"version_min": 300000,
5+
"title": "Testing 'block' action without desruptive action",
6+
"client": {
7+
"ip": "200.249.12.31",
8+
"port": 12300
89
},
9-
"client":{
10-
"ip":"200.249.12.31",
11-
"port":12300
10+
"server": {
11+
"ip": "200.249.12.31",
12+
"port": 80
1213
},
13-
"request":{
14-
"headers":{
15-
"Host":"a.b.com",
16-
"User-Agent":"curl/7.38.0",
17-
"Accept":"*/*",
18-
"User-Agent":"My sweet little browser",
14+
"request": {
15+
"headers": {
16+
"Host": "a.b.com",
17+
"User-Agent": "curl/7.38.0",
18+
"Accept": "*/*",
19+
"User-Agent": "My sweet little browser",
1920
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
2021
},
21-
"uri":"/path1",
22-
"method":"GET"
22+
"uri": "/path1",
23+
"method": "GET",
24+
"body": [
25+
""
26+
]
27+
},
28+
"response": {
29+
"headers": {
30+
31+
},
32+
"body": [
33+
""
34+
]
2335
},
24-
"server":{
25-
"ip":"200.249.12.31",
26-
"port":80
36+
"expected": {
37+
"http_code": 200,
38+
"parser_error": "Line: 1. Column: 16. SecDefaultAction must specify a disruptive action."
2739
},
28-
"rules":[
40+
"rules": [
2941
"SecRuleEngine On",
3042
"SecDefaultAction \"phase:1,log,block,status:404\"",
3143
"SecRule REQUEST_URI \"@contains path1\" \"phase:1,block,id:5\""
3244
]
3345
},
3446
{
35-
"enabled":1,
36-
"version_min":300000,
37-
"title":"Testing 'block' action with desruptive action",
38-
"expected":{
39-
"http_code": 400
47+
"enabled": 1,
48+
"version_min": 300000,
49+
"title": "Testing 'block' action with desruptive action",
50+
"client": {
51+
"ip": "200.249.12.31",
52+
"port": 12300
4053
},
41-
"client":{
42-
"ip":"200.249.12.31",
43-
"port":12300
54+
"server": {
55+
"ip": "200.249.12.31",
56+
"port": 80
4457
},
45-
"request":{
46-
"headers":{
47-
"Host":"a.b.com",
48-
"User-Agent":"curl/7.38.0",
49-
"Accept":"*/*",
50-
"User-Agent":"My sweet little browser",
58+
"request": {
59+
"headers": {
60+
"Host": "a.b.com",
61+
"User-Agent": "curl/7.38.0",
62+
"Accept": "*/*",
63+
"User-Agent": "My sweet little browser",
5164
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
5265
},
53-
"uri":"/path1",
54-
"method":"GET"
66+
"uri": "/path1",
67+
"method": "GET",
68+
"body": [
69+
""
70+
]
71+
},
72+
"response": {
73+
"headers": {
74+
75+
},
76+
"body": [
77+
""
78+
]
5579
},
56-
"server":{
57-
"ip":"200.249.12.31",
58-
"port":80
80+
"expected": {
81+
"http_code": 400
5982
},
60-
"rules":[
83+
"rules": [
6184
"SecRuleEngine On",
6285
"SecDefaultAction \"phase:1,log,block,deny,status:400\"",
6386
"SecRule REQUEST_URI \"@contains path1\" \"phase:1,block,id:5\""

test/test-cases/regression/action-ctl_audit_engine.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"request": {
1616
"headers": {
1717
"Host": "www.modsecurity.org",
18-
"User-Agent": "Mozilla\/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko\/20091102 Firefox\/3.5.5 (.NET CLR 3.5.30729)",
19-
"Accept": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8",
18+
"User-Agent": "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)",
19+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
2020
"Accept-Language": "en-us,en;q=0.5",
2121
"Accept-Encoding": "gzip,deflate",
2222
"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.7",
@@ -25,14 +25,23 @@
2525
"Pragma": "no-cache",
2626
"Cache-Control": "no-cache"
2727
},
28-
"uri": "\/test.pl?parm1=test1&parm2=test2",
28+
"uri": "/test.pl?parm1=test1&parm2=test2",
2929
"method": "GET",
3030
"http_version": 1.1,
31-
"body": ""
31+
"body": [
32+
""
33+
]
34+
},
35+
"response": {
36+
"headers": {
37+
38+
},
39+
"body": [
40+
""
41+
]
3242
},
3343
"expected": {
3444
"audit_log": "--A--",
35-
"error_log": "",
3645
"http_code": 200
3746
},
3847
"rules": [

0 commit comments

Comments
 (0)