Skip to content

Commit c8a8c3e

Browse files
committed
Format regression test JSON files
by running the following command: ``` (cd test; ./regression_tests format) ```
1 parent 53143d2 commit c8a8c3e

195 files changed

Lines changed: 23191 additions & 19363 deletions

File tree

Some content is hidden

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

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

Lines changed: 97 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,132 @@
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+
"http_version": ,
25+
"body": [
26+
""
27+
]
2428
},
25-
"server":{
26-
"ip":"200.249.12.31",
27-
"port":80
29+
"response": {
30+
"headers": {
31+
32+
},
33+
"body": [
34+
""
35+
]
2836
},
29-
"rules":[
37+
"expected": {
38+
"debug_log": "Skipped rule id 'action-allow.json:3' as request trough the utilization of an `allow' action",
39+
"http_code": 200
40+
},
41+
"rules": [
3042
"SecRuleEngine On",
3143
"SecAction \"phase:1,allow,msg:'ALLOWED',id:500065\"",
3244
"SecAction \"phase:1,deny,msg:'DENIED',id:500066\""
3345
]
3446
},
3547
{
36-
"enabled":1,
37-
"version_min":300000,
38-
"title":"Testing allow action (2/3)",
39-
"expected":{
40-
"debug_log": "",
41-
"http_code": 500
48+
"enabled": 1,
49+
"version_min": 300000,
50+
"title": "Testing allow action (2/3)",
51+
"client": {
52+
"ip": "200.249.12.31",
53+
"port": 123
4254
},
43-
"client":{
44-
"ip":"200.249.12.31",
45-
"port":123
55+
"server": {
56+
"ip": "200.249.12.31",
57+
"port": 80
4658
},
47-
"request":{
48-
"headers":{
49-
"Host":"localhost",
50-
"User-Agent":"curl/7.38.0",
51-
"Accept":"*/*",
52-
"User-Agent":"My sweet little browser",
59+
"request": {
60+
"headers": {
61+
"Host": "localhost",
62+
"User-Agent": "curl/7.38.0",
63+
"Accept": "*/*",
64+
"User-Agent": "My sweet little browser",
5365
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
5466
},
55-
"uri":"/?key=value&key=other_value",
56-
"method":"GET"
67+
"uri": "/?key=value&key=other_value",
68+
"method": "GET",
69+
"http_version": ,
70+
"body": [
71+
""
72+
]
5773
},
58-
"server":{
59-
"ip":"200.249.12.31",
60-
"port":80
74+
"response": {
75+
"headers": {
76+
77+
},
78+
"body": [
79+
""
80+
]
81+
},
82+
"expected": {
83+
"http_code": 500
6184
},
62-
"rules":[
85+
"rules": [
6386
"SecRuleEngine On",
6487
"SecAction \"phase:1,allow:request,msg:'ALLOWED',id:500065\"",
6588
"SecRule ARGS \"@contains value\" \"id:1,t:trim,status:500,deny,phase:3\""
6689
]
6790
},
6891
{
69-
"enabled":1,
70-
"version_min":300000,
71-
"title":"Testing allow action (3/3)",
72-
"expected":{
73-
"debug_log": "",
74-
"http_code": 500
92+
"enabled": 1,
93+
"version_min": 300000,
94+
"title": "Testing allow action (3/3)",
95+
"client": {
96+
"ip": "200.249.12.31",
97+
"port": 123
7598
},
76-
"client":{
77-
"ip":"200.249.12.31",
78-
"port":123
99+
"server": {
100+
"ip": "200.249.12.31",
101+
"port": 80
79102
},
80-
"request":{
81-
"headers":{
82-
"Host":"localhost",
83-
"User-Agent":"curl/7.38.0",
84-
"Accept":"*/*",
85-
"User-Agent":"My sweet little browser",
103+
"request": {
104+
"headers": {
105+
"Host": "localhost",
106+
"User-Agent": "curl/7.38.0",
107+
"Accept": "*/*",
108+
"User-Agent": "My sweet little browser",
86109
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
87110
},
88-
"uri":"/?key=value&key=other_value",
89-
"method":"GET"
111+
"uri": "/?key=value&key=other_value",
112+
"method": "GET",
113+
"http_version": ,
114+
"body": [
115+
""
116+
]
90117
},
91-
"server":{
92-
"ip":"200.249.12.31",
93-
"port":80
118+
"response": {
119+
"headers": {
120+
121+
},
122+
"body": [
123+
""
124+
]
125+
},
126+
"expected": {
127+
"http_code": 500
94128
},
95-
"rules":[
129+
"rules": [
96130
"SecRuleEngine On",
97131
"SecAction \"phase:1,allow:phase,msg:'ALLOWED',id:500065\"",
98132
"SecRule ARGS \"@contains value\" \"id:1,t:trim,status:500,deny,phase:3\""

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

Lines changed: 65 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,88 @@
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+
"http_version": ,
25+
"body": [
26+
""
27+
]
28+
},
29+
"response": {
30+
"headers": {
31+
32+
},
33+
"body": [
34+
""
35+
]
2336
},
24-
"server":{
25-
"ip":"200.249.12.31",
26-
"port":80
37+
"expected": {
38+
"http_code": 200,
39+
"parser_error": "Line: 1. Column: 16. SecDefaultAction must specify a disruptive action."
2740
},
28-
"rules":[
41+
"rules": [
2942
"SecRuleEngine On",
3043
"SecDefaultAction \"phase:1,log,block,status:404\"",
3144
"SecRule REQUEST_URI \"@contains path1\" \"phase:1,block,id:5\""
3245
]
3346
},
3447
{
35-
"enabled":1,
36-
"version_min":300000,
37-
"title":"Testing 'block' action with desruptive action",
38-
"expected":{
39-
"http_code": 400
48+
"enabled": 1,
49+
"version_min": 300000,
50+
"title": "Testing 'block' action with desruptive action",
51+
"client": {
52+
"ip": "200.249.12.31",
53+
"port": 12300
4054
},
41-
"client":{
42-
"ip":"200.249.12.31",
43-
"port":12300
55+
"server": {
56+
"ip": "200.249.12.31",
57+
"port": 80
4458
},
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",
59+
"request": {
60+
"headers": {
61+
"Host": "a.b.com",
62+
"User-Agent": "curl/7.38.0",
63+
"Accept": "*/*",
64+
"User-Agent": "My sweet little browser",
5165
"Cookie": "PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120"
5266
},
53-
"uri":"/path1",
54-
"method":"GET"
67+
"uri": "/path1",
68+
"method": "GET",
69+
"http_version": ,
70+
"body": [
71+
""
72+
]
73+
},
74+
"response": {
75+
"headers": {
76+
77+
},
78+
"body": [
79+
""
80+
]
5581
},
56-
"server":{
57-
"ip":"200.249.12.31",
58-
"port":80
82+
"expected": {
83+
"http_code": 400
5984
},
60-
"rules":[
85+
"rules": [
6186
"SecRuleEngine On",
6287
"SecDefaultAction \"phase:1,log,block,deny,status:400\"",
6388
"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)