Skip to content

Commit

Permalink
runtime: deprecate sanitize_te
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <[email protected]>
  • Loading branch information
alyssawilk committed Dec 4, 2024
1 parent a3503a3 commit afbe0c3
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 95 deletions.
3 changes: 3 additions & 0 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ removed_config_or_runtime:
- area: dns
change: |
Removed runtime flag ``envoy.reloadable_features.dns_reresolve_on_eai_again`` and legacy code paths.
- area: http
change: |
Removed runtime flag ``envoy.restart_features.sanitize_te`` and legacy code paths.
- area: quic
change: |
Removed runtime flag ``envoy.restart_features.quic_handle_certs_with_shared_tls_code`` and legacy code paths.
Expand Down
4 changes: 0 additions & 4 deletions source/common/http/conn_manager_utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,6 @@ ConnectionManagerUtility::MutateRequestHeadersResult ConnectionManagerUtility::m
}

void ConnectionManagerUtility::sanitizeTEHeader(RequestHeaderMap& request_headers) {
if (!Runtime::runtimeFeatureEnabled("envoy.reloadable_features.sanitize_te")) {
return;
}

absl::string_view te_header = request_headers.getTEValue();
if (te_header.empty()) {
return;
Expand Down
1 change: 0 additions & 1 deletion source/common/runtime/runtime_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ RUNTIME_GUARD(envoy_reloadable_features_reject_invalid_yaml);
RUNTIME_GUARD(envoy_reloadable_features_report_stream_reset_error_code);
RUNTIME_GUARD(envoy_reloadable_features_sanitize_http2_headers_without_nghttp2);
RUNTIME_GUARD(envoy_reloadable_features_sanitize_sni_in_access_log);
RUNTIME_GUARD(envoy_reloadable_features_sanitize_te);
RUNTIME_GUARD(envoy_reloadable_features_skip_dns_lookup_for_proxied_requests);
RUNTIME_GUARD(envoy_reloadable_features_streaming_shadow);
RUNTIME_GUARD(envoy_reloadable_features_strict_duration_validation);
Expand Down
12 changes: 0 additions & 12 deletions test/common/http/conn_manager_utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2299,17 +2299,5 @@ TEST_F(ConnectionManagerUtilityTest, DiscardTEHeaderWithoutTrailers) {
EXPECT_EQ("", headers.getTEValue());
}

// Verify when TE header is present, the value should be kept if the reloadable feature
// "sanitize_te" is enabled.
TEST_F(ConnectionManagerUtilityTest, KeepTrailersTEHeaderReloadableFeatureDisabled) {
TestScopedRuntime scoped_runtime;
scoped_runtime.mergeValues({{"envoy.reloadable_features.sanitize_te", "false"}});

TestRequestHeaderMapImpl headers{{"te", "gzip"}};
callMutateRequestHeaders(headers, Protocol::Http2);

EXPECT_EQ("gzip", headers.getTEValue());
}

} // namespace Http
} // namespace Envoy
72 changes: 0 additions & 72 deletions test/integration/header_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1339,78 +1339,6 @@ TEST_P(HeaderIntegrationTest, PathWithEscapedSlashesRedirected) {
});
}

// Validates legacy TE handling: TE header is forwarded if it contains a supported value
TEST_P(HeaderIntegrationTest, TestTeHeaderPassthrough) {
config_helper_.addRuntimeOverride("envoy.reloadable_features.sanitize_te", "false");
initializeFilter(HeaderMode::Append, false);
performRequest(
Http::TestRequestHeaderMapImpl{
{":method", "GET"},
{":path", "/"},
{":scheme", "http"},
{":authority", "no-headers.com"},
{"x-request-foo", "downstram"},
{"connection", "te, close"},
{"te", "trailers"},
},
Http::TestRequestHeaderMapImpl{
{":authority", "no-headers.com"},
{":path", "/"},
{":method", "GET"},
{"x-request-foo", "downstram"},
{"te", "trailers"},
},
Http::TestResponseHeaderMapImpl{
{"server", "envoy"},
{"content-length", "0"},
{":status", "200"},
{"x-return-foo", "upstream"},
},
Http::TestResponseHeaderMapImpl{
{"server", "envoy"},
{"x-return-foo", "upstream"},
{":status", "200"},
{"connection", "close"},
});
}

// Validates legacy TE handling: that TE header stripped if it contains an unsupported value.
TEST_P(HeaderIntegrationTest, TestTeHeaderSanitized) {
config_helper_.addRuntimeOverride("envoy.reloadable_features.sanitize_te", "false");
initializeFilter(HeaderMode::Append, false);
performRequest(
Http::TestRequestHeaderMapImpl{
{":method", "GET"},
{":path", "/"},
{":scheme", "http"},
{":authority", "no-headers.com"},
{"x-request-foo", "downstram"},
{"connection", "te, mike, sam, will, close"},
{"te", "gzip"},
{"mike", "foo"},
{"sam", "bar"},
{"will", "baz"},
},
Http::TestRequestHeaderMapImpl{
{":authority", "no-headers.com"},
{":path", "/"},
{":method", "GET"},
{"x-request-foo", "downstram"},
},
Http::TestResponseHeaderMapImpl{
{"server", "envoy"},
{"content-length", "0"},
{":status", "200"},
{"x-return-foo", "upstream"},
},
Http::TestResponseHeaderMapImpl{
{"server", "envoy"},
{"x-return-foo", "upstream"},
{":status", "200"},
{"connection", "close"},
});
}

using EmptyHeaderIntegrationTest = HttpProtocolIntegrationTest;
using HeaderValueOption = envoy::config::core::v3::HeaderValueOption;

Expand Down
6 changes: 0 additions & 6 deletions test/integration/protocol_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,6 @@ TEST_P(DownstreamProtocolIntegrationTest, TeSanitization) {
}

autonomous_upstream_ = true;
config_helper_.addRuntimeOverride("envoy.reloadable_features.sanitize_te", "true");

default_request_headers_.setTE("gzip");

initialize();
Expand All @@ -815,8 +813,6 @@ TEST_P(DownstreamProtocolIntegrationTest, TeSanitizationTrailers) {
}

autonomous_upstream_ = true;
config_helper_.addRuntimeOverride("envoy.reloadable_features.sanitize_te", "true");

default_request_headers_.setTE("trailers");

initialize();
Expand All @@ -838,8 +834,6 @@ TEST_P(DownstreamProtocolIntegrationTest, TeSanitizationTrailersMultipleValuesAn
}

autonomous_upstream_ = true;
config_helper_.addRuntimeOverride("envoy.reloadable_features.sanitize_te", "true");

default_request_headers_.setTE("chunked;q=0.8 , trailers ,deflate ");

initialize();
Expand Down

0 comments on commit afbe0c3

Please sign in to comment.