]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: h1: drop headers whose names contain invalid chars
authorWilly Tarreau <w@1wt.eu>
Sun, 24 May 2026 11:59:21 +0000 (13:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 26 May 2026 11:13:18 +0000 (13:13 +0200)
commitb9aaf3c18a2e0e3d50d12470d1cd5a2b5f6a5aa5
tree73e939de2c61ad0a84f3b050c3edc25fed6f13f4
parent635652c5aa537a5d219019b328959f77fec31233
BUG/MEDIUM: h1: drop headers whose names contain invalid chars

Originally with "option accept-invalid-http-request", we couldn't really
edit the request on the fly to remove offending headers. But since we
have HTX and the headers are indexed one at a time, it has become
trivial. A non-negligible number of violations are conditioned by the
now renamed "option accept-unsafe-violations-in-http-request", and a
controversial one could definitely be reporting and passing invalid
header names containing control chars or spaces. The option was placed
so as not to block requests/responses containing them, but there's no
point in passing them to the other side. Most of the time it will be
totally harmless since the other side will reject them. But in case
haproxy is placed in front of a non-compliant server, it would fail
to protect it.

This patch implements a name check for all headers when a parsing
error was detected. It's cheap enough (especially since only done
after an error), and will skip the header if its name is invalid.
This may also remove some possibilities of confusion in logs, or
when encoding headers names for example.

This should be backported at least till the latest LTS.
doc/configuration.txt
src/h1.c