summaryrefslogtreecommitdiff
path: root/chromium/components/feedback
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 10:22:43 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:36:28 +0000
commit271a6c3487a14599023a9106329505597638d793 (patch)
treee040d58ffc86c1480b79ca8528020ca9ec919bf8 /chromium/components/feedback
parent7b2ffa587235a47d4094787d72f38102089f402a (diff)
downloadqtwebengine-chromium-271a6c3487a14599023a9106329505597638d793.tar.gz
BASELINE: Update Chromium to 77.0.3865.59
Change-Id: I1e89a5f3b009a9519a6705102ad65c92fe736f21 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/components/feedback')
-rw-r--r--chromium/components/feedback/OWNERS3
-rw-r--r--chromium/components/feedback/anonymizer_tool.cc65
-rw-r--r--chromium/components/feedback/anonymizer_tool.h12
-rw-r--r--chromium/components/feedback/anonymizer_tool_unittest.cc305
-rw-r--r--chromium/components/feedback/feedback_uploader_unittest.cc3
-rw-r--r--chromium/components/feedback/system_logs/system_logs_fetcher.cc10
-rw-r--r--chromium/components/feedback/system_logs/system_logs_fetcher.h10
-rw-r--r--chromium/components/feedback/tracing_manager.cc4
-rw-r--r--chromium/components/feedback/tracing_manager.h2
9 files changed, 248 insertions, 166 deletions
diff --git a/chromium/components/feedback/OWNERS b/chromium/components/feedback/OWNERS
index b7d64ae8534..ac4e4a1d0de 100644
--- a/chromium/components/feedback/OWNERS
+++ b/chromium/components/feedback/OWNERS
@@ -1,7 +1,8 @@
afakhry@chromium.org
bsimonnet@chromium.org
+jkardatzke@chromium.org
zork@chromium.org
-per-file anonymizer_tool*=battre@chromium.org
+per-file anonymizer_tool*=jkardatzke@chromium.org
# COMPONENT: Platform>Apps>Feedback
diff --git a/chromium/components/feedback/anonymizer_tool.cc b/chromium/components/feedback/anonymizer_tool.cc
index b5acfd7673c..4f77281552d 100644
--- a/chromium/components/feedback/anonymizer_tool.cc
+++ b/chromium/components/feedback/anonymizer_tool.cc
@@ -57,6 +57,10 @@ constexpr const char* kCustomPatternsWithContext[] = {
// Serial numbers
"(?i-s)(serial\\s*(?:number)?\\s*[:=]\\s*)([0-9a-zA-Z\\-\"]+)()",
+
+ // GAIA IDs
+ R"xxx((\"?\bgaia_id\"?[=:]['\"])(\d+)(\b['\"]))xxx",
+ R"xxx((\{id: )(\d+)(, email:))xxx",
};
bool MaybeUnmapAddress(net::IPAddress* addr) {
@@ -349,8 +353,9 @@ bool FindAndConsumeAndGetSkipped(re2::StringPiece* input,
} // namespace
-AnonymizerTool::AnonymizerTool()
- : custom_patterns_with_context_(base::size(kCustomPatternsWithContext)),
+AnonymizerTool::AnonymizerTool(const char* const* first_party_extension_ids)
+ : first_party_extension_ids_(first_party_extension_ids),
+ custom_patterns_with_context_(base::size(kCustomPatternsWithContext)),
custom_patterns_without_context_(
base::size(kCustomPatternsWithoutContext)) {
DETACH_FROM_SEQUENCE(sequence_checker_);
@@ -473,11 +478,49 @@ std::string AnonymizerTool::AnonymizeCustomPatternWithContext(
return result;
}
-bool WhitelistMatchedId(re2::StringPiece matched_id) {
- bool is_safe_chrome_resource =
- matched_id.starts_with("chrome://resources/") &&
- !matched_id.contains("?");
- return is_safe_chrome_resource;
+// This takes a |url| argument and returns true if the URL is whitelisted and
+// does NOT need to be redacted, returns false otherwise.
+bool IsUrlWhitelisted(re2::StringPiece url,
+ const char* const* first_party_extension_ids) {
+ // We do not whitelist anything with a query parameter.
+ if (url.contains("?"))
+ return false;
+
+ // Check for whitelisting of chrome:// URLs.
+ if (url.starts_with("chrome://")) {
+ // We allow everything in chrome://resources/.
+ if (url.starts_with("chrome://resources/"))
+ return true;
+
+ // We allow chrome://*/crisper.js.
+ if (url.ends_with("/crisper.js"))
+ return true;
+
+ return false;
+ }
+
+ // If the whitelist is null, then don't check it.
+ if (!first_party_extension_ids)
+ return false;
+
+ // Whitelist URLs of the format chrome-extension://<first-party-id>/*.js
+ if (!url.starts_with("chrome-extension://"))
+ return false;
+
+ // These must end with a .js extension.
+ if (!url.ends_with(".js"))
+ return false;
+
+ int i = 0;
+ const char* test_id = first_party_extension_ids[i];
+ const re2::StringPiece url_sub =
+ url.substr(sizeof("chrome-extension://") - 1);
+ while (test_id) {
+ if (url_sub.starts_with(test_id))
+ return true;
+ test_id = first_party_extension_ids[++i];
+ }
+ return false;
}
std::string AnonymizerTool::AnonymizeCustomPatternWithoutContext(
@@ -495,7 +538,7 @@ std::string AnonymizerTool::AnonymizeCustomPatternWithoutContext(
re2::StringPiece skipped;
re2::StringPiece matched_id;
while (FindAndConsumeAndGetSkipped(&text, *re, &skipped, &matched_id)) {
- if (WhitelistMatchedId(matched_id)) {
+ if (IsUrlWhitelisted(matched_id, first_party_extension_ids_)) {
skipped.AppendToString(&result);
matched_id.AppendToString(&result);
continue;
@@ -523,8 +566,10 @@ std::string AnonymizerTool::AnonymizeCustomPatternWithoutContext(
}
AnonymizerToolContainer::AnonymizerToolContainer(
- scoped_refptr<base::SequencedTaskRunner> task_runner)
- : anonymizer_(new AnonymizerTool), task_runner_(task_runner) {}
+ scoped_refptr<base::SequencedTaskRunner> task_runner,
+ const char* const* first_party_extension_ids)
+ : anonymizer_(new AnonymizerTool(first_party_extension_ids)),
+ task_runner_(task_runner) {}
AnonymizerToolContainer::~AnonymizerToolContainer() {
task_runner_->DeleteSoon(FROM_HERE, std::move(anonymizer_));
diff --git a/chromium/components/feedback/anonymizer_tool.h b/chromium/components/feedback/anonymizer_tool.h
index a4e2d3a2b76..9aea4bab5e8 100644
--- a/chromium/components/feedback/anonymizer_tool.h
+++ b/chromium/components/feedback/anonymizer_tool.h
@@ -32,7 +32,10 @@ struct CustomPatternWithoutContext {
class AnonymizerTool {
public:
- AnonymizerTool();
+ // |first_party_extension_ids| is a null terminated array of all the 1st
+ // party extension IDs whose URLs won't be redacted. It is OK to pass null for
+ // that value if it's OK to redact those URLs or they won't be present.
+ AnonymizerTool(const char* const* first_party_extension_ids);
~AnonymizerTool();
// Returns an anonymized version of |input|. PII-sensitive data (such as MAC
@@ -57,6 +60,10 @@ class AnonymizerTool {
const CustomPatternWithoutContext& pattern,
std::map<std::string, std::string>* identifier_space);
+ // Null-terminated list of first party extension IDs. We need to have this
+ // passed into us because we can't refer to the code where these are defined.
+ const char* const* first_party_extension_ids_; // Not owned.
+
// Map of MAC addresses discovered in anonymized strings to anonymized
// representations. 11:22:33:44:55:66 gets anonymized to 11:22:33:00:00:01,
// where the first three bytes represent the manufacturer. The last three
@@ -88,7 +95,8 @@ class AnonymizerToolContainer
: public base::RefCountedThreadSafe<AnonymizerToolContainer> {
public:
explicit AnonymizerToolContainer(
- scoped_refptr<base::SequencedTaskRunner> task_runner);
+ scoped_refptr<base::SequencedTaskRunner> task_runner,
+ const char* const* first_party_extension_ids);
// Returns a pointer to the instance of this anonymier. May only be called
// on |task_runner_|.
diff --git a/chromium/components/feedback/anonymizer_tool_unittest.cc b/chromium/components/feedback/anonymizer_tool_unittest.cc
index c2f9a6e7d44..7a8faecb918 100644
--- a/chromium/components/feedback/anonymizer_tool_unittest.cc
+++ b/chromium/components/feedback/anonymizer_tool_unittest.cc
@@ -10,6 +10,9 @@
namespace feedback {
+const char kFakeFirstPartyID[] = "nkoccljplnhpfnfiajclkommnmllphnl";
+const char* const kFakeFirstPartyExtensionIDs[] = {kFakeFirstPartyID, nullptr};
+
class AnonymizerToolTest : public testing::Test {
protected:
std::string AnonymizeMACAddresses(const std::string& input) {
@@ -35,7 +38,7 @@ class AnonymizerToolTest : public testing::Test {
space);
}
- AnonymizerTool anonymizer_;
+ AnonymizerTool anonymizer_{kFakeFirstPartyExtensionIDs};
};
TEST_F(AnonymizerToolTest, Anonymize) {
@@ -119,6 +122,12 @@ TEST_F(AnonymizerToolTest, AnonymizeCustomPatterns) {
AnonymizeCustomPatterns("SerialNumber: EVT23-17BA01-004"));
EXPECT_EQ("serial=4", AnonymizeCustomPatterns("serial=\"1234AA5678\""));
+ EXPECT_EQ("\"gaia_id\":\"1\"",
+ AnonymizeCustomPatterns("\"gaia_id\":\"1234567890\""));
+ EXPECT_EQ("gaia_id='2'", AnonymizeCustomPatterns("gaia_id='987654321'"));
+ EXPECT_EQ("{id: 1, email:",
+ AnonymizeCustomPatterns("{id: 123454321, email:"));
+
EXPECT_EQ("<email: 1>",
AnonymizeCustomPatterns("foo@bar.com"));
EXPECT_EQ("Email: <email: 1>.",
@@ -203,145 +212,161 @@ TEST_F(AnonymizerToolTest, AnonymizeCustomPatternWithoutContext) {
}
TEST_F(AnonymizerToolTest, AnonymizeChunk) {
- std::string data =
- "aaaaaaaa [SSID=123aaaaaa]aaaaa\n" // SSID.
- "aaaaaaaahttp://tets.comaaaaaaa\n" // URL.
- "aaaaaemail@example.comaaa\n" // Email address.
- "example@@1234\n" // No PII, it is not valid email address.
- "255.255.155.2\n" // IP address.
- "255.255.155.255\n" // IP address.
- "127.0.0.1\n" // IPv4 loopback.
- "127.255.0.1\n" // IPv4 loopback.
- "0.0.0.0\n" // Any IPv4.
- "0.255.255.255\n" // Any IPv4.
- "10.10.10.100\n" // IPv4 private class A.
- "10.10.10.100\n" // Intentional duplicate.
- "10.10.10.101\n" // IPv4 private class A.
- "10.255.255.255\n" // IPv4 private class A.
- "172.16.0.0\n" // IPv4 private class B.
- "172.31.255.255\n" // IPv4 private class B.
- "172.11.5.5\n" // IP address.
- "172.111.5.5\n" // IP address.
- "192.168.0.0\n" // IPv4 private class C.
- "192.168.255.255\n" // IPv4 private class C.
- "192.169.2.120\n" // IP address.
- "169.254.0.1\n" // Link local.
- "169.200.0.1\n" // IP address.
- "fe80::\n" // Link local.
- "fe80::ffff\n" // Link local.
- "febf:ffff::ffff\n" // Link local.
- "fecc::1111\n" // IP address.
- "224.0.0.24\n" // Multicast.
- "240.0.0.0\n" // IP address.
- "255.255.255.255\n" // Broadcast.
- "100.115.92.92\n" // ChromeOS.
- "100.115.91.92\n" // IP address.
- "1.1.1.1\n" // DNS
- "8.8.8.8\n" // DNS
- "8.8.4.4\n" // DNS
- "8.8.8.4\n" // IP address.
- "255.255.259.255\n" // Not an IP address.
- "255.300.255.255\n" // Not an IP address.
- "aaaa123.123.45.4aaa\n" // IP address.
- "11:11;11::11\n" // IP address.
- "11::11\n" // IP address.
- "11:11:abcdef:0:0:0:0:0\n" // No PII.
- "::\n" // Unspecified.
- "::1\n" // Local host.
- "Instance::Set\n" // Ignore match, no PII.
- "Instant::ff\n" // Ignore match, no PII.
- "net::ERR_CONN_TIMEOUT\n" // Ignore match, no PII.
- "ff01::1\n" // All nodes address (interface local).
- "ff01::2\n" // All routers (interface local).
- "ff01::3\n" // Multicast (interface local).
- "ff02::1\n" // All nodes address (link local).
- "ff02::2\n" // All routers (link local).
- "ff02::3\n" // Multicast (link local).
- "ff02::fb\n" // mDNSv6 (link local).
- "ff08::fb\n" // mDNSv6.
- "ff0f::101\n" // All NTP servers.
- "::ffff:cb0c:10ea\n" // IPv4-mapped IPV6 (IP address).
- "::ffff:a0a:a0a\n" // IPv4-mapped IPV6 (private class A).
- "::ffff:a0a:a0a\n" // Intentional duplicate.
- "::ffff:ac1e:1e1e\n" // IPv4-mapped IPV6 (private class B).
- "::ffff:c0a8:640a\n" // IPv4-mapped IPV6 (private class C).
- "::ffff:6473:5c01\n" // IPv4-mapped IPV6 (Chrome).
- "64:ff9b::a0a:a0a\n" // IPv4-translated 6to4 IPV6 (private class A).
- "64:ff9b::6473:5c01\n" // IPv4-translated 6to4 IPV6 (Chrome).
- "::0101:ffff:c0a8:640a\n" // IP address.
- "aa:aa:aa:aa:aa:aa\n" // MAC address (BSSID).
- "chrome://resources/foo\n" // Secure chrome resource, whitelisted.
- "chrome://resources/f?user=bar"; // Potentially PII in parameter.
- std::string result =
- "aaaaaaaa [SSID=1]aaaaa\n"
- "aaaaaaaa<URL: 1>\n"
- "<email: 1>\n"
- "example@@1234\n"
- "<IPv4: 1>\n"
- "<IPv4: 2>\n"
- "<127.0.0.0/8: 3>\n"
- "<127.0.0.0/8: 4>\n"
- "<0.0.0.0/8: 5>\n"
- "<0.0.0.0/8: 6>\n"
- "<10.0.0.0/8: 7>\n"
- "<10.0.0.0/8: 7>\n"
- "<10.0.0.0/8: 8>\n"
- "<10.0.0.0/8: 9>\n"
- "<172.16.0.0/12: 10>\n"
- "<172.16.0.0/12: 11>\n"
- "<IPv4: 12>\n"
- "<IPv4: 13>\n"
- "<192.168.0.0/16: 14>\n"
- "<192.168.0.0/16: 15>\n"
- "<IPv4: 16>\n"
- "<169.254.0.0/16: 17>\n"
- "<IPv4: 18>\n"
- "<fe80::/10: 1>\n"
- "<fe80::/10: 2>\n"
- "<fe80::/10: 3>\n"
- "<IPv6: 4>\n"
- "<224.0.0.0/4: 19>\n"
- "<IPv4: 20>\n"
- "255.255.255.255\n"
- "100.115.92.92\n"
- "<IPv4: 23>\n"
- "1.1.1.1\n"
- "8.8.8.8\n"
- "8.8.4.4\n"
- "<IPv4: 27>\n"
- "255.255.259.255\n"
- "255.300.255.255\n"
- "aaaa<IPv4: 28>aaa\n"
- "11:11;<IPv6: 5>\n"
- "<IPv6: 5>\n"
- "11:11:abcdef:0:0:0:0:0\n"
- "::\n"
- "::1\n"
- "Instance::Set\n"
- "Instant::ff\n"
- "net::ERR_CONN_TIMEOUT\n"
- "ff01::1\n"
- "ff01::2\n"
- "<ff01::/16: 13>\n"
- "ff02::1\n"
- "ff02::2\n"
- "<ff02::/16: 16>\n"
- "<ff02::/16: 17>\n"
- "<IPv6: 18>\n"
- "<IPv6: 19>\n"
- "<IPv6: 20>\n"
- "<M 10.0.0.0/8: 21>\n"
- "<M 10.0.0.0/8: 21>\n"
- "<M 172.16.0.0/12: 22>\n"
- "<M 192.168.0.0/16: 23>\n"
- "<M 100.115.92.1: 24>\n"
- "<T 10.0.0.0/8: 25>\n"
- "<T 100.115.92.1: 26>\n"
- "<IPv6: 27>\n"
- "aa:aa:aa:00:00:01\n"
- "chrome://resources/foo\n"
- "<URL: 2>";
- EXPECT_EQ(result, anonymizer_.Anonymize(data));
+ // For better readability, put all the pre/post redaction strings in an array
+ // of pairs, and then convert that to two strings which become the input and
+ // output of the anonymizer.
+ std::pair<std::string, std::string> data[] = {
+ {"aaaaaaaa [SSID=123aaaaaa]aaaaa", // SSID.
+ "aaaaaaaa [SSID=1]aaaaa"},
+ {"aaaaaaaahttp://tets.comaaaaaaa", // URL.
+ "aaaaaaaa<URL: 1>"},
+ {"aaaaaemail@example.comaaa", // Email address.
+ "<email: 1>"},
+ {"example@@1234", // No PII, it is not invalid email address.
+ "example@@1234"},
+ {"255.255.155.2", // IP address.
+ "<IPv4: 1>"},
+ {"255.255.155.255", // IP address.
+ "<IPv4: 2>"},
+ {"127.0.0.1", // IPv4 loopback.
+ "<127.0.0.0/8: 3>"},
+ {"127.255.0.1", // IPv4 loopback.
+ "<127.0.0.0/8: 4>"},
+ {"0.0.0.0", // Any IPv4.
+ "<0.0.0.0/8: 5>"},
+ {"0.255.255.255", // Any IPv4.
+ "<0.0.0.0/8: 6>"},
+ {"10.10.10.100", // IPv4 private class A.
+ "<10.0.0.0/8: 7>"},
+ {"10.10.10.100", // Intentional duplicate.
+ "<10.0.0.0/8: 7>"},
+ {"10.10.10.101", // IPv4 private class A.
+ "<10.0.0.0/8: 8>"},
+ {"10.255.255.255", // IPv4 private class A.
+ "<10.0.0.0/8: 9>"},
+ {"172.16.0.0", // IPv4 private class B.
+ "<172.16.0.0/12: 10>"},
+ {"172.31.255.255", // IPv4 private class B.
+ "<172.16.0.0/12: 11>"},
+ {"172.11.5.5", // IP address.
+ "<IPv4: 12>"},
+ {"172.111.5.5", // IP address.
+ "<IPv4: 13>"},
+ {"192.168.0.0", // IPv4 private class C.
+ "<192.168.0.0/16: 14>"},
+ {"192.168.255.255", // IPv4 private class C.
+ "<192.168.0.0/16: 15>"},
+ {"192.169.2.120", // IP address.
+ "<IPv4: 16>"},
+ {"169.254.0.1", // Link local.
+ "<169.254.0.0/16: 17>"},
+ {"169.200.0.1", // IP address.
+ "<IPv4: 18>"},
+ {"fe80::", // Link local.
+ "<fe80::/10: 1>"},
+ {"fe80::ffff", // Link local.
+ "<fe80::/10: 2>"},
+ {"febf:ffff::ffff", // Link local.
+ "<fe80::/10: 3>"},
+ {"fecc::1111", // IP address.
+ "<IPv6: 4>"},
+ {"224.0.0.24", // Multicast.
+ "<224.0.0.0/4: 19>"},
+ {"240.0.0.0", // IP address.
+ "<IPv4: 20>"},
+ {"255.255.255.255", // Broadcast.
+ "255.255.255.255"},
+ {"100.115.92.92", // ChromeOS.
+ "100.115.92.92"},
+ {"100.115.91.92", // IP address.
+ "<IPv4: 23>"},
+ {"1.1.1.1", // DNS
+ "1.1.1.1"},
+ {"8.8.8.8", // DNS
+ "8.8.8.8"},
+ {"8.8.4.4", // DNS
+ "8.8.4.4"},
+ {"8.8.8.4", // IP address.
+ "<IPv4: 27>"},
+ {"255.255.259.255", // Not an IP address.
+ "255.255.259.255"},
+ {"255.300.255.255", // Not an IP address.
+ "255.300.255.255"},
+ {"aaaa123.123.45.4aaa", // IP address.
+ "aaaa<IPv4: 28>aaa"},
+ {"11:11;11::11", // IP address.
+ "11:11;<IPv6: 5>"},
+ {"11::11", // IP address.
+ "<IPv6: 5>"},
+ {"11:11:abcdef:0:0:0:0:0", // No PII.
+ "11:11:abcdef:0:0:0:0:0"},
+ {"::", // Unspecified.
+ "::"},
+ {"::1", // Local host.
+ "::1"},
+ {"Instance::Set", // Ignore match, no PII.
+ "Instance::Set"},
+ {"Instant::ff", // Ignore match, no PII.
+ "Instant::ff"},
+ {"net::ERR_CONN_TIMEOUT", // Ignore match, no PII.
+ "net::ERR_CONN_TIMEOUT"},
+ {"ff01::1", // All nodes address (interface local).
+ "ff01::1"},
+ {"ff01::2", // All routers (interface local).
+ "ff01::2"},
+ {"ff01::3", // Multicast (interface local).
+ "<ff01::/16: 13>"},
+ {"ff02::1", // All nodes address (link local).
+ "ff02::1"},
+ {"ff02::2", // All routers (link local).
+ "ff02::2"},
+ {"ff02::3", // Multicast (link local).
+ "<ff02::/16: 16>"},
+ {"ff02::fb", // mDNSv6 (link local).
+ "<ff02::/16: 17>"},
+ {"ff08::fb", // mDNSv6.
+ "<IPv6: 18>"},
+ {"ff0f::101", // All NTP servers.
+ "<IPv6: 19>"},
+ {"::ffff:cb0c:10ea", // IPv4-mapped IPV6 (IP address).
+ "<IPv6: 20>"},
+ {"::ffff:a0a:a0a", // IPv4-mapped IPV6 (private class A).
+ "<M 10.0.0.0/8: 21>"},
+ {"::ffff:a0a:a0a", // Intentional duplicate.
+ "<M 10.0.0.0/8: 21>"},
+ {"::ffff:ac1e:1e1e", // IPv4-mapped IPV6 (private class B).
+ "<M 172.16.0.0/12: 22>"},
+ {"::ffff:c0a8:640a", // IPv4-mapped IPV6 (private class C).
+ "<M 192.168.0.0/16: 23>"},
+ {"::ffff:6473:5c01", // IPv4-mapped IPV6 (Chrome).
+ "<M 100.115.92.1: 24>"},
+ {"64:ff9b::a0a:a0a", // IPv4-translated 6to4 IPV6 (private class A).
+ "<T 10.0.0.0/8: 25>"},
+ {"64:ff9b::6473:5c01", // IPv4-translated 6to4 IPV6 (Chrome).
+ "<T 100.115.92.1: 26>"},
+ {"::0101:ffff:c0a8:640a", // IP address.
+ "<IPv6: 27>"},
+ {"aa:aa:aa:aa:aa:aa", // MAC address (BSSID).
+ "aa:aa:aa:00:00:01"},
+ {"chrome://resources/foo", // Secure chrome resource, whitelisted.
+ "chrome://resources/foo"},
+ {"chrome://settings/crisper.js", // Whitelisted settings URLs.
+ "chrome://settings/crisper.js"},
+ // Whitelisted first party extension.
+ {"chrome-extension://nkoccljplnhpfnfiajclkommnmllphnl/foobar.js",
+ "chrome-extension://nkoccljplnhpfnfiajclkommnmllphnl/foobar.js"},
+ {"chrome://resources/f?user=bar", // Potentially PII in parameter.
+ "<URL: 2>"},
+ {"chrome-extension://nkoccljplnhpfnfiajclkommnmllphnl/foobar.js?bar=x",
+ "<URL: 3>"}, // Potentially PII in parameter.
+ };
+ std::string anon_input;
+ std::string anon_output;
+ for (const auto& s : data) {
+ anon_input.append(s.first).append("\n");
+ anon_output.append(s.second).append("\n");
+ }
+ EXPECT_EQ(anon_output, anonymizer_.Anonymize(anon_input));
}
} // namespace feedback
diff --git a/chromium/components/feedback/feedback_uploader_unittest.cc b/chromium/components/feedback/feedback_uploader_unittest.cc
index 7fa32c2c8db..8fc865f0841 100644
--- a/chromium/components/feedback/feedback_uploader_unittest.cc
+++ b/chromium/components/feedback/feedback_uploader_unittest.cc
@@ -80,8 +80,7 @@ class MockFeedbackUploader : public FeedbackUploader {
// FeedbackUploaderChrome:
void StartDispatchingReport() override {
- if (base::ContainsKey(dispatched_reports_,
- report_being_dispatched()->data()))
+ if (base::Contains(dispatched_reports_, report_being_dispatched()->data()))
dispatched_reports_[report_being_dispatched()->data()]++;
else
dispatched_reports_[report_being_dispatched()->data()] = 1;
diff --git a/chromium/components/feedback/system_logs/system_logs_fetcher.cc b/chromium/components/feedback/system_logs/system_logs_fetcher.cc
index b493738fbc3..62ed817c0dc 100644
--- a/chromium/components/feedback/system_logs/system_logs_fetcher.cc
+++ b/chromium/components/feedback/system_logs/system_logs_fetcher.cc
@@ -46,17 +46,19 @@ void Anonymize(feedback::AnonymizerTool* anonymizer,
} // namespace
-SystemLogsFetcher::SystemLogsFetcher(bool scrub_data)
+SystemLogsFetcher::SystemLogsFetcher(
+ bool scrub_data,
+ const char* const first_party_extension_ids[])
: response_(std::make_unique<SystemLogsResponse>()),
num_pending_requests_(0),
task_runner_for_anonymizer_(base::CreateSequencedTaskRunnerWithTraits(
{// User visible because this is called when the user is looking at
// the send feedback dialog, watching a spinner.
base::TaskPriority::USER_VISIBLE,
- base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})),
- weak_ptr_factory_(this) {
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})) {
if (scrub_data)
- anonymizer_ = std::make_unique<feedback::AnonymizerTool>();
+ anonymizer_ =
+ std::make_unique<feedback::AnonymizerTool>(first_party_extension_ids);
}
SystemLogsFetcher::~SystemLogsFetcher() {
diff --git a/chromium/components/feedback/system_logs/system_logs_fetcher.h b/chromium/components/feedback/system_logs/system_logs_fetcher.h
index 0d821a5ccdb..d6a53943f8f 100644
--- a/chromium/components/feedback/system_logs/system_logs_fetcher.h
+++ b/chromium/components/feedback/system_logs/system_logs_fetcher.h
@@ -43,8 +43,12 @@ using SysLogsFetcherCallback =
// };
class SystemLogsFetcher {
public:
- // If scrub_data is true, logs will be anonymized.
- explicit SystemLogsFetcher(bool scrub_data);
+ // If |scrub_data| is true, logs will be anonymized.
+ // |first_party_extension_ids| is a null terminated array of all the 1st
+ // party extension IDs whose URLs won't be redacted. It is OK to pass null for
+ // that value if it's OK to redact those URLs or they won't be present.
+ explicit SystemLogsFetcher(bool scrub_data,
+ const char* const first_party_extension_ids[]);
~SystemLogsFetcher();
// Adds a source to use when fetching.
@@ -75,7 +79,7 @@ class SystemLogsFetcher {
std::unique_ptr<feedback::AnonymizerTool> anonymizer_;
scoped_refptr<base::SequencedTaskRunner> task_runner_for_anonymizer_;
- base::WeakPtrFactory<SystemLogsFetcher> weak_ptr_factory_;
+ base::WeakPtrFactory<SystemLogsFetcher> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(SystemLogsFetcher);
};
diff --git a/chromium/components/feedback/tracing_manager.cc b/chromium/components/feedback/tracing_manager.cc
index 01049247d92..5019e700e8d 100644
--- a/chromium/components/feedback/tracing_manager.cc
+++ b/chromium/components/feedback/tracing_manager.cc
@@ -23,9 +23,7 @@ const base::FilePath::CharType kTracingFilename[] =
FILE_PATH_LITERAL("tracing.json");
}
-TracingManager::TracingManager()
- : current_trace_id_(0),
- weak_ptr_factory_(this) {
+TracingManager::TracingManager() : current_trace_id_(0) {
DCHECK(!g_tracing_manager);
g_tracing_manager = this;
StartTracing();
diff --git a/chromium/components/feedback/tracing_manager.h b/chromium/components/feedback/tracing_manager.h
index b45d234a4ba..ec1548780b3 100644
--- a/chromium/components/feedback/tracing_manager.h
+++ b/chromium/components/feedback/tracing_manager.h
@@ -71,7 +71,7 @@ class TracingManager {
// Callback for the current trace request.
TraceDataCallback trace_callback_;
- base::WeakPtrFactory<TracingManager> weak_ptr_factory_;
+ base::WeakPtrFactory<TracingManager> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(TracingManager);
};