fix: hold the body in memory whenever the headers are held (#2) #3
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/libnginx-mod-http-coraza!3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/gzip-static-under-delayed-headers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #2. While the response headers are held for phase 4 (
coraza_delay_response_headers on, the default), upstream's header filter (ngx_http_coraza_header_filter.c, 0.21.0) setsfilter_need_in_memoryonly when the body is inspected. gzip's header filter runs only when the headers are released, after the body filter has passed a sendfile buffer on, so withsendfile ona static file answered with gzip is an empty gzip stream. Browsers always ask for gzip.debian/patches/delay-headers-in-memory.patch: setfilter_need_in_memorywhenever the headers are held. Upstream PR #142 (issue #140) covers part of this.gzip-static: a static file,sendfile onandgzip on, Coraza with the Core Rule Set; the body must come back whole with and without gzip, and the gzip answer must really be compressed.Test plan
gzip-staticon 0.21.0-0keel1, in a container of the Keel Web step 7 image: fails,gzip, 0 of 2800 bytesgzip, 2800 of 2800 bytes; CRS payload still 403; a phase 4denystill answers a clean 403