Add HTTP/3 Host header support for ModSecurity#364
Add HTTP/3 Host header support for ModSecurity#364AMoo-Miki wants to merge 1 commit intoowasp-modsecurity:masterfrom
Conversation
|
Hi @AMoo-Miki, first of all, thank you for your PR. I am sure that this is a very important step towards being able to handle HTTP/3 requests. But I'm not sure this is the right way. Please do not misunderstand me, I don't want to reject this PR, but I think we need to discuss how can we handle HTTP/3 headers correctly. I think adding a header with the name Also, please add some tests to this new feature. |
|
@airween thanks for looking into this. I totally get where you are coming from but if I put my "salesman hat" on, I could say adding it as a "Host" header here isn't really fabricating data; it's exposing the same value to ModSecurity's Here are some other options I considered:
What really helped me choose was RFC 9114, Section 4.3.1:
I interpreted that as it being necessary for this connector to populate This approach ensures consistent behavior across HTTP/1.1, HTTP/2, and HTTP/3 without requiring rule modifications.
|
92c9e6b to
6abcc17
Compare
ModSecurity cannot see the Host header in HTTP/3 requests because HTTP/3 uses the `:authority` pseudo-header, which nginx parses into `r->headers_in.server` but doesn't add to the headers list. This commit: - Adds `NGX_HTTP_VERSION_30` case to `http_version` switch - Manually extracts Host from `r->headers_in.server` for HTTP/3 requests - Adds Host header to ModSecurity transaction before processing other headers Fixes owasp-modsecurity#305 false positives from OWASP CRS rule 920280 (Missing Host Header) on HTTP/3 connections. Tested with nginx 1.29.3 and ModSecurity 3.0.13.
6abcc17 to
b95a97c
Compare
|



ModSecurity cannot see the Host header in HTTP/3 requests because HTTP/3 uses the
:authoritypseudo-header, which nginx parses intor->headers_in.serverbut doesn't add to the headers list.This commit:
NGX_HTTP_VERSION_30case tohttp_versionswitchr->headers_in.serverfor HTTP/3 requestsFixes #305 false positives from OWASP CRS rule 920280 (Missing Host Header) on HTTP/3 connections.
Tested with nginx 1.29.3 and ModSecurity 3.0.13.