Commit e49f21f3 authored by Christopher Thompson's avatar Christopher Thompson Committed by Commit Bot

Make legacy TLS errors non-fatal

This adds an exemption for legacy TLS errors from being fatal errors.
This also adds a browser test (to ensure the interstitial is always
bypassable) and a unittest (to ensure that legacy TLS errors aren't
marked as fatal).

Bug: 1047777
Change-Id: Ia50bff281d7c68f4f678e9b6209f7bc7aaa495f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033644Reviewed-by: default avatarRyan Sleevi <rsleevi@chromium.org>
Commit-Queue: Christopher Thompson <cthomp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737479}
parent 1904cb6d
...@@ -7280,6 +7280,33 @@ IN_PROC_BROWSER_TEST_F(LegacyTLSInterstitialTest, LegacyTLSPagesNotCached) { ...@@ -7280,6 +7280,33 @@ IN_PROC_BROWSER_TEST_F(LegacyTLSInterstitialTest, LegacyTLSPagesNotCached) {
observer.WaitForNavigation(); // Will fail if resource is loaded from cache. observer.WaitForNavigation(); // Will fail if resource is loaded from cache.
} }
// Tests that a page with legacy TLS and HSTS shows a bypassable interstitial
// rather than a hard non-bypassable HSTS warning.
IN_PROC_BROWSER_TEST_F(LegacyTLSInterstitialTest, LegacyTLSNotFatal) {
// Set HSTS for the test page.
ssl_test_util::SetHSTSForHostName(browser()->profile(), kHstsTestHostName);
// Connect over TLS 1.0 and proceed through the interstitial.
SetTLSVersion(net::SSL_PROTOCOL_VERSION_TLS1);
ASSERT_TRUE(https_server()->Start());
ui_test_utils::NavigateToURL(
browser(), https_server()->GetURL(kHstsTestHostName, "/ssl/google.html"));
auto* tab = browser()->tab_strip_model()->GetActiveWebContents();
WaitForInterstitial(tab);
// Verify that there is a proceed link in the interstitial.
int result = security_interstitials::CMD_ERROR;
const std::string javascript = base::StringPrintf(
"domAutomationController.send("
"(document.querySelector(\"#proceed-link\") === null) "
"? (%d) : (%d))",
security_interstitials::CMD_TEXT_NOT_FOUND,
security_interstitials::CMD_TEXT_FOUND);
ASSERT_TRUE(content::ExecuteScriptAndExtractInt(tab->GetMainFrame(),
javascript, &result));
EXPECT_EQ(security_interstitials::CMD_TEXT_FOUND, result);
}
// Checks that SimpleURLLoader, which uses services/network/url_loader.cc, goes // Checks that SimpleURLLoader, which uses services/network/url_loader.cc, goes
// through the new NetworkServiceClient interface to deliver cert error // through the new NetworkServiceClient interface to deliver cert error
// notifications to the browser which then overrides the certificate error. // notifications to the browser which then overrides the certificate error.
......
...@@ -1275,6 +1275,7 @@ ssl_verify_result_t SSLClientSocketImpl::HandleVerifyResult() { ...@@ -1275,6 +1275,7 @@ ssl_verify_result_t SSLClientSocketImpl::HandleVerifyResult() {
is_fatal_cert_error_ = is_fatal_cert_error_ =
IsCertStatusError(server_cert_verify_result_.cert_status) && IsCertStatusError(server_cert_verify_result_.cert_status) &&
result != ERR_CERT_KNOWN_INTERCEPTION_BLOCKED && result != ERR_CERT_KNOWN_INTERCEPTION_BLOCKED &&
result != ERR_SSL_OBSOLETE_VERSION &&
context_->transport_security_state()->ShouldSSLErrorsBeFatal( context_->transport_security_state()->ShouldSSLErrorsBeFatal(
host_and_port_.host()); host_and_port_.host());
......
...@@ -5937,6 +5937,32 @@ TEST_F(LegacyTLSDeprecationTest, PrioritizeCertErrorsOverLegacyTLS) { ...@@ -5937,6 +5937,32 @@ TEST_F(LegacyTLSDeprecationTest, PrioritizeCertErrorsOverLegacyTLS) {
EXPECT_TRUE(info.cert_status & CERT_STATUS_DATE_INVALID); EXPECT_TRUE(info.cert_status & CERT_STATUS_DATE_INVALID);
} }
// Checks that legacy TLS errors are not fatal.
TEST_F(LegacyTLSDeprecationTest, LegacyTLSErrorsNotFatal) {
SSLServerConfig server_config;
server_config.version_min = SSL_PROTOCOL_VERSION_TLS1;
server_config.version_max = SSL_PROTOCOL_VERSION_TLS1;
ASSERT_TRUE(
StartEmbeddedTestServer(EmbeddedTestServer::CERT_OK, server_config));
SSLConfig client_config;
// Connection should fail with ERR_SSL_OBSOLETE_VERSION and the legacy TLS
// cert status.
int rv;
const base::Time expiry =
base::Time::Now() + base::TimeDelta::FromSeconds(1000);
transport_security_state_->AddHSTS(host_port_pair().host(), expiry, true);
ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
EXPECT_THAT(rv, IsError(ERR_SSL_OBSOLETE_VERSION));
SSLInfo info;
ASSERT_TRUE(sock_->GetSSLInfo(&info));
EXPECT_TRUE(info.cert_status & CERT_STATUS_LEGACY_TLS);
// The error should not be marked as fatal.
EXPECT_FALSE(info.is_fatal_cert_error);
}
TEST_F(SSLClientSocketZeroRTTTest, EarlyDataReasonNewSession) { TEST_F(SSLClientSocketZeroRTTTest, EarlyDataReasonNewSession) {
const char kReasonHistogram[] = "Net.SSLHandshakeEarlyDataReason"; const char kReasonHistogram[] = "Net.SSLHandshakeEarlyDataReason";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment