Skip to content

Commit 37776fd

Browse files
authored
Merge pull request #3144 from eduar-hte/gh-workflow-updates
GitHub build & quality assurance workflow updates
2 parents 124a434 + d9255d8 commit 37776fd

10 files changed

+114
-29
lines changed

.github/workflows/ci.yml

+91-26
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,110 @@ on:
66

77
jobs:
88
build-linux:
9+
name: Linux (${{ matrix.platform.label }}, ${{ matrix.compiler.label }}, ${{ matrix.configure.label }})
910
runs-on: ${{ matrix.os }}
1011
strategy:
1112
matrix:
1213
os: [ubuntu-22.04]
13-
platform: [x32, x64]
14-
compiler: [gcc, clang]
14+
platform:
15+
- {label: "x64", arch: "amd64", configure: ""}
16+
- {label: "x32", arch: "i386", configure: "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32"}
17+
compiler:
18+
- {label: "gcc", cc: "gcc", cxx: "g++"}
19+
- {label: "clang", cc: "clang", cxx: "clang++"}
1520
configure:
1621
- {label: "with parser generation", opt: "--enable-parser-generation" }
1722
- {label: "wo curl", opt: "--without-curl" }
18-
- {label: "wo yajl", opt: "--without-yajl" }
19-
- {label: "wo geoip", opt: "--without-geoip" }
20-
- {label: "wo lmdb", opt: "--without-lmdb" }
21-
- {label: "with pcre2", opt: "--with-pcre2" }
2223
- {label: "wo lua", opt: "--without-lua" }
23-
- {label: "without maxmind", opt: "--without-maxmind" }
24+
- {label: "wo maxmind", opt: "--without-maxmind" }
25+
- {label: "wo libxml", opt: "--without-libxml" }
26+
- {label: "wo geoip", opt: "--without-geoip" }
27+
- {label: "wo ssdeep", opt: "--without-ssdeep" }
28+
- {label: "with lmdb", opt: "--with-lmdb" }
29+
- {label: "with pcre2", opt: "--with-pcre2" }
30+
exclude:
31+
- platform: {label: "x32"}
32+
configure: {label: "wo geoip"}
33+
- platform: {label: "x32"}
34+
configure: {label: "wo ssdeep"}
2435
steps:
25-
- name: Setup Dependencies
36+
- name: Setup Dependencies (common)
2637
run: |
38+
sudo dpkg --add-architecture ${{ matrix.platform.arch }}
2739
sudo apt-get update -y -qq
28-
sudo apt-get install -y libfuzzy-dev libyajl-dev libgeoip-dev liblua5.2-dev liblmdb-dev cppcheck libmaxminddb-dev libcurl4-openssl-dev libpcre2-dev pcre2-utils
29-
- uses: actions/checkout@v2
40+
sudo apt-get install -y libyajl-dev:${{ matrix.platform.arch }} \
41+
libcurl4-openssl-dev:${{ matrix.platform.arch }} \
42+
liblmdb-dev:${{ matrix.platform.arch }} \
43+
liblua5.2-dev:${{ matrix.platform.arch }} \
44+
libmaxminddb-dev:${{ matrix.platform.arch }} \
45+
libpcre2-dev:${{ matrix.platform.arch }} \
46+
pcre2-utils:${{ matrix.platform.arch }} \
47+
bison flex
48+
- name: Setup Dependencies (x32)
49+
if: ${{ matrix.platform.label == 'x32' }}
50+
run: |
51+
sudo apt-get install g++-multilib
52+
sudo apt-get install -y libxml2-dev:${{ matrix.platform.arch }} \
53+
libpcre3-dev:${{ matrix.platform.arch }}
54+
- name: Setup Dependencies (x64)
55+
if: ${{ matrix.platform.label == 'x64' }}
56+
run: |
57+
sudo apt-get install -y libgeoip-dev:${{ matrix.platform.arch }} \
58+
libfuzzy-dev:${{ matrix.platform.arch }}
59+
- uses: actions/checkout@v4
3060
with:
3161
submodules: true
3262
- name: build.sh
3363
run: ./build.sh
34-
- name: configure ${{ matrix.configure.label }}
35-
run: ./configure ${{ matrix.configure.opt }}
64+
- name: configure
65+
env:
66+
CC: ${{ matrix.compiler.cc }}
67+
CXX: ${{ matrix.compiler.cxx }}
68+
run: ./configure ${{ matrix.platform.configure }} ${{ matrix.configure.opt }}
3669
- uses: ammaraskar/gcc-problem-matcher@master
3770
- name: make
3871
run: make -j `nproc`
3972
- name: check
4073
run: make check
41-
- name: check-static
42-
run: make check-static
4374

