Commit 58011218 authored by kcarattini's avatar kcarattini Committed by Commit bot

Safe Browsing: Only check origins for API checks.

The SB blacklist will contain information at the origin level so we
shouldn't waste resources checking longer paths.

BUG=561867,647107,543161

Review-Url: https://codereview.chromium.org/2391933002
Cr-Commit-Position: refs/heads/master@{#422986}
parent 0632d8e8
...@@ -73,7 +73,7 @@ class SafeBrowsingDatabaseManagerTest : public testing::Test { ...@@ -73,7 +73,7 @@ class SafeBrowsingDatabaseManagerTest : public testing::Test {
std::string GetStockV4GetHashResponse() { std::string GetStockV4GetHashResponse() {
ListIdentifier list_id = GetChromeUrlApiId(); ListIdentifier list_id = GetChromeUrlApiId();
FullHash full_hash = crypto::SHA256HashString("example.com/more"); FullHash full_hash = crypto::SHA256HashString("example.com/");
FindFullHashesResponse response; FindFullHashesResponse response;
response.mutable_negative_cache_duration()->set_seconds(600); response.mutable_negative_cache_duration()->set_seconds(600);
......
...@@ -313,7 +313,7 @@ void V4GetHashProtocolManager::GetFullHashesWithApis( ...@@ -313,7 +313,7 @@ void V4GetHashProtocolManager::GetFullHashesWithApis(
DCHECK(url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme)); DCHECK(url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme));
std::unordered_set<FullHash> full_hashes; std::unordered_set<FullHash> full_hashes;
V4ProtocolManagerUtil::UrlToFullHashes(url, &full_hashes); V4ProtocolManagerUtil::UrlToFullHashes(url.GetOrigin(), &full_hashes);
FullHashToStoreAndHashPrefixesMap full_hash_to_store_and_hash_prefixes; FullHashToStoreAndHashPrefixesMap full_hash_to_store_and_hash_prefixes;
for (const FullHash& full_hash : full_hashes) { for (const FullHash& full_hash : full_hashes) {
......
...@@ -165,9 +165,9 @@ class V4GetHashProtocolManager : public net::URLFetcherDelegate, ...@@ -165,9 +165,9 @@ class V4GetHashProtocolManager : public net::URLFetcherDelegate,
full_hash_to_matching_hash_prefixes, full_hash_to_matching_hash_prefixes,
FullHashCallback callback); FullHashCallback callback);
// Retrieve the full hash and API metadata for a URL, and invoke the callback // Retrieve the full hash and API metadata for the origin of |url|, and invoke
// argument when the results are retrieved. The callback may be invoked // the callback argument when the results are retrieved. The callback may be
// synchronously. // invoked synchronously.
// GetFullHashesWithApis is a special case of GetFullHashes. It is here // GetFullHashesWithApis is a special case of GetFullHashes. It is here
// primarily for legacy reasons: so that DatabaseManager, which speaks PVer3, // primarily for legacy reasons: so that DatabaseManager, which speaks PVer3,
// and V4LocalDatabaseManager, which speaks PVer4, can both use this class to // and V4LocalDatabaseManager, which speaks PVer4, can both use this class to
......
...@@ -708,7 +708,7 @@ TEST_F(V4GetHashProtocolManagerTest, TestGetFullHashesWithApisMergesMetadata) { ...@@ -708,7 +708,7 @@ TEST_F(V4GetHashProtocolManagerTest, TestGetFullHashesWithApisMergesMetadata) {
// The following two random looking strings value are two of the full hashes // The following two random looking strings value are two of the full hashes
// produced by UrlToFullHashes in v4_protocol_manager_util.h for the URL: // produced by UrlToFullHashes in v4_protocol_manager_util.h for the URL:
// "https://www.example.com/more" // "https://www.example.com"
std::vector<ResponseInfo> infos; std::vector<ResponseInfo> infos;
FullHash full_hash; FullHash full_hash;
base::Base64Decode("1ZzJ0/7NjPkg6t0DAS8L5Jf7jA48Pn7opQcP4UXYeXc=", base::Base64Decode("1ZzJ0/7NjPkg6t0DAS8L5Jf7jA48Pn7opQcP4UXYeXc=",
...@@ -717,7 +717,7 @@ TEST_F(V4GetHashProtocolManagerTest, TestGetFullHashesWithApisMergesMetadata) { ...@@ -717,7 +717,7 @@ TEST_F(V4GetHashProtocolManagerTest, TestGetFullHashesWithApisMergesMetadata) {
info.key_values.emplace_back("permission", "NOTIFICATIONS"); info.key_values.emplace_back("permission", "NOTIFICATIONS");
infos.push_back(info); infos.push_back(info);
base::Base64Decode("4rPDSdcei1BiCOPnj9kgsy2O6Ua6X3iFBakqphB3ZfA=", base::Base64Decode("c9mG4AkGXxgsELy2pF2z1u2pSY-JMGVK8mU_ipOM2AE=",
&full_hash); &full_hash);
info = ResponseInfo(full_hash, GetChromeUrlApiId()); info = ResponseInfo(full_hash, GetChromeUrlApiId());
info.key_values.emplace_back("permission", "AUDIO_CAPTURE"); info.key_values.emplace_back("permission", "AUDIO_CAPTURE");
......
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