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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.cc
diff --git a/chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.cc b/chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.cc
index aaac91d12c4d27f318e4730e43d3ba634e822ecd..4a8de6c054a3d31c2a71fe7b8a6429f6dd9b83ce 100644
--- a/chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.cc
+++ b/chrome/browser/feedback/system_logs/scrubbed_system_logs_fetcher.cc
@@ -26,6 +26,27 @@ using content::BrowserThread;
namespace system_logs {
+namespace {
+
+// List of keys in the SystemLogsResponse map whose corresponding values will
+// not be anonymized.
+constexpr const char* const kWhitelistedKeysOfUUIDs[] = {
+ "CHROMEOS_BOARD_APPID", "CHROMEOS_CANARY_APPID", "CHROMEOS_RELEASE_APPID",
+ "CLIENT_ID",
+};
+
+// Returns true if the given |key| is anonymizer-whitelisted and whose
+// corresponding value should not be anonymized.
+bool IsKeyWhitelisted(const std::string& key) {
+ for (auto* const whitelisted_key : kWhitelistedKeysOfUUIDs) {
+ if (key == whitelisted_key)
+ return true;
+ }
+ return false;
+}
+
+} // namespace
+
ScrubbedSystemLogsFetcher::ScrubbedSystemLogsFetcher() {
data_sources_.push_back(base::MakeUnique<ChromeInternalLogSource>());
data_sources_.push_back(base::MakeUnique<CrashIdsSource>());
@@ -53,8 +74,10 @@ ScrubbedSystemLogsFetcher::~ScrubbedSystemLogsFetcher() {
void ScrubbedSystemLogsFetcher::Rewrite(const std::string& source_name,
SystemLogsResponse* response) {
- for (auto& element : *response)
- element.second = anonymizer_.Anonymize(element.second);
+ for (auto& element : *response) {
+ if (!IsKeyWhitelisted(element.first))
+ element.second = anonymizer_.Anonymize(element.second);
+ }
}
} // namespace system_logs
« 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