Commit 0b1c7760 authored by Lucas Garron's avatar Lucas Garron Committed by Commit Bot

Preload HSTS for the .foo gTLD.

This CL also adds unit tests for .foo preloading and updates two tests
that were using http://foo as a test URL.

There are still other places in the code that use http[s]://foo as a test
domain. If this change causes issues for them down the line, they should be
changed to use foo.test or another domain under a test TLD:
https://tools.ietf.org/html/rfc2606#section-2

BUG=b/65158868 (Google-internal)

Change-Id: I8005a3767677e819b8df898ccc073cf1db523d60
Reviewed-on: https://chromium-review.googlesource.com/669396Reviewed-by: default avatarChris Bentzel <cbentzel@chromium.org>
Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Reviewed-by: default avatarLucas Garron <lgarron@chromium.org>
Commit-Queue: Lucas Garron <lgarron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502948}
parent 6d3ff1b5
...@@ -189,7 +189,7 @@ class IOThreadBrowserTestWithPacFileURL : public IOThreadBrowserTest { ...@@ -189,7 +189,7 @@ class IOThreadBrowserTestWithPacFileURL : public IOThreadBrowserTest {
IN_PROC_BROWSER_TEST_F(IOThreadBrowserTestWithPacFileURL, FilePac) { IN_PROC_BROWSER_TEST_F(IOThreadBrowserTestWithPacFileURL, FilePac) {
TestURLFetcherDelegate fetcher_delegate; TestURLFetcherDelegate fetcher_delegate;
std::unique_ptr<net::URLFetcher> fetcher = std::unique_ptr<net::URLFetcher> fetcher =
net::URLFetcher::Create(GURL("http://foo:12345/echoheader?Foo"), net::URLFetcher::Create(GURL("http://foo.test:12345/echoheader?Foo"),
net::URLFetcher::GET, &fetcher_delegate); net::URLFetcher::GET, &fetcher_delegate);
fetcher->AddExtraRequestHeader("Foo: Bar"); fetcher->AddExtraRequestHeader("Foo: Bar");
fetcher->SetRequestContext( fetcher->SetRequestContext(
......
...@@ -173,9 +173,9 @@ TEST_F(DataReductionProxyInterceptorTest, MAYBE_TestJobFactoryChaining) { ...@@ -173,9 +173,9 @@ TEST_F(DataReductionProxyInterceptorTest, MAYBE_TestJobFactoryChaining) {
Init(std::move(factory1)); Init(std::move(factory1));
net::TestDelegate d; net::TestDelegate d;
std::unique_ptr<net::URLRequest> req( std::unique_ptr<net::URLRequest> req(default_context_->CreateRequest(
default_context_->CreateRequest(GURL("http://foo"), net::DEFAULT_PRIORITY, GURL("http://foo.test"), net::DEFAULT_PRIORITY, &d,
&d, TRAFFIC_ANNOTATION_FOR_TESTS)); TRAFFIC_ANNOTATION_FOR_TESTS));
req->Start(); req->Start();
base::RunLoop().Run(); base::RunLoop().Run();
......
...@@ -248,6 +248,7 @@ ...@@ -248,6 +248,7 @@
// but other gTLDs and eTLDs are welcome to preload if they are interested. // but other gTLDs and eTLDs are welcome to preload if they are interested.
{ "name": "google", "include_subdomains": true, "mode": "force-https", "pins": "google" }, { "name": "google", "include_subdomains": true, "mode": "force-https", "pins": "google" },
{ "name": "dev", "include_subdomains": true, "mode": "force-https" }, { "name": "dev", "include_subdomains": true, "mode": "force-https" },
{ "name": "foo", "include_subdomains": true, "mode": "force-https" },
// Google domains using Expect-CT. // Google domains using Expect-CT.
{ "name": "mail.google.com", "include_subdomains": true, "mode": "force-https", "pins": "google", "expect_ct": true, "expect_ct_report_uri": "https://clients3.google.com/ct_upload" }, { "name": "mail.google.com", "include_subdomains": true, "mode": "force-https", "pins": "google", "expect_ct": true, "expect_ct_report_uri": "https://clients3.google.com/ct_upload" },
...@@ -917,6 +917,7 @@ TEST_F(TransportSecurityStateTest, IsPreloaded) { ...@@ -917,6 +917,7 @@ TEST_F(TransportSecurityStateTest, IsPreloaded) {
const std::string aypal = "aypal.com"; const std::string aypal = "aypal.com";
const std::string google = "google"; const std::string google = "google";
const std::string www_google = "www.google"; const std::string www_google = "www.google";
const std::string foo = "foo";
TransportSecurityState state; TransportSecurityState state;
TransportSecurityState::STSState sts_state; TransportSecurityState::STSState sts_state;
...@@ -927,6 +928,7 @@ TEST_F(TransportSecurityStateTest, IsPreloaded) { ...@@ -927,6 +928,7 @@ TEST_F(TransportSecurityStateTest, IsPreloaded) {
EXPECT_FALSE(sts_state.include_subdomains); EXPECT_FALSE(sts_state.include_subdomains);
EXPECT_TRUE(GetStaticDomainState(&state, google, &sts_state, &pkp_state)); EXPECT_TRUE(GetStaticDomainState(&state, google, &sts_state, &pkp_state));
EXPECT_TRUE(GetStaticDomainState(&state, www_google, &sts_state, &pkp_state)); EXPECT_TRUE(GetStaticDomainState(&state, www_google, &sts_state, &pkp_state));
EXPECT_TRUE(GetStaticDomainState(&state, foo, &sts_state, &pkp_state));
EXPECT_FALSE( EXPECT_FALSE(
GetStaticDomainState(&state, a_www_paypal, &sts_state, &pkp_state)); GetStaticDomainState(&state, a_www_paypal, &sts_state, &pkp_state));
EXPECT_FALSE( EXPECT_FALSE(
...@@ -1033,6 +1035,8 @@ TEST_F(TransportSecurityStateTest, Preloaded) { ...@@ -1033,6 +1035,8 @@ TEST_F(TransportSecurityStateTest, Preloaded) {
EXPECT_TRUE(StaticShouldRedirect("ssl.google-analytics.com")); EXPECT_TRUE(StaticShouldRedirect("ssl.google-analytics.com"));
EXPECT_TRUE(StaticShouldRedirect("google")); EXPECT_TRUE(StaticShouldRedirect("google"));
EXPECT_TRUE(StaticShouldRedirect("foo.google")); EXPECT_TRUE(StaticShouldRedirect("foo.google"));
EXPECT_TRUE(StaticShouldRedirect("foo"));
EXPECT_TRUE(StaticShouldRedirect("domaintest.foo"));
EXPECT_TRUE(StaticShouldRedirect("gmail.com")); EXPECT_TRUE(StaticShouldRedirect("gmail.com"));
EXPECT_TRUE(StaticShouldRedirect("www.gmail.com")); EXPECT_TRUE(StaticShouldRedirect("www.gmail.com"));
EXPECT_TRUE(StaticShouldRedirect("googlemail.com")); EXPECT_TRUE(StaticShouldRedirect("googlemail.com"));
......
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