Skip to content

Commit 8280175

Browse files
authored
Merge branch 'v3/master' into v3/sonarmemleakfix
2 parents cdb6b83 + f04dcc0 commit 8280175

File tree

123 files changed

+1966
-5859
lines changed

Some content is hidden

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

123 files changed

+1966
-5859
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- Thank you for contributing to OWASP ModSecurity, your effort is greatly appreciated -->
2+
<!-- Please help us by adding the information below in this PR so it aids reviewers -->
3+
4+
## what
5+
6+
<!--
7+
- Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
8+
- Use bullet points to be concise and to the point.
9+
-->
10+
11+
## why
12+
13+
<!--
14+
- Provide the justifications for the changes (e.g. business case).
15+
- Describe why these changes were made (e.g. why do these commits fix the problem?)
16+
- Use bullet points to be concise and to the point.
17+
-->
18+
19+
## references
20+
21+
<!--
22+
- Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow).
23+
- Use `closes #123`, if this PR closes a GitHub issue `#123`
24+
-->

.github/workflows/ci.yml

Lines changed: 144 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,69 +6,190 @@ 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: "--enable-assertions=yes"}
16+
- {label: "x32", arch: "i386", configure: "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 --enable-assertions=yes"}
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
62+
fetch-depth: 0
3263
- name: build.sh
3364
run: ./build.sh
34-
- name: configure ${{ matrix.configure.label }}
35-
run: ./configure ${{ matrix.configure.opt }}
65+
- name: configure
66+
env:
67+
CC: ${{ matrix.compiler.cc }}
68+
CXX: ${{ matrix.compiler.cxx }}
69+
run: ./configure ${{ matrix.platform.configure }} ${{ matrix.configure.opt }}
3670
- uses: ammaraskar/gcc-problem-matcher@master
3771
- name: make
3872
run: make -j `nproc`
3973
- name: check
4074
run: make check
41-
- name: check-static
42-
run: make check-static
4375

