]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: sample: do not parse compressed gRPC messages in ungrpc
authorMartin Mirchev <mirchevmartin2203@gmail.com>
Wed, 18 Nov 2026 12:39:28 +0000 (20:39 +0800)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 19 Nov 2026 09:57:16 +0000 (10:57 +0100)
commit9559d681e94c8b4f116c9fb03e6d1ec0b0e98d32
tree1504482372b799c14358710429b8c26328766720
parent3a69eb799b0c2a8a78454398401395930d8cc9f0
BUG/MINOR: sample: do not parse compressed gRPC messages in ungrpc

sample_conv_ungrpc() skips the 5-byte gRPC message header without looking
at its Compressed-Flag byte, so a message whose payload is compressed
(flag 1) is handed to the protobuf parser as if it were plain protobuf,
and so is a message with an invalid flag value. A request body
"01 00 00 00 02 08 2a" (compressed flag, 2-byte payload) returns 42 from
"req.body,ungrpc(1,uint32)", exactly as the uncompressed one does, while
the real field value would only appear after decompression.

Skip compressed messages, as their payload cannot be parsed, and stop on
a flag other than 0 or 1 since the gRPC framing is then invalid.

This should be backported to all stable versions.
src/sample.c