-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[ext_proc] request_body_mode override for stream with a request without a body causes seg fault #17354
Copy link
Copy link
Closed
Labels
Description
Received permission to make this crash a public issue from @htuch
Title: request_body_mode override for stream with a request without a body causes seg fault
Description:
The following scenario causes a seg fault:
- Downstream sends a GET request to Envoy with no HTTP Body
- ext_proc filter sends ProcessingRequest message to external process with request_headers set
- External process replies with ProcessingResponse message setting the ProcessingMode mode_override to BUFFER the request_body
- A seg fault occurs because the downstream request does not contain a body.
If the downstream request contains a body (e.g., POST request with data) a crash does not occur.
The following test case can be added to test/extensions/filters/http/ext_proc/ext_proc_integration_test.cc to recreate the seg fault
// Test how the filter responds when asked to buffer a request body for a GET
// request with no body.
TEST_P(ExtProcIntegrationTest, BufferBodyOverrideNoRequestBody) {
initializeConfig();
HttpIntegrationTest::initialize();
auto response = sendDownstreamRequest(absl::nullopt);
ProcessingRequest request_headers_msg;
waitForFirstMessage(request_headers_msg);
processor_stream_->startGrpcStream();
ProcessingResponse resp;
resp.mutable_request_headers();
auto* proc_mode = resp.mutable_mode_override();
proc_mode->set_request_body_mode(ProcessingMode::BUFFERED);
processor_stream_->sendGrpcMessage(resp);
handleUpstreamRequest();
processor_stream_->finishGrpcStream(Grpc::Status::Ok);
// TODO: fix what should be the expected behavior here?
verifyDownstreamResponse(*response, 500);
}
Reactions are currently unavailable