]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: h2: reject :protocol pseudo-header in H2 responses
authorTurhan ACAR <ttrnn47@gmail.com>
Thu, 24 Sep 2026 14:38:35 +0000 (15:38 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Sep 2026 17:15:50 +0000 (19:15 +0200)
commit4ddf219bb399334e00a0b9af2b155884befd4b04
tree0f0ab4be838b496f87558b259044bfd968f4044f
parenteb0e8f6fcd18c127b13cde1719644cfa031aed26
BUG/MINOR: h2: reject :protocol pseudo-header in H2 responses

RFC 7540#8.1.2.1 mandates that pseudo-headers defined for requests must not
appear in responses. When converting an HTTP/2 response to HTX, h2.c already
rejects a response carrying :authority, :method, :path or :scheme, but the
mask used for that check omits H2_PHDR_FND_PROT. As a result a backend HTTP/2
response that contains the request-only ":protocol" pseudo-header (defined by
RFC 8441 for Extended CONNECT) is accepted and forwarded to the client
instead of being rejected.

Add H2_PHDR_FND_PROT to the response-side rejection mask so that ":protocol"
is handled like the other request pseudo-headers and such a response yields a
502 instead of being forwarded.

There is no known security impact: the offending pseudo-header does not
appear in the emitted HTTP/1 response (which is byte-identical to that of
a valid one); the only effect is that a malformed response is tolerated
instead of being rejected.

This should be backported as far back as 2.4, where the ":protocol"
pseudo-header (H2_PHDR_FND_PROT) was introduced; the maintainer may narrow the
range to the currently maintained branches.

Signed-off-by: Turhan ACAR <ttrnn47@gmail.com>
src/h2.c