Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dns: removing envoy.reloadable_features.fix_wildcard_matching #14644 #14768

Merged
merged 2 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Removed Config or Runtime
*Normally occurs at the end of the* :ref:`deprecation period <deprecated>`

* access_logs: removed legacy unbounded access logs and runtime guard `envoy.reloadable_features.disallow_unbounded_access_logs`.
* dns: removed legacy buggy wildcard matching path and runtime guard `envoy.reloadable_features.fix_wildcard_matching`.
* dynamic_forward_proxy: removed `envoy.reloadable_features.enable_dns_cache_circuit_breakers` and legacy code path.
* http: removed legacy connection close behavior and runtime guard `envoy.reloadable_features.fixed_connection_close`.
* http: removed legacy HTTP/1.1 error reporting path and runtime guard `envoy.reloadable_features.early_errors_via_hcm`.
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 @@ -65,7 +65,6 @@ constexpr const char* runtime_features[] = {
"envoy.reloadable_features.consume_all_retry_headers",
"envoy.reloadable_features.check_ocsp_policy",
"envoy.reloadable_features.disable_tls_inspector_injection",
"envoy.reloadable_features.fix_wildcard_matching",
"envoy.reloadable_features.hcm_stream_error_on_invalid_message",
"envoy.reloadable_features.health_check.graceful_goaway_handling",
"envoy.reloadable_features.http_default_alpn",
Expand Down
8 changes: 2 additions & 6 deletions source/extensions/transport_sockets/tls/context_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -757,12 +757,8 @@ bool ContextImpl::dnsNameMatch(const absl::string_view dns_name, const absl::str
if (pattern_len > 1 && pattern[0] == '*' && pattern[1] == '.') {
if (dns_name.length() > pattern_len - 1) {
const size_t off = dns_name.length() - pattern_len + 1;
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.fix_wildcard_matching")) {
return dns_name.substr(0, off).find('.') == std::string::npos &&
dns_name.substr(off, pattern_len - 1) == pattern.substr(1, pattern_len - 1);
} else {
return dns_name.substr(off, pattern_len - 1) == pattern.substr(1, pattern_len - 1);
}
return dns_name.substr(0, off).find('.') == std::string::npos &&
dns_name.substr(off, pattern_len - 1) == pattern.substr(1, pattern_len - 1);
}
}

Expand Down
42 changes: 0 additions & 42 deletions test/extensions/transport_sockets/tls/context_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,6 @@ TEST_F(SslContextImplTest, TestDnsNameMatching) {
EXPECT_FALSE(ContextImpl::dnsNameMatch("lyft.com", ""));
}

TEST_F(SslContextImplTest, TestDnsNameMatchingLegacy) {
TestScopedRuntime scoped_runtime;
Runtime::LoaderSingleton::getExisting()->mergeValues(
{{"envoy.reloadable_features.fix_wildcard_matching", "false"}});
EXPECT_TRUE(ContextImpl::dnsNameMatch("lyft.com", "lyft.com"));
EXPECT_TRUE(ContextImpl::dnsNameMatch("a.lyft.com", "*.lyft.com"));
// Legacy behavior
EXPECT_TRUE(ContextImpl::dnsNameMatch("a.b.lyft.com", "*.lyft.com"));
EXPECT_FALSE(ContextImpl::dnsNameMatch("foo.test.com", "*.lyft.com"));
EXPECT_FALSE(ContextImpl::dnsNameMatch("lyft.com", "*.lyft.com"));
EXPECT_FALSE(ContextImpl::dnsNameMatch("alyft.com", "*.lyft.com"));
EXPECT_FALSE(ContextImpl::dnsNameMatch("alyft.com", "*lyft.com"));
EXPECT_FALSE(ContextImpl::dnsNameMatch("lyft.com", "*lyft.com"));
EXPECT_FALSE(ContextImpl::dnsNameMatch("", "*lyft.com"));
EXPECT_FALSE(ContextImpl::dnsNameMatch("lyft.com", ""));
}

TEST_F(SslContextImplTest, TestVerifySubjectAltNameDNSMatched) {
bssl::UniquePtr<X509> cert = readCertFromFile(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem"));
Expand Down Expand Up @@ -172,20 +155,6 @@ TEST_F(SslContextImplTest, TestMultiLevelMatch) {
EXPECT_FALSE(ContextImpl::matchSubjectAltName(cert.get(), subject_alt_name_matchers));
}

TEST_F(SslContextImplTest, TestMultiLevelMatchLegacy) {
TestScopedRuntime scoped_runtime;
Runtime::LoaderSingleton::getExisting()->mergeValues(
{{"envoy.reloadable_features.fix_wildcard_matching", "false"}});
bssl::UniquePtr<X509> cert = readCertFromFile(TestEnvironment::substitute(
"{{ test_rundir "
"}}/test/extensions/transport_sockets/tls/test_data/san_multiple_dns_cert.pem"));
envoy::type::matcher::v3::StringMatcher matcher;
matcher.set_exact("foo.api.example.com");
std::vector<Matchers::StringMatcherImpl> subject_alt_name_matchers;
subject_alt_name_matchers.push_back(Matchers::StringMatcherImpl(matcher));
EXPECT_TRUE(ContextImpl::matchSubjectAltName(cert.get(), subject_alt_name_matchers));
}

TEST_F(SslContextImplTest, TestVerifySubjectAltNameURIMatched) {
bssl::UniquePtr<X509> cert = readCertFromFile(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"));
Expand All @@ -202,17 +171,6 @@ TEST_F(SslContextImplTest, TestVerifySubjectAltMultiDomain) {
EXPECT_FALSE(ContextImpl::verifySubjectAltName(cert.get(), verify_subject_alt_name_list));
}

TEST_F(SslContextImplTest, TestVerifySubjectAltMultiDomainLegacy) {
TestScopedRuntime scoped_runtime;
Runtime::LoaderSingleton::getExisting()->mergeValues(
{{"envoy.reloadable_features.fix_wildcard_matching", "false"}});
bssl::UniquePtr<X509> cert = readCertFromFile(TestEnvironment::substitute(
"{{ test_rundir "
"}}/test/extensions/transport_sockets/tls/test_data/san_multiple_dns_cert.pem"));
std::vector<std::string> verify_subject_alt_name_list = {"https://a.www.example.com"};
EXPECT_TRUE(ContextImpl::verifySubjectAltName(cert.get(), verify_subject_alt_name_list));
}

TEST_F(SslContextImplTest, TestMatchSubjectAltNameURIMatched) {
bssl::UniquePtr<X509> cert = readCertFromFile(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"));
Expand Down