4475
build-macos:
76+
name: macOS (${{ matrix.configure.label }})
4577
runs-on: ${{ matrix.os }}
4678
strategy:
4779
matrix:
4880
os: [macos-12]
49-
compiler: [clang]
5081
configure:
5182
- {label: "with parser generation", opt: "--enable-parser-generation" }
5283
- {label: "wo curl", opt: "--without-curl" }
53-
- {label: "wo yajl", opt: "--without-yajl" }
54-
- {label: "wo geoip", opt: "--without-geoip" }
55-
- {label: "wo lmdb", opt: "--without-lmdb" }
56-
- {label: "wo ssdeep", opt: "--without-ssdeep" }
5784
- {label: "wo lua", opt: "--without-lua" }
5885
- {label: "wo maxmind", opt: "--without-maxmind" }
86+
- {label: "wo libxml", opt: "--without-libxml" }
87+
- {label: "wo geoip", opt: "--without-geoip" }
88+
- {label: "wo ssdeep", opt: "--without-ssdeep" }
89+
- {label: "with lmdb", opt: "--with-lmdb" }
90+
- {label: "with pcre2", opt: "--with-pcre2" }
5991
steps:
6092
- name: Setup Dependencies
93+
# autoconf, curl, pcre2 not installed because they're already
94+
# included in the image
6195
run: |
62-
brew install autoconf automake cppcheck lmdb libyaml lua ssdeep libmaxminddb bison
63-
- uses: actions/checkout@v2
96+
brew install automake \
97+
yajl \
98+
lmdb \
99+
lua \
100+
libmaxminddb \
101+
libxml2 \
102+
geoip \
103+
ssdeep \
104+
pcre \
105+
bison \
106+
flex
107+
- uses: actions/checkout@v4
64108
with:
65109
submodules: true
66110
- name: build.sh
67111
run: ./build.sh
68-
- name: configure ${{ matrix.configure.label }}
112+
- name: configure
69113
run: ./configure ${{ matrix.configure.opt }}
70114
- uses: ammaraskar/gcc-problem-matcher@master
71115
- name: make
@@ -74,18 +118,21 @@ jobs:
74118
run: make check
75119

76120
build-windows:
121+
name: Windows (${{ matrix.platform.label }}, ${{ matrix.configure.label }})
77122
runs-on: ${{ matrix.os }}
78123
strategy:
79124
matrix:
80125
os: [windows-2022]
81-
platform: [x86_64]
126+
platform:
127+
- {label: "x64", arch: "x86_64"}
82128
configuration: [Release]
83129
configure:
84130
- {label: "full", opt: "" }
131+
- {label: "wo curl", opt: "-DWITHOUT_CURL=ON" }
85132
- {label: "wo lmdb", opt: "-DWITHOUT_LMDB=ON" }
86133
- {label: "wo lua", opt: "-DWITHOUT_LUA=ON" }
87134
- {label: "wo maxmind", opt: "-DWITHOUT_MAXMIND=ON" }
88-
- {label: "wo curl", opt: "-DWITHOUT_CURL=ON" }
135+
- {label: "wo libxml", opt: "-WITHOUT_LIBXML2=ON" }
89136
steps:
90137
- uses: actions/checkout@v4
91138
with:
@@ -95,9 +142,9 @@ jobs:
95142
pip3 install conan --upgrade
96143
conan profile detect
97144
- uses: ammaraskar/msvc-problem-matcher@master
98-
- name: Build ${{ matrix.configuration }} ${{ matrix.platform }} ${{ matrix.configure.label }}
145+
- name: Build ${{ matrix.configuration }} ${{ matrix.platform.arch }} ${{ matrix.configure.label }}
99146
shell: cmd
100-
run: vcbuild.bat ${{ matrix.configuration }} ${{ matrix.platform }} NO_ASAN "${{ matrix.configure.opt }}"
147+
run: vcbuild.bat ${{ matrix.configuration }} ${{ matrix.platform.arch }} NO_ASAN "${{ matrix.configure.opt }}"
101148
- name: Set up test environment
102149
working-directory: build\win32\build\${{ matrix.configuration }}
103150
env:
@@ -124,3 +171,21 @@ jobs:
124171
working-directory: build\win32\build
125172
run: |
126173
ctest -C ${{ matrix.configuration }} --output-on-failure
174+
175+
cppcheck:
176+
runs-on: [ubuntu-22.04]
177+
steps:
178+
- name: Setup Dependencies
179+
run: |
180+
sudo apt-get update -y -qq
181+
sudo apt-get install -y cppcheck
182+
- name: Get libModSecurity v3 source
183+
uses: actions/checkout@v4
184+
with:
185+
submodules: true
186+
- name: Configure libModSecurity
187+
run: |
188+
./build.sh
189+
./configure
190+
- name: Run cppcheck on libModSecurity
191+
run: make check-static

