Skip to content

Commit b9419e3

Browse files
committed
Added support to run regression tests without libxml2
- Annotated regression tests that depend on libxml2 support - Added Windows build without libxml2
1 parent 124a434 commit b9419e3

12 files changed

+1148
-1131
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
- {label: "full", opt: "" }
8585
- {label: "wo lmdb", opt: "-DWITHOUT_LMDB=ON" }
8686
- {label: "wo lua", opt: "-DWITHOUT_LUA=ON" }
87+
- {label: "wo libxml2", opt: "-WITHOUT_LIBXML2=ON" }
8788
- {label: "wo maxmind", opt: "-DWITHOUT_MAXMIND=ON" }
8889
- {label: "wo curl", opt: "-DWITHOUT_CURL=ON" }
8990
steps:

test/regression/regression.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,15 +486,12 @@ int main(int argc, char **argv) {
486486
#if defined(WITH_GEOIP) or defined(WITH_MAXMIND)
487487
resources.push_back("geoip-or-maxmind");
488488
#endif
489-
490489
#if defined(WITH_MAXMIND)
491490
resources.push_back("maxmind");
492491
#endif
493-
494492
#if defined(WITH_GEOIP)
495493
resources.push_back("geoip");
496494
#endif
497-
498495
#ifdef WITH_CURL
499496
resources.push_back("curl");
500497
#endif
@@ -504,6 +501,9 @@ int main(int argc, char **argv) {
504501
#ifdef WITH_LUA
505502
resources.push_back("lua");
506503
#endif
504+
#ifdef WITH_LIBXML2
505+
resources.push_back("libxml2");
506+
#endif
507507

508508
#ifdef NO_LOGS
509509
std::cout << "Test utility cannot work without logging support." \

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
"enabled":1,
44
"version_min":300000,
5+
"resource":"libxml2",
56
"title":"Testing CtlRequestBodyProcessor=XML (1)",
67
"expected":{
78
"debug_log": "Registered XML namespace href \"http://schemas.xmlsoap.org/soap/envelope/\" prefix \"soap\""
@@ -71,6 +72,7 @@
7172
{
7273
"enabled":1,
7374
"version_min":300000,
75+
"resource":"libxml2",
7476
"title":"Testing CtlRequestBodyProcessor=XML (2)",
7577
"expected":{
7678
"debug_log": "Rule returned 0"
@@ -139,6 +141,7 @@
139141
{
140142
"enabled":1,
141143
"version_min":300000,
144+
"resource":"libxml2",
142145
"title":"Testing CtlRequestBodyProcessor=XML (3)",
143146
"expected":{
144147
"debug_log": "XML: Failed parsing document."

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
{
3939
"enabled":1,
4040
"version_min":300000,
41+
"resource":"libxml2",
4142
"title":"Testing XML request body parser (validate ok)",
4243
"expected":{
4344
"debug_log": "Target value: \"39.95\" \\(Variable: XML:\/bookstore\/book\/price\\[text\\(\\)\\]\\)"

test/test-cases/regression/config-body_limits.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@
578578
{
579579
"enabled":1,
580580
"version_min":300000,
581+
"resource":"libxml2",
581582
"title":"SecRequestBodyNoFilesLimit - xml, limit exceeded",
582583
"client":{
583584
"ip":"200.249.12.31",
@@ -626,6 +627,7 @@
626627
{
627628
"enabled":1,
628629
"version_min":300000,
630+
"resource":"libxml2",
629631
"title":"SecRequestBodyNoFilesLimit - xml, limit not exceeded",
630632
"client":{
631633
"ip":"200.249.12.31",

test/test-cases/regression/config-xml_external_entity.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
"enabled":1,
44
"version_min":300000,
5+
"resource":"libxml2",
56
"title":"Testing SecXMLExternalEntity/XXE 1",
67
"expected":{
78
"debug_log": "Target value: \" jo smith\""
@@ -47,6 +48,7 @@
4748
{
4849
"enabled":1,
4950
"version_min":300000,
51+
"resource":"libxml2",
5052
"title":"Testing SecXMLExternalEntity/XXE 2",
5153
"expected":{
5254
"debug_log": "XML: Failed to load DTD: test-cases/data/SoapEnvelope.dtd",
@@ -94,6 +96,7 @@
9496
{
9597
"enabled":1,
9698
"version_min":300000,
99+
"resource":"libxml2",
97100
"title":"Testing SecXMLExternalEntity/XXE 3",
98101
"expected":{
99102
"debug_log": "XML Error: No declaration for element bookstore",

test/test-cases/regression/issue-2423-msg-in-chain.json

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,124 @@
11
[
22
{
3-
"enabled":1,
4-
"version_min":300000,
5-
"title":"Test match variable (1/n)",
3+
"enabled": 0,
4+
"version_min": 300000,
5+
"title": "Test match variable (1/n)",
66
"github_issue": 2423,
7-
"expected":{
8-
"http_code": 437,
9-
"error_log": "against variable `REQUEST_HEADERS:Transfer-Encoding' .Value: `deflate'"
7+
"expected": {
8+
"http_code": 437,
9+
"error_log": "against variable `REQUEST_HEADERS:Transfer-Encoding' .Value: `deflate'"
1010
},
11-
"client":{
12-
"ip":"200.249.12.31",
13-
"port":123
11+
"client": {
12+
"ip": "200.249.12.31",
13+
"port": 123
1414
},
15-
"request":{
16-
"headers":{
17-
"Host":"localhost",
15+
"request": {
16+
"headers": {
17+
"Host": "localhost",
1818
"Transfer-Encoding": "deflate"
1919
},
20-
"uri":"/match-this",
21-
"method":"GET"
20+
"uri": "/match-this",
21+
"method": "GET"
2222
},
23-
"server":{
24-
"ip":"200.249.12.31",
25-
"port":80
23+
"server": {
24+
"ip": "200.249.12.31",
25+
"port": 80
2626
},
27-
"rules":[
27+
"rules": [
2828
"SecRuleEngine On",
2929
"SecRule REQUEST_URI \"^.*$\" \"phase:2,deny,capture,id:1,msg:'MatchedVar On Msg: [%{MATCHED_VAR}]',logdata:'MatchedVar On LogData %{MATCHED_VAR}',chain\"",
3030
"SecRule REQUEST_HEADERS \"^.*$\" \"status:437\""
3131
]
3232
},
3333
{
34-
"enabled":1,
35-
"version_min":300000,
36-
"title":"Test match variable (2/n)",
34+
"enabled": 0,
35+
"version_min": 300000,
36+
"title": "Test match variable (2/n)",
3737
"github_issue": 2423,
38-
"expected":{
39-
"http_code": 437,
40-
"error_log": "MatchedVar On Msg: .deflate."
38+
"expected": {
39+
"http_code": 437,
40+
"error_log": "MatchedVar On Msg: .deflate."
4141
},
42-
"client":{
43-
"ip":"200.249.12.31",
44-
"port":123
42+
"client": {
43+
"ip": "200.249.12.31",
44+
"port": 123
4545
},
46-
"request":{
47-
"headers":{
48-
"Host":"localhost",
46+
"request": {
47+
"headers": {
48+
"Host": "localhost",
4949
"Transfer-Encoding": "deflate"
5050
},
51-
"uri":"/match-this",
52-
"method":"GET"
51+
"uri": "/match-this",
52+
"method": "GET"
5353
},
54-
"server":{
55-
"ip":"200.249.12.31",
56-
"port":80
54+
"server": {
55+
"ip": "200.249.12.31",
56+
"port": 80
5757
},
58-
"rules":[
58+
"rules": [
5959
"SecRuleEngine On",
6060
"SecRule REQUEST_URI \"^.*$\" \"phase:2,deny,capture,id:1,msg:'MatchedVar On Msg: [%{MATCHED_VAR}]',logdata:'MatchedVar On LogData %{MATCHED_VAR}',chain\"",
6161
"SecRule REQUEST_HEADERS \"^.*$\" \"status:437\""
6262
]
6363
},
6464
{
65-
"enabled":1,
66-
"version_min":300000,
67-
"title":"Test match variable (3/n)",
65+
"enabled": 0,
66+
"version_min": 300000,
67+
"title": "Test match variable (3/n)",
6868
"github_issue": 2423,
69-
"expected":{
70-
"http_code": 437,
71-
"error_log": "MatchedVar On LogData: deflate"
69+
"expected": {
70+
"http_code": 437,
71+
"error_log": "MatchedVar On LogData: deflate"
7272
},
73-
"client":{
74-
"ip":"200.249.12.31",
75-
"port":123
73+
"client": {
74+
"ip": "200.249.12.31",
75+
"port": 123
7676
},
77-
"request":{
78-
"headers":{
79-
"Host":"localhost",
77+
"request": {
78+
"headers": {
79+
"Host": "localhost",
8080
"Transfer-Encoding": "deflate"
8181
},
82-
"uri":"/match-this",
83-
"method":"GET"
82+
"uri": "/match-this",
83+
"method": "GET"
8484
},
85-
"server":{
86-
"ip":"200.249.12.31",
87-
"port":80
85+
"server": {
86+
"ip": "200.249.12.31",
87+
"port": 80
8888
},
89-
"rules":[
89+
"rules": [
9090
"SecRuleEngine On",
9191
"SecRule REQUEST_URI \"^.*$\" \"phase:2,deny,capture,id:1,msg:'MatchedVar On Msg: [%{MATCHED_VAR}]',logdata:'MatchedVar On LogData: %{MATCHED_VAR}',chain\"",
9292
"SecRule REQUEST_HEADERS \"^.*$\" \"status:437\""
9393
]
9494
},
9595
{
96-
"enabled":1,
97-
"version_min":300000,
98-
"title":"Test match variable (4/n)",
96+
"enabled": 1,
97+
"version_min": 300000,
98+
"title": "Test match variable (4/n)",
9999
"github_issue": 2423,
100-
"expected":{
101-
"http_code": 437,
102-
"error_log": "msg \"Illegal header \\[/restricted/\\]\""
103-
},
104-
"client":{
105-
"ip":"200.249.12.31",
106-
"port":123
107-
},
108-
"request":{
109-
"headers":{
110-
"Host":"localhost",
111-
"Restricted":"attack",
112-
"Other": "Value"
100+
"expected": {
101+
"http_code": 437,
102+
"error_log": "msg \"Illegal header \\[/restricted/\\]\""
103+
},
104+
"client": {
105+
"ip": "200.249.12.31",
106+
"port": 123
107+
},
108+
"request": {
109+
"headers": {
110+
"Host": "localhost",
111+
"Restricted": "attack",
112+
"Other": "Value"
113113
},
114-
"uri":"/",
115-
"method":"GET"
114+
"uri": "/",
115+
"method": "GET"
116116
},
117-
"server":{
118-
"ip":"200.249.12.31",
119-
"port":80
117+
"server": {
118+
"ip": "200.249.12.31",
119+
"port": 80
120120
},
121-
"rules":[
121+
"rules": [
122122
"SecRuleEngine On",
123123
"SecRule REQUEST_HEADERS_NAMES \"^.*$\" \"phase:2,setvar:'tx.header_name_%{TX.0}=/%{TX.0}/',deny,t:lowercase,capture,id:500065,msg:'Illegal header [%{MATCHED_VAR}]',logdata:'Restricted header detected: %{MATCHED_VAR}',chain\"",
124124
"SecRule TX:/^header_name_/ \"@within /name1/restricted/name3/\" \"status:437\""

0 commit comments

Comments
 (0)