Skip to content

Commit

Permalink
Merge pull request #701 from diracdeltas/fix/binance-captcha
Browse files Browse the repository at this point in the history
Add referer exception for geetest captchas
  • Loading branch information
bbondy committed Oct 21, 2018
1 parent 0209b45 commit aea4680
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions common/shield_exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ bool IsWhitelistedReferrer(const GURL& firstPartyOrigin,
// It's preferred to use specific_patterns below when possible
static std::vector<URLPattern> whitelist_patterns({
URLPattern(URLPattern::SCHEME_ALL, "https://use.typekit.net/*"),
URLPattern(URLPattern::SCHEME_ALL, "https://api.geetest.com/*"),
URLPattern(URLPattern::SCHEME_ALL, "https://cloud.typography.com/*")
});
return std::any_of(whitelist_patterns.begin(), whitelist_patterns.end(),
Expand Down
8 changes: 8 additions & 0 deletions common/shield_exceptions_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ TEST_F(BraveShieldsExceptionsTest, IsWhitelistedReferrer) {
GURL("https://use.typekit.net/193")));
EXPECT_TRUE(IsWhitelistedReferrer(GURL("https://www.test.com"),
GURL("https://cloud.typography.com/199")));
// geetest allowed everywhere
EXPECT_TRUE(IsWhitelistedReferrer(GURL("https://binance.com"),
GURL("https://api.geetest.com/ajax.php?")));
EXPECT_TRUE(IsWhitelistedReferrer(GURL("http://binance.com"),
GURL("https://api.geetest.com/")));
// not allowed with a different scheme
EXPECT_FALSE(IsWhitelistedReferrer(GURL("http://binance.com"),
GURL("http://api.geetest.com/")));
}

} // namespace

0 comments on commit aea4680

Please sign in to comment.