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

Unified Diff: components/safe_browsing_db/v4_local_database_manager.cc

Issue 2577963004: Correctly hash the input of MatchModuleWhitelistString() in pver4. (Closed)
Patch Set: Created 4 years 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: components/safe_browsing_db/v4_local_database_manager.cc
diff --git a/components/safe_browsing_db/v4_local_database_manager.cc b/components/safe_browsing_db/v4_local_database_manager.cc
index 45748e4601eec7353fc74d4d88140c1aaccc994e..5bc0b30a92bf4c782d3d563c54def1daed23ee53 100644
--- a/components/safe_browsing_db/v4_local_database_manager.cc
+++ b/components/safe_browsing_db/v4_local_database_manager.cc
@@ -17,6 +17,7 @@
#include "components/safe_browsing_db/v4_feature_list.h"
#include "components/safe_browsing_db/v4_protocol_manager_util.h"
#include "content/public/browser/browser_thread.h"
+#include "crypto/sha2.h"
using content::BrowserThread;
using base::TimeTicks;
@@ -304,16 +305,16 @@ bool V4LocalDatabaseManager::MatchMalwareIP(const std::string& ip_address) {
}
bool V4LocalDatabaseManager::MatchModuleWhitelistString(
- const std::string& str) {
+ const std::string& module_filename) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
if (!enabled_ || !v4_database_) {
- // To make sure we are conservative we return true.
+ // Fail open: Whitelist everything
return true;
}
+ FullHash hash = crypto::SHA256HashString(module_filename);
return HandleHashSynchronously(
- str, StoresToCheck({GetChromeFilenameClientIncidentId()}));
+ hash, StoresToCheck({GetChromeFilenameClientIncidentId()}));
}
ThreatSource V4LocalDatabaseManager::GetThreatSource() const {

Powered by Google App Engine
This is Rietveld 408576698