Skip to content

1.27 Backport H/2 header discard fix#33302

Merged
phlax merged 5 commits intoenvoyproxy:release/v1.27from
SeanKilleen:1.27-backport-h2-authority-fix
Apr 4, 2024
Merged

1.27 Backport H/2 header discard fix#33302
phlax merged 5 commits intoenvoyproxy:release/v1.27from
SeanKilleen:1.27-backport-h2-authority-fix

Conversation

@SeanKilleen
Copy link
Copy Markdown

Commit Message:
Discard the Host header if the :authority header was received to bring Envoy into compliance with https://www.rfc-editor.org/rfc/rfc9113#section-8.3.1

This behavioral change can be reverted by setting runtime flag envoy.reloadable_features.http2_discard_host_header to false.

Risk Level: Low
Testing: Unit Tests
Docs Changes: N/A
Release Notes: Yes
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.http2_discard_host_header
Back-ports #30005, supporting #31118

@repokitteh-read-only
Copy link
Copy Markdown

Hi @SeanKilleen, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #33302 was opened by SeanKilleen.

see: more, trace.

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #33302 was opened by SeanKilleen.

see: more, trace.

@SeanKilleen SeanKilleen force-pushed the 1.27-backport-h2-authority-fix branch from 7cdab56 to 49571b9 Compare April 3, 2024 19:00
Copy link
Copy Markdown
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this backport.

/wait

Comment thread test/integration/multiplexed_integration_test.cc Outdated
yanavlasov and others added 5 commits April 3, 2024 19:42
Discard the Host header if the :authority header was received to bring Envoy into compliance with https://www.rfc-editor.org/rfc/rfc9113#section-8.3.1

This behavioral change can be reverted by setting runtime flag envoy.reloadable_features.http2_discard_host_header to false.

---------

Signed-off-by: Yan Avlasov <yavlasov@google.com>
Signed-off-by: Sean Killeen <SeanKilleen@gmail.com>
Signed-off-by: Sean Killeen <SeanKilleen@gmail.com>
Signed-off-by: Sean Killeen <SeanKilleen@gmail.com>
Depended upon by test

Signed-off-by: Sean Killeen <SeanKilleen@gmail.com>
Signed-off-by: Sean Killeen <SeanKilleen@gmail.com>
@SeanKilleen SeanKilleen force-pushed the 1.27-backport-h2-authority-fix branch from 984b254 to 7925a5a Compare April 3, 2024 23:42
@SeanKilleen SeanKilleen requested a review from yanavlasov April 3, 2024 23:43
Copy link
Copy Markdown
Member

@phlax phlax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added tests dont seem to break anything so ill land this to include in the release

lgtm, thanks again

@SeanKilleen

Comment on lines +2132 to +2164
TEST_P(Http2FrameIntegrationTest, HostDifferentFromAuthority) {
beginSession();

uint32_t request_idx = 0;
auto request = Http2Frame::makeRequest(Http2Frame::makeClientStreamId(request_idx),
"one.example.com", "/path", {{"host", "two.example.com"}});
sendFrame(request);

waitForNextUpstreamRequest();
EXPECT_EQ(upstream_request_->headers().getHostValue(), "one.example.com");
upstream_request_->encodeHeaders(default_response_headers_, true);
auto frame = readFrame();
EXPECT_EQ(Http2Frame::Type::Headers, frame.type());
EXPECT_EQ(Http2Frame::ResponseStatus::Ok, frame.responseStatus());
tcp_client_->close();
}

TEST_P(Http2FrameIntegrationTest, HostSameAsAuthority) {
beginSession();

uint32_t request_idx = 0;
auto request = Http2Frame::makeRequest(Http2Frame::makeClientStreamId(request_idx),
"one.example.com", "/path", {{"host", "one.example.com"}});
sendFrame(request);

waitForNextUpstreamRequest();
EXPECT_EQ(upstream_request_->headers().getHostValue(), "one.example.com");
upstream_request_->encodeHeaders(default_response_headers_, true);
auto frame = readFrame();
EXPECT_EQ(Http2Frame::Type::Headers, frame.type());
EXPECT_EQ(Http2Frame::ResponseStatus::Ok, frame.responseStatus());
tcp_client_->close();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think these 2 tests have been added in this pr - i guess because the original pr made alterations to them

@phlax phlax dismissed yanavlasov’s stale review April 4, 2024 08:35

feedback addressed

@phlax phlax merged commit f7d7ae7 into envoyproxy:release/v1.27 Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants