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

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* const* modules_to_verify,
108 ClientIncidentReport_EnvironmentData_Process* process) {
109 for (; *modules_to_verify; ++modules_to_verify) {
110 std::set<std::string> modified_exports;
111 int modified = VerifyModule(*modules_to_verify, &modified_exports);
112
113 ClientIncidentReport_EnvironmentData_Process_ModuleState* module_state =
114 process->add_module_state();
115
116 module_state->set_name(base::WideToUTF8(std::wstring(*modules_to_verify)));
117 module_state->set_modified_state(
118 static_cast<ClientIncidentReport_EnvironmentData_Process_ModifiedState>(
119 modified));
120 for (std::set<std::string>::iterator it = modified_exports.begin();
121 it != modified_exports.end();
122 ++it) {
123 module_state->add_modified_export(*it);
124 }
125 }
126 }
127
105 void CollectPlatformProcessData( 128 void CollectPlatformProcessData(
106 ClientIncidentReport_EnvironmentData_Process* process) { 129 ClientIncidentReport_EnvironmentData_Process* process) {
107 CollectDlls(process); 130 CollectDlls(process);
108 RecordLspFeature(process); 131 RecordLspFeature(process);
109 CollectDllBlacklistData(process); 132 CollectDllBlacklistData(process);
133 RecordModuleVerificationData(modules_to_verify, process);
grt (UTC plus 2) 2014/08/06 01:28:10 i think it makes sense to put: const wchar_t* cons
grt (UTC plus 2) 2014/08/06 01:28:10 nit: Collect rather than Record. "LspFeature" is a
krstnmnlsn 2014/08/06 21:55:11 Done.
krstnmnlsn 2014/08/06 21:55:11 Done.
110 } 134 }
111 135
112 } // namespace safe_browsing 136 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698