Skip to content

Commit c6788cb

Browse files
committed
Merge branch 'v2/master' into v2/stop_processing_after_reqbody_limit_for_process_partial
2 parents 2681c70 + 7db0379 commit c6788cb

47 files changed

Lines changed: 288 additions & 6013 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
matrix:
12-
os: [ubuntu-22.04]
12+
os: [ubuntu-24.04]
1313
platform: [x32, x64]
1414
compiler: [gcc, clang]
1515
configure:
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup Dependencies
2828
run: |
2929
sudo apt-get update -y -qq
30-
sudo apt-get install -y apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev pkg-config libyajl-dev apache2 apache2-bin apache2-data
30+
sudo apt-get install -y apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev libpcre3-dev libpcre3 pkg-config libyajl-dev apache2 apache2-bin apache2-data
3131
- uses: actions/checkout@v2
3232
- name: autogen.sh
3333
run: ./autogen.sh
@@ -79,7 +79,7 @@ jobs:
7979
runs-on: ${{ matrix.os }}
8080
strategy:
8181
matrix:
82-
os: [ubuntu-22.04]
82+
os: [ubuntu-24.04]
8383
platform: [x32, x64]
8484
compiler: [gcc, clang]
8585
configure:
@@ -97,7 +97,7 @@ jobs:
9797
- name: Setup Dependencies
9898
run: |
9999
sudo apt-get update -y -qq
100-
sudo apt-get install -y --no-install-recommends apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev pkg-config libyajl-dev apache2 apache2-bin apache2-data
100+
sudo apt-get install -y --no-install-recommends apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev libpcre3-dev libpcre3 pkg-config libyajl-dev apache2 apache2-bin apache2-data
101101
- uses: actions/checkout@v2
102102
- name: autogen.sh
103103
run: ./autogen.sh
@@ -110,3 +110,68 @@ jobs:
110110
run: sudo make install
111111
- name: run tests
112112
run: make test
113+
114+
test-regression-linux:
115+
runs-on: ${{ matrix.os }}
116+
strategy:
117+
matrix:
118+
os: [ubuntu-24.04]
119+
platform: [x64]
120+
compiler: [gcc]
121+
configure:
122+
- {label: "with pcre2, with study, with jit", opt: "--enable-pcre-study=yes --enable-pcre-jit" }
123+
steps:
124+
- name: Setup Dependencies
125+
run: |
126+
sudo apt-get update -y -qq
127+
sudo apt-get install -y --no-install-recommends apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev libpcre3-dev libpcre3 pkg-config libyajl-dev apache2 apache2-bin apache2-data perl libwww-perl ssdeep libfuzzy-dev libfuzzy2
128+
- uses: actions/checkout@v2
129+
- name: autogen.sh
130+
run: ./autogen.sh
131+
- name: configure ${{ matrix.configure.label }}
132+
run: ./configure ${{ matrix.configure.opt }} 'CFLAGS=-Werror=format-security'
133+
- uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 #v0.3.0
134+
- name: make
135+
run: make -j `nproc`
136+
- name: install module
137+
run: sudo make install
138+
- name: run regression tests
139+
run: make test-regression
140+
141+
cppcheck:
142+
runs-on: [ubuntu-24.04]
143+
container:
144+
image: debian:sid
145+
steps:
146+
- name: Setup Dependencies
147+
run: |
148+
apt-get update -y -qq
149+
apt-get install -y --no-install-recommends build-essential \
150+
autoconf \
151+
automake \
152+
libtool \
153+
pkg-config \
154+
cppcheck \
155+
apache2-dev \
156+
libpcre2-dev \
157+
libapr1-dev \
158+
libaprutil1-dev \
159+
libxml2-dev \
160+
liblua5.3-dev \
161+
libyajl-dev \
162+
libfuzzy-dev \
163+
ssdeep \
164+
curl \
165+
ca-certificates
166+
- uses: actions/checkout@v4
167+
with:
168+
submodules: false
169+
fetch-depth: 0
170+
- name: configure
171+
run: |
172+
./autogen.sh
173+
./configure --with-apxs=/usr/bin/apxs
174+
- name: cppcheck
175+
run: |
176+
make check-static
177+

Makefile.am

100644100755
Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,28 @@ test: check
3535
test-regression:
3636
(cd tests && $(MAKE) test-regression)
3737

