envoy
envoy copied to clipboard
grpc: Add support for max frame length in gPRC frame decoding
The workflow:
- Client of gRPC decoder configure the
max_frame_lengthviasetMaxFrameLength() - At beginning of gRPC frame decoding process ( before
frameDataStart()), total length of the frame is determined. - If
max_frame_lengthis configured and total length exceeds the limit, the decoding process which includes excessive data addition/storage (i.e. frameData()) will be skipped and returned.
The use case/ motivation: Enable max_receive_message_length in Envoy-gRPC (which use gRPC decoder) .
- When the message is over limit, it can be rejected before frame data is fully decoded (i.e. expanded).
- This can prevent malicious attack , for example, unbounded and huge message is sent over channel and is injected and buffered in Envoy over Envoy-gRPC.
Next step:
- Refactor
bool Decoder::decodemethod: Change the return type fromboolto absl:status so that the caller can identify whether it is decoding error or over-limit error.
As a reminder, PRs marked as draft will not be automatically assigned reviewers, or be handled by maintainer-oncall triage.
Please mark your PR as ready when you want it to be reviewed!
/assign @htuch
PTAL, Thanks!
/assign @yanavlasov
Add Yan per offline discussion