test/regression/regression.cc

+3-3
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

+3
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

+1
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

+2
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

+3
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/request-body-parser-xml-validade-dtd.json

+4
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 XML request body parser - validateDTD (validate ok)",
67
"expected":{
78
"debug_log": "XML: Successfully validated payload against DTD: test-cases/data/SoapEnvelope.dtd"
@@ -47,6 +48,7 @@
4748
{
4849
"enabled":1,
4950
"version_min":300000,
51+
"resource":"libxml2",
5052
"title":"Testing XML request body parser - validateDTD (validation failed)",
5153
"expected":{
5254
"debug_log": "XML Error: No declaration for element xBody",
@@ -93,6 +95,7 @@
9395
{
9496
"enabled":1,
9597
"version_min":300000,
98+
"resource":"libxml2",
9699
"title":"Testing XML request body parser - validateDTD (bad XML)",
97100
"expected":{
98101
"debug_log": "XML: DTD validation failed because content is not well formed",
@@ -139,6 +142,7 @@
139142
{
140143
"enabled":1,
141144
"version_min":300000,
145+
"resource":"libxml2",
142146
"title":"Testing XML request body parser - validateDTD (bad DTD)",
143147
"expected":{
144148
"debug_log": "Failed to load DTD: test-cases/data/SoapEnvelope-bad.dtd",

test/test-cases/regression/request-body-parser-xml.json

+5
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 XML request body parser (validate ok)",
67
"expected":{
78
"debug_log": "XML: Successfully validated payload against Schema:"
@@ -51,6 +52,7 @@
5152
{
5253
"enabled":1,
5354
"version_min":300000,
55+
"resource":"libxml2",
5456
"title":"Testing XML request body parser (validate attribute value failed)",
5557
"expected":{
5658
"debug_log": "'badval' is not a valid value of the local atomic type",
@@ -101,6 +103,7 @@
101103
{
102104
"enabled":1,
103105
"version_min":300000,
106+
"resource":"libxml2",
104107
"title":"Testing XML request body parser (validate failed)",
105108
"expected":{
106109
"debug_log": "This element is not expected. Expected is one of",
@@ -151,6 +154,7 @@
151154
{
152155
"enabled":1,
153156
"version_min":300000,
157+
"resource":"libxml2",
154158
"title":"Testing XML request body parser (bad XML)",
155159
"expected":{
156160
"debug_log": "XML Error: Element '{http://schemas.xmlsoap.org/soap/envelope/}xBody'",
@@ -201,6 +205,7 @@
201205
{
202206
"enabled":1,
203207
"version_min":300000,
208+
"resource":"libxml2",
204209
"title":"Testing XML request body parser (bad schema)",
205210
"expected":{
206211
"debug_log": "XML: Failed to load Schema: test-cases/data/SoapEnvelope-bad.xsd. XML Error: Failed to parse the XML resource 'test-cases/data/SoapEnvelope-bad.xsd",

test/test-cases/regression/variable-REQBODY_PROCESSOR_ERROR.json

+1
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 Variables :: REQBODY_PROCESSOR_ERROR_MSG (1/2)",
67
"client":{
78
"ip":"200.249.12.31",

test/test-cases/regression/variable-XML.json

+1
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 XPath expression with equals sign",
67
"expected":{
78
"http_code": 403

0 commit comments

Comments
 (0)