Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1612)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database.cc

Issue 14999008: Add a killswitch for CSD malware IP match and report feature. Use a new killswitch whitelist URL wh… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_database.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index c969b66ce3a63dea81a5122916b6f311517895a4..44dd3b7b7c1d66283b5d5dd661288bb9b8afe8dc 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -67,6 +67,12 @@ const size_t kMaxWhitelistSize = 5000;
const char kWhitelistKillSwitchUrl[] =
"sb-ssl.google.com/safebrowsing/csd/killswitch"; // Don't change this!
+// If the hash of this exact expression is on a whitelist then the
+// malware IP blacklisting feature will be disabled in csd.
+// Don't change this!
+const char kMalwareIPKillSwitchUrl[] =
+ "sb-ssl.google.com/safebrowsing/csd/killswitch_malware";
+
// To save space, the incoming |chunk_id| and |list_id| are combined
// into an |encoded_chunk_id| for storage by shifting the |list_id|
// into the low-order bits. These functions decode that information.
@@ -427,6 +433,7 @@ SafeBrowsingDatabaseNew::SafeBrowsingDatabaseNew()
download_store_(NULL),
csd_whitelist_store_(NULL),
download_whitelist_store_(NULL),
+ malware_kill_switch_(false),
reset_factory_(this),
corruption_detected_(false),
change_detected_(false) {
@@ -1424,4 +1431,17 @@ void SafeBrowsingDatabaseNew::LoadWhitelist(
whitelist->second = false;
whitelist->first.swap(new_whitelist);
}
+
+ crypto::SHA256HashString(kMalwareIPKillSwitchUrl, &kill_switch,
+ sizeof(kill_switch));
+ if (std::binary_search(new_whitelist.begin(), new_whitelist.end(),
+ kill_switch)) {
+ // Turn on the malware IP matching kill switch
+ base::AutoLock locked(lookup_lock_);
+ malware_kill_switch_ = true;
+ } else {
+ // Turn off the malware IP matching kill switch
+ base::AutoLock locked(lookup_lock_);
+ malware_kill_switch_ = false;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698