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

Side by Side Diff: chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.cc

Issue 2971763003: [Merge to M60] Support anonymizer whitelisted UUIDs (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/feedback/system_logs/scrubbed_system_logs_fetcher.h" 5 #include "chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_so urce.h" 11 #include "chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_so urce.h"
12 #include "chrome/browser/feedback/system_logs/log_sources/crash_ids_source.h" 12 #include "chrome/browser/feedback/system_logs/log_sources/crash_ids_source.h"
13 #include "chrome/browser/feedback/system_logs/log_sources/memory_details_log_sou rce.h" 13 #include "chrome/browser/feedback/system_logs/log_sources/memory_details_log_sou rce.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 15
16 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
17 #include "chrome/browser/chromeos/system_logs/command_line_log_source.h" 17 #include "chrome/browser/chromeos/system_logs/command_line_log_source.h"
18 #include "chrome/browser/chromeos/system_logs/dbus_log_source.h" 18 #include "chrome/browser/chromeos/system_logs/dbus_log_source.h"
19 #include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h" 19 #include "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h"
20 #include "chrome/browser/chromeos/system_logs/device_event_log_source.h" 20 #include "chrome/browser/chromeos/system_logs/device_event_log_source.h"
21 #include "chrome/browser/chromeos/system_logs/lsb_release_log_source.h" 21 #include "chrome/browser/chromeos/system_logs/lsb_release_log_source.h"
22 #include "chrome/browser/chromeos/system_logs/touch_log_source.h" 22 #include "chrome/browser/chromeos/system_logs/touch_log_source.h"
23 #endif 23 #endif
24 24
25 using content::BrowserThread; 25 using content::BrowserThread;
26 26
27 namespace system_logs { 27 namespace system_logs {
28 28
29 namespace {
30
31 // List of keys in the SystemLogsResponse map whose corresponding values will
32 // not be anonymized.
33 constexpr const char* const kWhitelistedKeysOfUUIDs[] = {
34 "CHROMEOS_BOARD_APPID", "CHROMEOS_CANARY_APPID", "CHROMEOS_RELEASE_APPID",
35 "CLIENT_ID",
36 };
37
38 // Returns true if the given |key| is anonymizer-whitelisted and whose
39 // corresponding value should not be anonymized.
40 bool IsKeyWhitelisted(const std::string& key) {
41 for (auto* const whitelisted_key : kWhitelistedKeysOfUUIDs) {
42 if (key == whitelisted_key)
43 return true;
44 }
45 return false;
46 }
47
48 } // namespace
49
29 ScrubbedSystemLogsFetcher::ScrubbedSystemLogsFetcher() { 50 ScrubbedSystemLogsFetcher::ScrubbedSystemLogsFetcher() {
30 data_sources_.push_back(base::MakeUnique<ChromeInternalLogSource>()); 51 data_sources_.push_back(base::MakeUnique<ChromeInternalLogSource>());
31 data_sources_.push_back(base::MakeUnique<CrashIdsSource>()); 52 data_sources_.push_back(base::MakeUnique<CrashIdsSource>());
32 data_sources_.push_back(base::MakeUnique<MemoryDetailsLogSource>()); 53 data_sources_.push_back(base::MakeUnique<MemoryDetailsLogSource>());
33 54
34 #if defined(OS_CHROMEOS) 55 #if defined(OS_CHROMEOS)
35 data_sources_.push_back(base::MakeUnique<CommandLineLogSource>()); 56 data_sources_.push_back(base::MakeUnique<CommandLineLogSource>());
36 data_sources_.push_back(base::MakeUnique<DBusLogSource>()); 57 data_sources_.push_back(base::MakeUnique<DBusLogSource>());
37 data_sources_.push_back(base::MakeUnique<DeviceEventLogSource>()); 58 data_sources_.push_back(base::MakeUnique<DeviceEventLogSource>());
38 data_sources_.push_back(base::MakeUnique<LsbReleaseLogSource>()); 59 data_sources_.push_back(base::MakeUnique<LsbReleaseLogSource>());
39 data_sources_.push_back(base::MakeUnique<TouchLogSource>()); 60 data_sources_.push_back(base::MakeUnique<TouchLogSource>());
40 61
41 // Debug Daemon data source - currently only this data source supports 62 // Debug Daemon data source - currently only this data source supports
42 // the scrub_data parameter but all others get processed by Rewrite() 63 // the scrub_data parameter but all others get processed by Rewrite()
43 // as well. 64 // as well.
44 const bool scrub_data = true; 65 const bool scrub_data = true;
45 data_sources_.push_back(base::MakeUnique<DebugDaemonLogSource>(scrub_data)); 66 data_sources_.push_back(base::MakeUnique<DebugDaemonLogSource>(scrub_data));
46 #endif 67 #endif
47 68
48 num_pending_requests_ = data_sources_.size(); 69 num_pending_requests_ = data_sources_.size();
49 } 70 }
50 71
51 ScrubbedSystemLogsFetcher::~ScrubbedSystemLogsFetcher() { 72 ScrubbedSystemLogsFetcher::~ScrubbedSystemLogsFetcher() {
52 } 73 }
53 74
54 void ScrubbedSystemLogsFetcher::Rewrite(const std::string& source_name, 75 void ScrubbedSystemLogsFetcher::Rewrite(const std::string& source_name,
55 SystemLogsResponse* response) { 76 SystemLogsResponse* response) {
56 for (auto& element : *response) 77 for (auto& element : *response) {
57 element.second = anonymizer_.Anonymize(element.second); 78 if (!IsKeyWhitelisted(element.first))
79 element.second = anonymizer_.Anonymize(element.second);
80 }
58 } 81 }
59 82
60 } // namespace system_logs 83 } // namespace system_logs
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698