Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
97eab11
Add remaining phase4 parser/logging/regression test cases
Easton97-Jens May 3, 2026
25aa9e9
Merge remote-tracking branch 'origin/master' into work
Easton97-Jens May 4, 2026
88d0339
Fix phase4 build issues and raw rule/status logging order
Easton97-Jens May 4, 2026
4d1bb87
Fix phase4 event logging paths and JSON output correctness
Easton97-Jens May 5, 2026
6962d42
Fix phase4 log sanitization, deterministic reasons, and proxy phase4 …
Easton97-Jens May 5, 2026
3e35548
Fix phase4 C-level string safety issues
Easton97-Jens May 5, 2026
440ee43
Merge pull request #6 from Easton97-Jens/codex/implement-phase-4-inte…
Easton97-Jens May 5, 2026
e2ede45
docs: add bilingual phase4 handling and config examples
Easton97-Jens May 6, 2026
2e2c792
Fix json escape alloc safety and phase4 modes log-line assertions
Easton97-Jens May 6, 2026
d73f9ea
Fix phase4-modes test plan count mismatch
Easton97-Jens May 6, 2026
a7bb6e4
docs: expand phase4 guidance and generalize production examples
Easton97-Jens May 6, 2026
4775f32
Fix phase4-modes JSON line assertion for CRLF log lines
Easton97-Jens May 6, 2026
1f37b84
Add diagnostics for failing phase4 modes JSON-line assertion
Easton97-Jens May 6, 2026
0e8720e
Fix MSVC pointer type warning in ngx_file_info call
Easton97-Jens May 7, 2026
be7d24b
Merge pull request #7 from Easton97-Jens/codex/review-nginx-test-conf…
Easton97-Jens May 11, 2026
5c39034
Merge pull request #9 from Easton97-Jens/codex/fix-remaining-issues-i…
Easton97-Jens May 11, 2026
2a31a5b
Refactor phase4 code to address Sonar maintainability issues
Easton97-Jens May 13, 2026
0d3ad62
Flatten processed-chain branch in body filter
Easton97-Jens May 13, 2026
d1b375c
Merge pull request #10 from Easton97-Jens/codex/fix-sonarqube-maintai…
Easton97-Jens May 13, 2026
06f99af
Fix remaining SonarQube issues in body filter
Easton97-Jens May 13, 2026
e35b7fa
Merge pull request #11 from Easton97-Jens/codex/fix-sonarqube-issues-…
Easton97-Jens May 13, 2026
505d4af
Address Copilot review feedback for phase4 handling
Easton97-Jens May 14, 2026
cfc7e22
Fix sanity-check redeclaration and narrow phase4 log capture
Easton97-Jens May 14, 2026
0051975
Rewrite phase4 invalid-config test to use nginx -t output
Easton97-Jens May 14, 2026
329f269
Use repository Test::Nginx harness in phase4 invalid-config test
Easton97-Jens May 14, 2026
8b766e4
Stabilize phase4 invalid-config test nginx -t setup
Easton97-Jens May 14, 2026
beb3e87
Merge pull request #12 from Easton97-Jens/codex/fetch-and-evaluate-co…
Easton97-Jens May 14, 2026
20d7aca
docs: document phase4 nginx directives in README
Easton97-Jens May 14, 2026
3d72b00
Merge pull request #13 from Easton97-Jens/codex/update-readme.md-with…
Easton97-Jens May 14, 2026
6f3dd0f
Port current connector Phase 4 behavior to NGINX (#14)
Easton97-Jens Oct 3, 2026
0941cc2
Merge upstream master and simplify intervention handling
Easton97-Jens Oct 3, 2026
addf2cb
Delegate phase-4 response inspection limits to libModSecurity
Easton97-Jens Oct 7, 2026
acb72df
Update Windows runner version in workflow
Easton97-Jens Oct 8, 2026
d53c9ea
Update test.yml
Easton97-Jens Oct 8, 2026
a4a420b
Enhance CI workflow with new OS and Nginx versions
Easton97-Jens Oct 8, 2026
73cdb3b
fix: correct phase4 event status type and README directive count
Easton97-Jens Oct 8, 2026
828742d
docs: preserve README final blank line
Easton97-Jens Oct 8, 2026
58dd4ee
docs: document phase4 changes and keep English documentation
Easton97-Jens Oct 8, 2026
85604d5
fix: move phase4 helper CI and use locale-independent log normalization
Easton97-Jens Oct 8, 2026
ba8361b
docs: expand phase4 changelog
Easton97-Jens Oct 8, 2026
468ebd2
docs: clarify safe mode logging failures
Easton97-Jens Oct 8, 2026
f2afc7d
Merge upstream master and preserve phase4 workflow placement
Easton97-Jens Oct 28, 2026
96bd3f7
Port native intervention and lifecycle fixes from connector
Easton97-Jens Oct 28, 2026
776de3a
Refactor intervention initialization for Sonar complexity
Easton97-Jens Oct 28, 2026
661acf2
Merge upstream master documentation and preserve phase4 directives
Easton97-Jens Nov 14, 2026
1669077
Port connector review fixes for audit, Safe delivery and native limits
Easton97-Jens Nov 14, 2026
f9a3ef0
Refine parser structure and preserve native test boundaries
Easton97-Jens Nov 14, 2026
688cfbd
Fix queued HTTP/2 resets with versioned NGINX host patch
Easton97-Jens Nov 15, 2026
be318c4
Finalize HTTP/2 regression harness before TAP completion
Easton97-Jens Nov 15, 2026
7a5a336
Use official zlib release asset for Windows native builds
Easton97-Jens Nov 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.github/scripts/apply-nginx-http2-patch.sh text eol=lf
/patches/*.patch text eol=lf
48 changes: 48 additions & 0 deletions .github/scripts/apply-nginx-http2-patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh

# Apply the versioned host correction before configuring/building NGINX.
# The connector itself does not own NGINX's physical HTTP/2 connection events.
set -eu

if [ "$#" -ne 1 ]; then
echo "Usage: $0 /path/to/nginx/source" >&2
exit 2
fi

script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
patch_file="$script_dir/../../patches/nginx-http2-close-stream-flush.patch"
nginx_dir=$(CDPATH= cd -- "$1" && pwd)

if [ ! -f "$nginx_dir/src/http/v2/ngx_http_v2.c" ]; then
echo "NGINX HTTP/2 source is missing in $nginx_dir" >&2
exit 1
fi

if ! command -v patch >/dev/null 2>&1; then
echo "The patch utility is required to apply the NGINX HTTP/2 fix" >&2
exit 1
fi

# Match the source checkout's line endings without rewriting NGINX before the
# dry run. Windows checkouts may use CRLF even when this patch is stored as LF.
patch_input=$(mktemp "${TMPDIR:-/tmp}/modsecurity-nginx-h2-patch.XXXXXX")
trap 'rm -f "$patch_input"' 0 HUP INT TERM
cr=$(printf '\r')
if LC_ALL=C grep -qU "${cr}$" "$nginx_dir/src/http/v2/ngx_http_v2.c"; then
sed "s/${cr}\{0,1\}$/${cr}/" "$patch_file" > "$patch_input"
else
sed "s/${cr}$//" "$patch_file" > "$patch_input"
fi

if patch --binary --dry-run --batch --forward --fuzz=0 -p1 -d "$nginx_dir" \
-i "$patch_input" >/dev/null 2>&1; then
patch --binary --batch --forward --fuzz=0 --no-backup-if-mismatch -p1 \
-d "$nginx_dir" -i "$patch_input"
echo "Applied NGINX HTTP/2 close-stream reset flush fix"
elif patch --binary --dry-run --batch --reverse --fuzz=0 -p1 -d "$nginx_dir" \
-i "$patch_input" >/dev/null 2>&1; then
echo "NGINX HTTP/2 close-stream reset flush fix is already applied"
else
echo "NGINX HTTP/2 source does not match the versioned fix; review it before building" >&2
exit 1
fi
151 changes: 4 additions & 147 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |
sudo dpkg --add-architecture i386
sudo apt-get update -y -qq
sudo apt-get install -y make autoconf automake make libyajl-dev libxml2-dev libmaxminddb-dev libcurl4-gnutls-dev $COMPDEPS
sudo apt-get install -y patch make autoconf automake make libyajl-dev libxml2-dev libmaxminddb-dev libcurl4-gnutls-dev $COMPDEPS
- name: Get libModSecurity source
uses: actions/checkout@v4
with:
Expand All @@ -50,6 +50,8 @@ jobs:
repository: nginx/nginx
path: nginx
fetch-depth: 1
- name: Apply NGINX HTTP/2 reset delivery fix
run: sh ModSecurity-nginx/.github/scripts/apply-nginx-http2-patch.sh nginx
- name: Get Nginx tests
uses: actions/checkout@v4
with:
Expand All @@ -58,7 +60,7 @@ jobs:
fetch-depth: 1
- name: Copy ModSecurity-nginx tests to nginx/test
run: |
cp ModSecurity-nginx/tests/* nginx/test
cp ModSecurity-nginx/tests/*.t ModSecurity-nginx/tests/*.pl nginx/test
- name: Build nginx with ModSecurity-nginx module
working-directory: nginx
run: |
Expand Down Expand Up @@ -234,148 +236,3 @@ jobs:
echo "FAIL"
exit 1
fi


build-windows:
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Set up msys
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
path-type: inherit
- name: Get Nginx source
uses: actions/checkout@v4
with:
repository: nginx/nginx
path: nginx
fetch-depth: 1
- name: Get Nginx tests
uses: actions/checkout@v4
with:
repository: nginx/nginx-tests
path: nginx/test
fetch-depth: 1
- name: Set up third-party libraries
working-directory: nginx
run: |
mkdir objs
mkdir objs/lib
cd objs/lib
# Download to a file before extracting, rather than piping straight
# into tar: a retried download restarts from byte 0, which a pipe
# that tar already consumed can't rewind. The retry loop is at the
# shell level (one wget attempt per iteration, partial file removed
# in between) because wget's own --tries neither retries HTTP 5xx /
# DNS failures nor rewrites a partial -O file: it sends a Range
# request and appends, which corrupts the archive when the server
# ignores Range. -nv keeps wget's errors and one-line summary
# without the dot progress meter.
for url in \
https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz \
https://www.zlib.net/fossils/zlib-1.3.tar.gz \
https://www.openssl.org/source/openssl-3.0.13.tar.gz \
; do
archive="$(basename "$url")"
for attempt in 1 2 3; do
rm -f "$archive"
if wget -nv --tries=1 --timeout=60 -O "$archive" "$url" \
&& tar -xzf "$archive"; then
break
fi
if [ "$attempt" -eq 3 ]; then
echo "::error::failed to fetch $url after $attempt attempts"
exit 1
fi
echo "fetching $url failed (attempt $attempt), retrying in 5s"
sleep 5
done
rm -f "$archive"
done
- name: Get libModSecurity source
uses: actions/checkout@v4
with:
repository: owasp-modsecurity/ModSecurity
submodules: recursive
path: nginx/objs/lib/ModSecurity
fetch-depth: 1
- name: Setup Conan
shell: cmd
run: |
pip3 install conan --upgrade
conan profile detect
- name: Retry rate-limited Conan downloads
shell: pwsh
run: |
# Conan builds the dependencies without a prebuilt binary from source, and the lmdb
# sources come from git.openldap.org, which rate limits CI runners with HTTP 429.
# By default Conan gives up after 2 retries, 5 seconds apart.
$conf = Join-Path (conan config home) "global.conf"
Add-Content $conf "tools.files.download:retry=10"
Add-Content $conf "tools.files.download:retry_wait=30"
- name: Build libModSecurity
working-directory: nginx/objs/lib/ModSecurity
shell: cmd
run: |
vcbuild.bat
- name: Get ModSecurity-nginx source code
uses: actions/checkout@v4
with:
path: nginx/objs/lib/ModSecurity-nginx
- name: Copy ModSecurity-nginx tests to nginx/test
working-directory: nginx/test
run: |
cp ../objs/lib/ModSecurity-nginx/tests/* .
- name: Remove /usr/bin/link conflicting with MSVC link.exe
run: |
set -ex
which link
rm /usr/bin/link
- name: Build nginx w/ModSecurity-nginx module
working-directory: nginx
run: |
: # Windows native version of Perl is required by nginx build
export PATH=/c/Strawberry/perl/bin:$PATH
: # Set env variables to point to libModSecurity v3 include & lib directories
export MODSECURITY_INC=objs/lib/ModSecurity/headers
export MODSECURITY_LIB=objs/lib/ModSecurity/build/win32/build/Release
: # Copy libModSecurity.dll to objs dir (to be able to run nginx later)
cp $MODSECURITY_LIB/libModSecurity.dll objs
: # Configure nginx build w/ModSecurity-nginx module
auto/configure \
--with-cc=cl \
--with-debug \
--prefix= \
--conf-path=conf/nginx.conf \
--pid-path=logs/nginx.pid \
--http-log-path=logs/access.log \
--error-log-path=logs/error.log \
--sbin-path=nginx.exe \
--http-client-body-temp-path=temp/client_body_temp \
--http-proxy-temp-path=temp/proxy_temp \
--http-fastcgi-temp-path=temp/fastcgi_temp \
--http-scgi-temp-path=temp/scgi_temp \
--http-uwsgi-temp-path=temp/uwsgi_temp \
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-pcre=objs/lib/pcre2-10.39 \
--with-zlib=objs/lib/zlib-1.3 \
--with-openssl=objs/lib/openssl-3.0.13 \
--with-openssl-opt=no-asm \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_auth_request_module \
--add-module=objs/lib/ModSecurity-nginx
nmake
- name: Run ModSecurity-nginx tests
working-directory: nginx/test
shell: cmd # tests need to run on a "windows" shell
run: |
md temp
set TEMP=temp
set TEST_NGINX_BINARY=..\objs\nginx.exe
prove modsecurity*.t
Loading
Loading