38-
test-regression-nginx:
39-
(cd tests && $(MAKE) test-regression-nginx)
40-
41-
4238
cppcheck:
43-
cppcheck . --enable=all --force 2>&1 | sed 's/^/warning: /g' 1>&2;
39+
@cppcheck \
40+
-j `getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu || echo 1` \
41+
--enable=all \
42+
--force \
43+
--verbose \
44+
--library=gnu \
45+
--library=posix \
46+
--std=c++17 \
47+
-I ./apache2 \
48+
-I /usr/include/libxml2 \
49+
-I @APXS_INCLUDEDIR@ \
50+
-I @APR_INCLUDEDIR@ \
51+
-I @APU_INCLUDEDIR@ \
52+
--suppressions-list=./tests/cppcheck_suppressions.txt \
53+
--inline-suppr \
54+
--inconclusive \
55+
--template="warning: {file},{line},{severity},{id},{message}" \
56+
--error-exitcode=1 \
57+
standalone/
58+
59+
check-static: cppcheck
4460

4561
check-coding-style:
4662
for i in `(find . -iname "*.c" ; find . -iname "*.h")`; \

apache2/mod_security2.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ TreeRoot DSOLOCAL *conn_write_state_whitelist = 0;
9191
TreeRoot DSOLOCAL *conn_write_state_suspicious_list = 0;
9292

9393

