Revert "Only obfuscate profile ID in profile reports for unaffiliated profiles."
This reverts commit 8a1e709e09915e1d1f49620b095ee6ab7972fcff.
Reason for revert: Cause outage for profile reporting.
Original change's description:
> Only obfuscate profile ID in profile reports for unaffiliated profiles.
>
> When profile is affiliated, profile path is no longer considered as
> secret to admins. Provide the real list will help us identify the
> profile instance better.
>
> Bug: None
> Change-Id: I38a8c3e08debbfe9a3b10e528c59d9bbf655d51a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6891395
> Reviewed-by: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
> Commit-Queue: Owen Min <zmin@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1508431}
Bug: 448916151
Change-Id: I7965f05f2b484aced44cab324b3d9048cc3a6e2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7004095
Reviewed-by: Tien Mai <tienmai@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1524406}
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc b/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc
index 104e674..ad4440c 100644
--- a/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc
+++ b/chrome/browser/enterprise/reporting/profile_report_generator_unittest.cc
@@ -264,7 +264,7 @@
report->chrome_signed_in_user().obfuscated_gaia_id());
}
-TEST_F(ProfileReportGeneratorTest, ProfileIdObfuscateByDefault) {
+TEST_F(ProfileReportGeneratorTest, ProfileIdObfuscate) {
base::test::TestFuture<std::unique_ptr<em::ChromeUserProfileInfo>>
test_future;
generator_.MaybeGenerate(profile()->GetPath(), ReportType::kProfileReport,
@@ -297,46 +297,6 @@
EXPECT_NE(report->id(), report3->id());
}
-#if !BUILDFLAG(IS_CHROMEOS)
-
-TEST_F(ProfileReportGeneratorTest, ProfileIdNotObfuscatedInAffiliatedProfile) {
- profile()->GetProfilePolicyConnector()->SetUserAffiliationIdsForTesting(
- {kAffiliationId1});
- g_browser_process->browser_policy_connector()
- ->SetDeviceAffiliatedIdsForTesting({kAffiliationId1});
-
- base::test::TestFuture<std::unique_ptr<em::ChromeUserProfileInfo>>
- test_future;
- generator_.MaybeGenerate(profile()->GetPath(), ReportType::kProfileReport,
- test_future.GetCallback());
-
- auto report = test_future.Take();
- ASSERT_TRUE(report);
- EXPECT_EQ(GetProfileName(), report->name());
- EXPECT_EQ(profile()->GetPath().AsUTF8Unsafe(), report->id());
- EXPECT_TRUE(report->is_detail_available());
-}
-
-TEST_F(ProfileReportGeneratorTest, ProfileIdObfuscatedInUnaffiliatedProfile) {
- profile()->GetProfilePolicyConnector()->SetUserAffiliationIdsForTesting(
- {kAffiliationId1});
- g_browser_process->browser_policy_connector()
- ->SetDeviceAffiliatedIdsForTesting({kAffiliationId2});
-
- base::test::TestFuture<std::unique_ptr<em::ChromeUserProfileInfo>>
- test_future;
- generator_.MaybeGenerate(profile()->GetPath(), ReportType::kProfileReport,
- test_future.GetCallback());
-
- auto report = test_future.Take();
- ASSERT_TRUE(report);
- EXPECT_EQ(GetProfileName(), report->name());
- EXPECT_NE(profile()->GetPath().AsUTF8Unsafe(), report->id());
- EXPECT_TRUE(report->is_detail_available());
-}
-
-#endif // !BUILDFLAG(IS_CHROMEOS)
-
TEST_F(ProfileReportGeneratorTest, PoliciesDisabled) {
// Users' profile info is collected by default.
std::unique_ptr<em::ChromeUserProfileInfo> report = GenerateReport();
diff --git a/components/enterprise/browser/reporting/profile_report_generator.cc b/components/enterprise/browser/reporting/profile_report_generator.cc
index 7adf5f0..6ff8eba 100644
--- a/components/enterprise/browser/reporting/profile_report_generator.cc
+++ b/components/enterprise/browser/reporting/profile_report_generator.cc
@@ -55,23 +55,13 @@
report_ = std::make_unique<em::ChromeUserProfileInfo>();
-#if !BUILDFLAG(IS_CHROMEOS)
- delegate_->GetAffiliationInfo(report_.get());
-#endif
-
switch (report_type) {
- // TODO(crbug.com/441536805): Rename report type `kFull` to `kBrowser`.
+ // TODO(crbug.com/330336666): Rename report type `kFull` to `kBrowser`.
case ReportType::kFull:
report_->set_id(path.AsUTF8Unsafe());
break;
case ReportType::kProfileReport:
- if (report_->has_affiliation() &&
- report_->affiliation().has_is_affiliated() &&
- report_->affiliation().is_affiliated()) {
- report_->set_id(path.AsUTF8Unsafe());
- } else {
- report_->set_id(ObfuscateFilePath(path.AsUTF8Unsafe()));
- }
+ report_->set_id(ObfuscateFilePath(path.AsUTF8Unsafe()));
break;
case ReportType::kBrowserVersion:
NOTREACHED();
@@ -82,6 +72,10 @@
delegate_->GetSigninUserInfo(report_.get());
delegate_->GetProfileName(report_.get());
+#if !BUILDFLAG(IS_CHROMEOS)
+ delegate_->GetAffiliationInfo(report_.get());
+#endif
+
if (extensions_enabled_ &&
(!extensions_enabled_callback_ || extensions_enabled_callback_.Run())) {
delegate_->GetExtensionInfo(report_.get());