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

Side by Side Diff: chrome/browser/safe_browsing/environment_data_collection_win.cc

Issue 440753002: The incident reporting service now calls VerifyModule. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/safe_browsing/environment_data_collection_win.h" 5 #include "chrome/browser/safe_browsing/environment_data_collection_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/win/registry.h" 13 #include "base/win/registry.h"
14 #include "chrome/browser/install_verification/win/module_info.h" 14 #include "chrome/browser/install_verification/win/module_info.h"
15 #include "chrome/browser/install_verification/win/module_verification_common.h" 15 #include "chrome/browser/install_verification/win/module_verification_common.h"
16 #include "chrome/browser/net/service_providers_win.h" 16 #include "chrome/browser/net/service_providers_win.h"
17 #include "chrome/browser/safe_browsing/module_integrity_verifier_win.h"
17 #include "chrome/browser/safe_browsing/path_sanitizer.h" 18 #include "chrome/browser/safe_browsing/path_sanitizer.h"
18 #include "chrome/common/safe_browsing/csd.pb.h" 19 #include "chrome/common/safe_browsing/csd.pb.h"
19 #include "chrome_elf/chrome_elf_constants.h" 20 #include "chrome_elf/chrome_elf_constants.h"
20 21
21 namespace safe_browsing { 22 namespace safe_browsing {
22 23
23 namespace { 24 namespace {
24 25
25 // Helper function for expanding all environment variables in |path|. 26 // Helper function for expanding all environment variables in |path|.
26 std::wstring ExpandEnvironmentVariables(const std::wstring& path) { 27 std::wstring ExpandEnvironmentVariables(const std::wstring& path) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 PathSanitizer path_sanitizer; 96 PathSanitizer path_sanitizer;
96 base::win::RegistryValueIterator iter(HKEY_CURRENT_USER, 97 base::win::RegistryValueIterator iter(HKEY_CURRENT_USER,
97 blacklist::kRegistryFinchListPath); 98 blacklist::kRegistryFinchListPath);
98 for (; iter.Valid(); ++iter) { 99 for (; iter.Valid(); ++iter) {
99 base::FilePath dll_name(iter.Value()); 100 base::FilePath dll_name(iter.Value());
100 path_sanitizer.StripHomeDirectory(&dll_name); 101 path_sanitizer.StripHomeDirectory(&dll_name);
101 process->add_blacklisted_dll(dll_name.AsUTF8Unsafe()); 102 process->add_blacklisted_dll(dll_name.AsUTF8Unsafe());
102 } 103 }
103 } 104 }
104 105
106 void RecordModuleVerificationData(
107 const wchar_t* modules_to_verify[],
108 ClientIncidentReport_EnvironmentData_Process* process) {
109
110 for (int i = 0; modules_to_verify[i] != NULL; ++i) {
grt (UTC plus 2) 2014/08/05 16:04:54 i'm included to say int -> size_t here since the s
krstnmnlsn 2014/08/05 23:07:25 That is super neat.
111 std::set<std::string> modified_exports;
112 int modified =
113 safe_browsing::VerifyModule(modules_to_verify[i], &modified_exports);
grt (UTC plus 2) 2014/08/05 16:04:54 nit: omit "safe_browsing::"
krstnmnlsn 2014/08/05 23:07:25 Done.
114
115 ClientIncidentReport_EnvironmentData_Process_ModuleState* module_state =
116 process->add_module_state();
117
118 module_state->set_name(
119 base::WideToUTF8(std::wstring(modules_to_verify[i])));
120 module_state->set_modified_state(modified);
121 for (std::set<std::string>::iterator it = modified_exports.begin();
122 it != modified_exports.end();
123 ++it) {
124 module_state->add_modified_export(*it);
125 }
126 }
127 }
128
105 void CollectPlatformProcessData( 129 void CollectPlatformProcessData(
106 ClientIncidentReport_EnvironmentData_Process* process) { 130 ClientIncidentReport_EnvironmentData_Process* process) {
107 CollectDlls(process); 131 CollectDlls(process);
108 RecordLspFeature(process); 132 RecordLspFeature(process);
109 CollectDllBlacklistData(process); 133 CollectDllBlacklistData(process);
134 RecordModuleVerificationData(safe_browsing::modules_to_verify, process);
grt (UTC plus 2) 2014/08/05 16:04:54 nit: omit "safe_browsing::"
krstnmnlsn 2014/08/05 23:07:25 Done.
110 } 135 }
111 136
112 } // namespace safe_browsing 137 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698