4476
build-macos:
77+
name: macOS (${{ matrix.configure.label }})
4578
runs-on: ${{ matrix.os }}
4679
strategy:
4780
matrix:
4881
os: [macos-12]
49-
compiler: [clang]
5082
configure:
5183
- {label: "with parser generation", opt: "--enable-parser-generation" }
5284
- {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" }
5785
- {label: "wo lua", opt: "--without-lua" }
5886
- {label: "wo maxmind", opt: "--without-maxmind" }
87+
- {label: "wo libxml", opt: "--without-libxml" }
88+
- {label: "wo geoip", opt: "--without-geoip" }
89+
- {label: "wo ssdeep", opt: "--without-ssdeep" }
90+
- {label: "with lmdb", opt: "--with-lmdb" }
91+
- {label: "with pcre2", opt: "--with-pcre2" }
5992
steps:
6093
- name: Setup Dependencies
94+
# autoconf, curl, pcre2 not installed because they're already
95+
# included in the image
6196
run: |
62-
brew install autoconf automake cppcheck lmdb libyaml lua ssdeep libmaxminddb bison
63-
- uses: actions/checkout@v2
97+
brew install automake \
98+
yajl \
99+
lmdb \
100+
lua \
101+
libmaxminddb \
102+
libxml2 \
103+
geoip \
104+
ssdeep \
105+
pcre \
106+
bison \
107+
flex
108+
- uses: actions/checkout@v4
64109
with:
65110
submodules: true
111+
fetch-depth: 0
66112
- name: build.sh
67113
run: ./build.sh
68-
- name: configure ${{ matrix.configure.label }}
69-
run: ./configure ${{ matrix.configure.opt }}
114+
- name: configure
115+
run: ./configure ${{ matrix.configure.opt }} --enable-assertions=yes
70116
- uses: ammaraskar/gcc-problem-matcher@master
71117
- name: make
72118
run: make -j `sysctl -n hw.logicalcpu`
73119
- name: check
74120
run: make check
121+
122+
build-windows:
123+
name: Windows (${{ matrix.platform.label }}, ${{ matrix.configure.label }})
124+
runs-on: ${{ matrix.os }}
125+
strategy:
126+
matrix:
127+
os: [windows-2022]
128+
platform:
129+
- {label: "x64", arch: "x86_64"}
130+
configuration: [Release]
131+
configure:
132+
- {label: "full", opt: "" }
133+
- {label: "wo curl", opt: "-DWITHOUT_CURL=ON" }
134+
- {label: "wo lmdb", opt: "-DWITHOUT_LMDB=ON" }
135+
- {label: "wo lua", opt: "-DWITHOUT_LUA=ON" }
136+
- {label: "wo maxmind", opt: "-DWITHOUT_MAXMIND=ON" }
137+
- {label: "wo libxml", opt: "-WITHOUT_LIBXML2=ON" }
138+
steps:
139+
- uses: actions/checkout@v4
140+
with:
141+
submodules: true
142+
fetch-depth: 0
143+
- name: Install Conan
144+
run: |
145+
pip3 install conan --upgrade
146+
conan profile detect
147+
- uses: ammaraskar/msvc-problem-matcher@master
148+
- name: Build ${{ matrix.configuration }} ${{ matrix.platform.arch }} ${{ matrix.configure.label }}
149+
shell: cmd
150+
run: vcbuild.bat ${{ matrix.configuration }} ${{ matrix.platform.arch }} NO_ASAN "${{ matrix.configure.opt }}"
151+
- name: Set up test environment
152+
working-directory: build\win32\build\${{ matrix.configuration }}
153+
env:
154+
BASE_DIR: ..\..\..\..
155+
shell: cmd
156+
run: |
157+
copy unit_tests.exe %BASE_DIR%\test
158+
copy regression_tests.exe %BASE_DIR%\test
159+
copy libModSecurity.dll %BASE_DIR%\test
160+
copy %BASE_DIR%\unicode.mapping %BASE_DIR%\test
161+
md \tmp
162+
md \bin
163+
copy "C:\Program Files\Git\usr\bin\echo.exe" \bin
164+
copy "C:\Program Files\Git\usr\bin\echo.exe" \bin\echo
165+
- name: Disable tests that don't work on Windows
166+
working-directory: test\test-cases\regression
167+
shell: cmd
168+
run: |
169+
jq "map(if .title == \"Test match variable (1/n)\" then .enabled = 0 else . end)" issue-2423-msg-in-chain.json > tmp.json && move /Y tmp.json issue-2423-msg-in-chain.json
170+
jq "map(if .title == \"Test match variable (2/n)\" then .enabled = 0 else . end)" issue-2423-msg-in-chain.json > tmp.json && move /Y tmp.json issue-2423-msg-in-chain.json
171+
jq "map(if .title == \"Test match variable (3/n)\" then .enabled = 0 else . end)" issue-2423-msg-in-chain.json > tmp.json && move /Y tmp.json issue-2423-msg-in-chain.json
172+
jq "map(if .title == \"Variable offset - FILES_NAMES\" then .enabled = 0 else . end)" offset-variable.json > tmp.json && move /Y tmp.json offset-variable.json
173+
- name: Run tests
174+
working-directory: build\win32\build
175+
run: |
176+
ctest -C ${{ matrix.configuration }} --output-on-failure
177+
178+
cppcheck:
179+
runs-on: [ubuntu-22.04]
180+
steps:
181+
- name: Setup Dependencies
182+
run: |
183+
sudo apt-get update -y -qq
184+
sudo apt-get install -y cppcheck
185+
- name: Checkout source
186+
uses: actions/checkout@v4
187+
with:
188+
submodules: true
189+
fetch-depth: 0
190+
- name: Configure libModSecurity
191+
run: |
192+
./build.sh
193+
./configure
194+
- name: Run cppcheck on libModSecurity
195+
run: make check-static

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ build/ltoptions.m4
1111
build/ltsugar.m4
1212
build/ltversion.m4
1313
build/lt~obsolete.m4
14+
build/win32/build
15+
build/win32/CMakeUserPresets.json
1416
compile
1517
config.guess
1618
config.log
1719
config.status
1820
config.sub
21+
config.h.in~
1922
configure
23+
configure~
2024
depcomp
25+
modsecurity.pc
2126
.deps
2227
.libs
2328
.dirstamp

.gitmodules

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
[submodule "test/test-cases/secrules-language-tests"]
22
path = test/test-cases/secrules-language-tests
3-
url = https://github.com/SpiderLabs/secrules-language-tests
3+
url = https://github.com/owasp-modsecurity/secrules-language-tests
44
[submodule "others/libinjection"]
55
path = others/libinjection
66
url = https://github.com/libinjection/libinjection.git
77
[submodule "bindings/python"]
88
path = bindings/python
9-
url = https://github.com/SpiderLabs/ModSecurity-Python-bindings.git
9+
url = https://github.com/owasp-modsecurity/ModSecurity-Python-bindings.git
10+
[submodule "others/mbedtls"]
11+
path = others/mbedtls
12+
url = https://github.com/Mbed-TLS/mbedtls.git

0 commit comments

Comments
 (0)