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

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

Issue 346763003: Adding blacklisted dlls to safe browsing incident reports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@updatedWard2
Patch Set: rebasing again... Created 6 years, 5 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 "chrome/browser/install_verification/win/module_info.h" 14 #include "chrome/browser/install_verification/win/module_info.h"
14 #include "chrome/browser/install_verification/win/module_verification_common.h" 15 #include "chrome/browser/install_verification/win/module_verification_common.h"
15 #include "chrome/browser/net/service_providers_win.h" 16 #include "chrome/browser/net/service_providers_win.h"
16 #include "chrome/browser/safe_browsing/path_sanitizer.h" 17 #include "chrome/browser/safe_browsing/path_sanitizer.h"
17 #include "chrome/common/safe_browsing/csd.pb.h" 18 #include "chrome/common/safe_browsing/csd.pb.h"
19 #include "chrome_elf/chrome_elf_constants.h"
18 20
19 namespace safe_browsing { 21 namespace safe_browsing {
20 22
21 namespace { 23 namespace {
22 24
23 // Helper function for expanding all environment variables in |path|. 25 // Helper function for expanding all environment variables in |path|.
24 std::wstring ExpandEnvironmentVariables(const std::wstring& path) { 26 std::wstring ExpandEnvironmentVariables(const std::wstring& path) {
25 static const DWORD kMaxBuffer = 32 * 1024; // Max according to MSDN. 27 static const DWORD kMaxBuffer = 32 * 1024; // Max according to MSDN.
26 std::wstring path_expanded; 28 std::wstring path_expanded;
27 DWORD path_len = MAX_PATH; 29 DWORD path_len = MAX_PATH;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 83
82 // Look for a match between LSPs and loaded dlls. 84 // Look for a match between LSPs and loaded dlls.
83 for (int i = 0; i < process->dll_size(); ++i) { 85 for (int i = 0; i < process->dll_size(); ++i) {
84 if (lsp_paths.count(base::UTF8ToWide(process->dll(i).path()))) { 86 if (lsp_paths.count(base::UTF8ToWide(process->dll(i).path()))) {
85 process->mutable_dll(i) 87 process->mutable_dll(i)
86 ->add_feature(ClientIncidentReport_EnvironmentData_Process_Dll::LSP); 88 ->add_feature(ClientIncidentReport_EnvironmentData_Process_Dll::LSP);
87 } 89 }
88 } 90 }
89 } 91 }
90 92
93 void CollectDllBlacklistData(
94 ClientIncidentReport_EnvironmentData_Process* process) {
95 PathSanitizer path_sanitizer;
96 base::win::RegistryValueIterator iter(HKEY_CURRENT_USER,
97 blacklist::kRegistryFinchListPath);
98 for (; iter.Valid(); ++iter) {
99 base::FilePath dll_name(iter.Value());
100 path_sanitizer.StripHomeDirectory(&dll_name);
101 process->add_blacklisted_dll(dll_name.AsUTF8Unsafe());
102 }
103 }
104
91 void CollectPlatformProcessData( 105 void CollectPlatformProcessData(
92 ClientIncidentReport_EnvironmentData_Process* process) { 106 ClientIncidentReport_EnvironmentData_Process* process) {
93 CollectDlls(process); 107 CollectDlls(process);
94 RecordLspFeature(process); 108 RecordLspFeature(process);
109 CollectDllBlacklistData(process);
95 } 110 }
96 111
97 } // namespace safe_browsing 112 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698