Commit 148d8400 authored by Joe DeBlasio's avatar Joe DeBlasio Committed by Commit Bot

[Lookalikes] Show lookalike interstitial when site redirects to itself.

This CL is a small change that ensures lookalike sites that redirect to
themselves still see the lookalike interstitial.

Bug: 1056847
Change-Id: I52dce34ac6cb6818da638840057cf8f354c1da07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2103072
Commit-Queue: Joe DeBlasio <jdeblasio@chromium.org>
Auto-Submit: Joe DeBlasio <jdeblasio@chromium.org>
Reviewed-by: default avatarMustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750298}
parent 4e06cff8
......@@ -73,7 +73,7 @@ bool IsSafeRedirect(const std::string& matching_domain,
DCHECK_LE(first_cross_site_redirect, redirect_chain.size() - 1);
if (first_cross_site_redirect == 0) {
// All URLs in the redirect chain belong to the same eTLD+1.
return true;
return false;
}
// There is a redirect from the initial eTLD+1 to another site. In order to be
// a safe redirect, it should be to the root of |matching_domain|. This
......
......@@ -62,6 +62,18 @@ TEST(LookalikeUrlNavigationThrottleTest, IsSafeRedirect) {
EXPECT_FALSE(IsSafeRedirect("example.com", {GURL("http://éxample.com"),
GURL("http://intermediate.com"),
GURL("http://example.com")}));
// Not safe: The redirect stays unsafe from éxample.com to éxample.com.
EXPECT_FALSE(IsSafeRedirect(
"example.com", {GURL("http://éxample.com"), GURL("http://éxample.com")}));
// Not safe: Same, but to a path on the bad domain
EXPECT_FALSE(IsSafeRedirect(
"example.com",
{GURL("http://éxample.com"), GURL("http://éxample.com/path")}));
// Not safe: Same, but with an intermediary domain.
EXPECT_FALSE(IsSafeRedirect("example.com", {GURL("http://éxample.com/path"),
GURL("http://intermediate.com/p"),
GURL("http://éxample.com/dir")}));
}
} // namespace lookalikes
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