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

Unified Diff: chrome/browser/feedback/system_logs/system_logs_fetcher.cc

Issue 2953353002: Support anonymizer whitelisted UUIDs (Closed)
Patch Set: Created 3 years, 6 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 | « chrome/browser/feedback/system_logs/system_logs_fetcher.h ('k') | 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/system_logs_fetcher.cc
diff --git a/chrome/browser/feedback/system_logs/system_logs_fetcher.cc b/chrome/browser/feedback/system_logs/system_logs_fetcher.cc
index 97dc68983571f9c9a9141a2fb1a49686902b92c5..fe9e2bab09376945dd116d4580763feff1309bd8 100644
--- a/chrome/browser/feedback/system_logs/system_logs_fetcher.cc
+++ b/chrome/browser/feedback/system_logs/system_logs_fetcher.cc
@@ -15,6 +15,29 @@ 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
+
SystemLogsSource::SystemLogsSource(const std::string& source_name)
: source_name_(source_name) {}
@@ -56,8 +79,10 @@ void SystemLogsFetcher::OnFetched(const std::string& source_name,
VLOG(1) << "Received SystemLogSource: " << source_name;
if (anonymizer_) {
- for (auto& element : *response)
- element.second = anonymizer_->Anonymize(element.second);
+ for (auto& element : *response) {
+ if (!IsKeyWhitelisted(element.first))
+ element.second = anonymizer_->Anonymize(element.second);
+ }
}
AddResponse(source_name, response);
}
« no previous file with comments | « chrome/browser/feedback/system_logs/system_logs_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698