94-
#if defined(WIN32) || defined(VERSION_NGINX)
94+
#if defined(WIN32)
9595
int (*modsecDropAction)(request_rec *r) = NULL;
9696
#endif
9797
static int server_limit, thread_limit;
@@ -235,7 +235,7 @@ int perform_interception(modsec_rec *msr) {
235235
break;
236236

237237
case ACTION_PROXY :
238-
#if !(defined(VERSION_IIS)) && !(defined(VERSION_NGINX)) && !(defined(VERSION_STANDALONE))
238+
#if !(defined(VERSION_IIS)) && !(defined(VERSION_STANDALONE))
239239
if (msr->phase < 3) {
240240
if (ap_find_linked_module("mod_proxy.c") == NULL) {
241241
log_level = 1;
@@ -275,7 +275,7 @@ int perform_interception(modsec_rec *msr) {
275275
/* ENH This does not seem to work on Windows. Is there a
276276
* better way to drop a connection anyway?
277277
*/
278-
#if !defined(WIN32) && !defined(VERSION_NGINX)
278+
#if !defined(WIN32)
279279
{
280280
extern module core_module;
281281
apr_socket_t *csd;
@@ -608,10 +608,10 @@ static apr_status_t change_server_signature(server_rec *s) {
608608
char *server_version = NULL;
609609

610610
/* This is a very particular way to handle the server banner. It is Apache
611-
* only. Stanalone and descendants should address that in its specifics
612-
* implementations, e.g. Nginx module.
611+
* only. Standalone and descendants should address that in its specifics
612+
* implementations, e.g. IIS module.
613613
*/
614-
#if !(defined(VERSION_IIS)) && !(defined(VERSION_NGINX)) && !(defined(VERSION_STANDALONE))
614+
#if !(defined(VERSION_IIS)) && !(defined(VERSION_STANDALONE))
615615
if (new_server_signature == NULL) return 0;
616616

617617
server_version = (char *)apache_get_server_version();

apache2/msc_lua.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,12 @@ int lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rul
433433
#else
434434

435435
/* Create new state. */
436-
#if LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 504 || LUA_VERSION_NUM == 501
436+
#if LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 504 || LUA_VERSION_NUM == 505 || LUA_VERSION_NUM == 501
437437
L = luaL_newstate();
438438
#elif LUA_VERSION_NUM == 500
439439
L = lua_open();
440440
#else
441-
#error We are only tested under Lua 5.0, 5.1, 5.2, 5.3, or 5.4.
441+
#error We are only tested under Lua 5.0, 5.1, 5.2, 5.3, 5.4 or 5.5.
442442
#endif
443443
luaL_openlibs(L);
444444

@@ -463,10 +463,10 @@ int lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rul
463463
/* Register functions. */
464464
#if LUA_VERSION_NUM == 500 || LUA_VERSION_NUM == 501
465465
luaL_register(L, "m", mylib);
466-
#elif LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 504
466+
#elif LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 504 || LUA_VERSION_NUM == 505
467467
luaL_setfuncs(L, mylib, 0);
468468
#else
469-
#error We are only tested under Lua 5.0, 5.1, 5.2, 5.3, or 5.4.
469+
#error We are only tested under Lua 5.0, 5.1, 5.2, 5.3, 5.4 or 5.5.
470470
#endif
471471

472472
lua_setglobal(L, "m");

apache2/msc_release.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,14 @@
4949
MODSEC_VERSION_SUFFIX
5050

5151
/* Apache Module Defines */
52-
#ifdef VERSION_IIS
53-
#define MODSEC_MODULE_NAME "ModSecurity for IIS (STABLE)"
52+
#if defined(VERSION_IIS)
53+
#define MODSEC_MODULE_NAME "ModSecurity for IIS (STABLE)"
54+
#elif defined(VERSION_STANDALONE)
55+
#define MODSEC_MODULE_NAME "ModSecurity Standalone (STABLE)"
5456
#else
55-
#ifdef VERSION_NGINX
56-
#define MODSEC_MODULE_NAME "ModSecurity for nginx (STABLE)"
57-
#else
58-
#ifdef VERSION_STANDALONE
59-
#define MODSEC_MODULE_NAME "ModSecurity Standalone (STABLE)"
60-
#else
61-
#define MODSEC_MODULE_NAME "ModSecurity for Apache"
62-
#endif
63-
#endif
57+
#define MODSEC_MODULE_NAME "ModSecurity for Apache"
6458
#endif
59+
6560
#define MODSEC_MODULE_VERSION MODSEC_VERSION
6661
#define MODSEC_MODULE_NAME_FULL MODSEC_MODULE_NAME "/" MODSEC_MODULE_VERSION " (http://www.modsecurity.org/)"
6762

apache2/msc_status_engine.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,6 @@ int DSOLOCAL msc_beacon_string (char *beacon_string, int beacon_string_max_len)
361361
modsec = MODSEC_VERSION;
362362
#ifdef VERSION_IIS
363363
apache = "IIS";
364-
#elif VERSION_NGINX
365-
apache = "nginx";
366364
#else
367365
apache = real_server_signature;
368366
#endif

autogen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ rm -rf autom4te.cache
99
rm -f aclocal.m4
1010
case `uname` in Darwin*) glibtoolize --force --copy ;;
1111
*) libtoolize --force --copy ;; esac
12-
autoreconf --install
12+
autoreconf --install --force
1313
autoheader
1414
automake --add-missing --foreign --copy --force-missing
1515
autoconf --force

configure.ac

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fi
189189
# Standalone Module
190190
AC_ARG_ENABLE(standalone-module,
191191
AS_HELP_STRING([--enable-standalone-module],
192-
[Enable building standalone module.]),
192+
[Enable building standalone module (IIS, test server). Note: NGINX support has been removed.]),
193193
[
194194
if test "$enableval" != "no"; then
195195
build_standalone_module=1
@@ -297,7 +297,6 @@ if test "$build_docs" -eq 1; then
297297
AC_CONFIG_FILES([doc/doxygen-apache])
298298
fi
299299
if test "$build_standalone_module" -eq 1; then
300-
AC_CONFIG_FILES([doc/doxygen-nginx])
301300
AC_CONFIG_FILES([doc/doxygen-iis])
302301
AC_CONFIG_FILES([doc/doxygen-standalone])
303302
fi
@@ -937,7 +936,6 @@ AC_CONFIG_FILES([apache2/Makefile])
937936
fi
938937
if test "$build_standalone_module" -ne 0; then
939938
AC_CONFIG_FILES([standalone/Makefile])
940-
AC_CONFIG_FILES([nginx/modsecurity/config])
941939
fi
942940
if test "$build_extentions" -ne 0; then
943941
AC_CONFIG_FILES([ext/Makefile])

doc/Makefile.am

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ iis:
66
$(DOXYGEN) doxygen-iis
77
touch iis.stamp
88

9-
nginx:
10-
$(DOXYGEN) doxygen-nginx
11-
touch nginx.stamp
129

1310
standalone:
1411
$(DOXYGEN) doxygen-standalone
@@ -20,8 +17,8 @@ all-local: apache
2017
endif
2118

2219
if BUILD_STANDALONE_MODULE
23-
all-local: iis nginx standalone
20+
all-local: iis standalone
2421
endif
2522

2623
clean-local:
27-
rm -rf apache iis nginx standalone
24+
rm -rf apache iis standalone

doc/doxygen-apache.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ PROJECT_NUMBER =
4444
# for a project that appears at the top of each page and should give viewer a
4545
# quick idea about the purpose of the project. Keep the description short.
4646

47-
PROJECT_BRIEF = "ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx that is developed by Trustwave's SpiderLabs. It has a robust event-based programming language which provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis. With over 10,000 deployments world-wide, ModSecurity is the most widely deployed WAF in existence."
47+
PROJECT_BRIEF = "ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache and IIS that is developed by Trustwave's SpiderLabs. It has a robust event-based programming language which provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis. With over 10,000 deployments world-wide, ModSecurity is the most widely deployed WAF in existence."
4848

4949
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
5050
# in the documentation. The maximum height of the logo should not exceed 55

0 commit comments

Comments
 (0)