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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database.h

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: Address review comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 const std::vector<SBChunkDelete>& chunk_deletes) = 0; 157 const std::vector<SBChunkDelete>& chunk_deletes) = 0;
158 virtual void UpdateFinished(bool update_succeeded) = 0; 158 virtual void UpdateFinished(bool update_succeeded) = 0;
159 159
160 // Store the results of a GetHash response. In the case of empty results, we 160 // Store the results of a GetHash response. In the case of empty results, we
161 // cache the prefixes until the next update so that we don't have to issue 161 // cache the prefixes until the next update so that we don't have to issue
162 // further GetHash requests we know will be empty. 162 // further GetHash requests we know will be empty.
163 virtual void CacheHashResults( 163 virtual void CacheHashResults(
164 const std::vector<SBPrefix>& prefixes, 164 const std::vector<SBPrefix>& prefixes,
165 const std::vector<SBFullHashResult>& full_hits) = 0; 165 const std::vector<SBFullHashResult>& full_hits) = 0;
166 166
167 virtual bool MalwareIPMatchKillSwitchOn() = 0;
168
167 // The name of the bloom-filter file for the given database file. 169 // The name of the bloom-filter file for the given database file.
168 // NOTE(shess): OBSOLETE. Present for deleting stale files. 170 // NOTE(shess): OBSOLETE. Present for deleting stale files.
169 static base::FilePath BloomFilterForFilename( 171 static base::FilePath BloomFilterForFilename(
170 const base::FilePath& db_filename); 172 const base::FilePath& db_filename);
171 173
172 // The name of the prefix set file for the given database file. 174 // The name of the prefix set file for the given database file.
173 static base::FilePath PrefixSetForFilename(const base::FilePath& db_filename); 175 static base::FilePath PrefixSetForFilename(const base::FilePath& db_filename);
174 176
175 // Filename for malware and phishing URL database. 177 // Filename for malware and phishing URL database.
176 static base::FilePath BrowseDBFilename( 178 static base::FilePath BrowseDBFilename(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) OVERRIDE; 273 virtual bool UpdateStarted(std::vector<SBListChunkRanges>* lists) OVERRIDE;
272 virtual void InsertChunks(const std::string& list_name, 274 virtual void InsertChunks(const std::string& list_name,
273 const SBChunkList& chunks) OVERRIDE; 275 const SBChunkList& chunks) OVERRIDE;
274 virtual void DeleteChunks( 276 virtual void DeleteChunks(
275 const std::vector<SBChunkDelete>& chunk_deletes) OVERRIDE; 277 const std::vector<SBChunkDelete>& chunk_deletes) OVERRIDE;
276 virtual void UpdateFinished(bool update_succeeded) OVERRIDE; 278 virtual void UpdateFinished(bool update_succeeded) OVERRIDE;
277 virtual void CacheHashResults( 279 virtual void CacheHashResults(
278 const std::vector<SBPrefix>& prefixes, 280 const std::vector<SBPrefix>& prefixes,
279 const std::vector<SBFullHashResult>& full_hits) OVERRIDE; 281 const std::vector<SBFullHashResult>& full_hits) OVERRIDE;
280 282
283 // Returns the value of malware_kill_switch_;
284 virtual bool MalwareIPMatchKillSwitchOn() OVERRIDE;
285
281 private: 286 private:
282 friend class SafeBrowsingDatabaseTest; 287 friend class SafeBrowsingDatabaseTest;
283 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, HashCaching); 288 FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseTest, HashCaching);
284 289
285 // A SafeBrowsing whitelist contains a list of whitelisted full-hashes (stored 290 // A SafeBrowsing whitelist contains a list of whitelisted full-hashes (stored
286 // in a sorted vector) as well as a boolean flag indicating whether all 291 // in a sorted vector) as well as a boolean flag indicating whether all
287 // lookups in the whitelist should be considered matches for safety. 292 // lookups in the whitelist should be considered matches for safety.
288 typedef std::pair<std::vector<SBFullHash>, bool> SBWhitelist; 293 typedef std::pair<std::vector<SBFullHash>, bool> SBWhitelist;
289 294
290 // Returns true if the whitelist is disabled or if any of the given hashes 295 // Returns true if the whitelist is disabled or if any of the given hashes
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 SafeBrowsingStore* store, 347 SafeBrowsingStore* store,
343 SBWhitelist* whitelist); 348 SBWhitelist* whitelist);
344 349
345 // Used to verify that various calls are made from the thread the 350 // Used to verify that various calls are made from the thread the
346 // object was created on. 351 // object was created on.
347 base::MessageLoop* creation_loop_; 352 base::MessageLoop* creation_loop_;
348 353
349 // Lock for protecting access to variables that may be used on the 354 // Lock for protecting access to variables that may be used on the
350 // IO thread. This includes |prefix_set_|, |full_browse_hashes_|, 355 // IO thread. This includes |prefix_set_|, |full_browse_hashes_|,
351 // |pending_browse_hashes_|, |prefix_miss_cache_|, |csd_whitelist_|, 356 // |pending_browse_hashes_|, |prefix_miss_cache_|, |csd_whitelist_|,
352 // and |csd_whitelist_all_urls_|. 357 // and |malware_kill_switch_|.
353 base::Lock lookup_lock_; 358 base::Lock lookup_lock_;
354 359
355 // Underlying persistent store for chunk data. 360 // Underlying persistent store for chunk data.
356 // For browsing related (phishing and malware URLs) chunks and prefixes. 361 // For browsing related (phishing and malware URLs) chunks and prefixes.
357 base::FilePath browse_filename_; 362 base::FilePath browse_filename_;
358 scoped_ptr<SafeBrowsingStore> browse_store_; 363 scoped_ptr<SafeBrowsingStore> browse_store_;
359 364
360 // For download related (download URL and binary hash) chunks and prefixes. 365 // For download related (download URL and binary hash) chunks and prefixes.
361 base::FilePath download_filename_; 366 base::FilePath download_filename_;
362 scoped_ptr<SafeBrowsingStore> download_store_; 367 scoped_ptr<SafeBrowsingStore> download_store_;
363 368
364 // For the client-side phishing detection whitelist chunks and full-length 369 // For the client-side phishing detection whitelist chunks and full-length
365 // hashes. This list only contains 256 bit hashes. 370 // hashes. This list only contains 256 bit hashes.
366 base::FilePath csd_whitelist_filename_; 371 base::FilePath csd_whitelist_filename_;
367 scoped_ptr<SafeBrowsingStore> csd_whitelist_store_; 372 scoped_ptr<SafeBrowsingStore> csd_whitelist_store_;
368 373
369 // For the download whitelist chunks and full-length hashes. This list only 374 // For the download whitelist chunks and full-length hashes. This list only
370 // contains 256 bit hashes. 375 // contains 256 bit hashes.
371 base::FilePath download_whitelist_filename_; 376 base::FilePath download_whitelist_filename_;
372 scoped_ptr<SafeBrowsingStore> download_whitelist_store_; 377 scoped_ptr<SafeBrowsingStore> download_whitelist_store_;
373 378
374 // For extension IDs. 379 // For extension IDs.
375 base::FilePath extension_blacklist_filename_; 380 base::FilePath extension_blacklist_filename_;
376 scoped_ptr<SafeBrowsingStore> extension_blacklist_store_; 381 scoped_ptr<SafeBrowsingStore> extension_blacklist_store_;
377 382
378 SBWhitelist csd_whitelist_; 383 SBWhitelist csd_whitelist_;
379 SBWhitelist download_whitelist_; 384 SBWhitelist download_whitelist_;
380 SBWhitelist extension_blacklist_; 385 SBWhitelist extension_blacklist_;
386 bool malware_kill_switch_;
mattm 2013/05/15 07:12:38 more specific name of this too
kewang 2013/05/15 13:45:07 Done.
381 387
382 // Cached browse store related full-hash items, ordered by prefix for 388 // Cached browse store related full-hash items, ordered by prefix for
383 // efficient scanning. 389 // efficient scanning.
384 // |full_browse_hashes_| are items from |browse_store_|, 390 // |full_browse_hashes_| are items from |browse_store_|,
385 // |pending_browse_hashes_| are items from |CacheHashResults()|, which 391 // |pending_browse_hashes_| are items from |CacheHashResults()|, which
386 // will be pushed to the store on the next update. 392 // will be pushed to the store on the next update.
387 std::vector<SBAddFullHash> full_browse_hashes_; 393 std::vector<SBAddFullHash> full_browse_hashes_;
388 std::vector<SBAddFullHash> pending_browse_hashes_; 394 std::vector<SBAddFullHash> pending_browse_hashes_;
389 395
390 // Cache of prefixes that returned empty results (no full hash 396 // Cache of prefixes that returned empty results (no full hash
(...skipping 12 matching lines...) Expand all
403 // Set to true if any chunks are added or deleted during an update. 409 // Set to true if any chunks are added or deleted during an update.
404 // Used to optimize away database update. 410 // Used to optimize away database update.
405 bool change_detected_; 411 bool change_detected_;
406 412
407 // Used to check if a prefix was in the database. 413 // Used to check if a prefix was in the database.
408 base::FilePath prefix_set_filename_; 414 base::FilePath prefix_set_filename_;
409 scoped_ptr<safe_browsing::PrefixSet> prefix_set_; 415 scoped_ptr<safe_browsing::PrefixSet> prefix_set_;
410 }; 416 };
411 417
412 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_ 418 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698