BUG/MAJOR: h2: verify that :path starts with a '/' before concatenating it
authorWilly Tarreau <w@1wt.eu>
Tue, 10 Aug 2021 14:30:55 +0000 (16:30 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Sat, 11 Feb 2023 10:40:49 +0000 (10:40 +0000)
commit3a147dab8b90f351b160a89e43e30752c2737387
tree1eeca6ddb8e397b14754ebefbf59e03035165fa2
parent596e41e0934ff1b32fbc005aff3b4bd8770ad5ab
BUG/MAJOR: h2: verify that :path starts with a '/' before concatenating it

Tim Düsterhus found that while the H2 path is checked for non-emptiness,
invalid chars and '*', a test is missing to verify that except for '*',
it always starts with exactly one '/'. During the reconstruction of the
full URI when passing to HTX, this allows to affect the apparent authority
by appending a port number or a suffix name.

This only affects H2-to-H2 communications, as H2-to-H1 do not use the
authority. Like for previous fix, the following rule installed in the
frontend or backend is sufficient to renormalize the internal URI:

    http-request set-header host %[req.hdr(host)]

This needs to be backported to 2.2, since earlier versions do not rebuild
a full URI using the authority and will fail on the malformed path at the
HTTP layer.

(cherry picked from commit d3b22b75025246e81ff8d0c78837d4b89d7cf8f8)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 2360306269ff65420cba7c847687a774b1025ab5)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit c99c5cd3588a28978cd065abc74508fe81a93a40)
Signed-off-by: Willy Tarreau <w@1wt.eu>
Gbp-Pq: Name 2.2-0003-BUG-MAJOR-h2-verify-that-path-starts-with-a-before-c.patch
src/h2.c