Skip to content

Commit 1133238

Browse files
Aaron Tagliaboschipull[bot]
authored andcommitted
[updater] Fix hardcoded App-ID for Managed Preferences
This is the name of the preferences plist used by the updater to apply on-prem distributed enterprise policies on MacOS. This being hardcoded means that updater embedders might accidentally apply global settings meant for Chrome Updater to updaters for other software. Use `branding.gni` instead. Fixed: 372361350 Change-Id: I2de9b29ec2086804750cbbb2def17779022974c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5962279 Reviewed-by: Joshua Pawlicki <[email protected]> Reviewed-by: Sorin Jianu <[email protected]> Commit-Queue: Joshua Pawlicki <[email protected]> Cr-Commit-Position: refs/heads/main@{#1389012}
1 parent fe2bc7e commit 1133238

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

chrome/updater/policy/mac/managed_preference_policy_manager.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
#include "chrome/updater/constants.h"
1919
#include "chrome/updater/policy/mac/managed_preference_policy_manager_impl.h"
2020
#include "chrome/updater/policy/manager.h"
21+
#include "chrome/updater/updater_branding.h"
2122

2223
namespace {
2324
NSString* const kManagedPreferencesUpdatePolicies = @"updatePolicies";
24-
NSString* const kKeystoneSharedPreferenceSuite = @"com.google.Keystone";
25+
NSString* const kKeystoneSharedPreferenceSuite = @LEGACY_GOOGLE_UPDATE_APPID;
2526
} // namespace
2627

2728
namespace updater {

chrome/updater/test/integration_tests_mac.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ void ExpectLegacyUpdaterMigrated(UpdaterScope scope) {
337337

338338
// Keystone should not be migrated.
339339
EXPECT_FALSE(
340-
persisted_data->GetProductVersion("com.google.keystone").IsValid());
340+
persisted_data->GetProductVersion(LEGACY_GOOGLE_UPDATE_APPID).IsValid());
341341

342342
// Uninstalled app should be migrated.
343343
EXPECT_TRUE(
@@ -410,7 +410,7 @@ void UninstallApp(UpdaterScope scope, const std::string& app_id) {
410410
}
411411

412412
void SetPlatformPolicies(const base::Value::Dict& values) {
413-
const CFStringRef domain = CFSTR("com.google.Keystone");
413+
const CFStringRef domain = CFSTR(LEGACY_GOOGLE_UPDATE_APPID);
414414

415415
// Synchronize just to be safe. Ignore spurious errors if the domain
416416
// does not yet exist.
@@ -436,7 +436,7 @@ void SetPlatformPolicies(const base::Value::Dict& values) {
436436
NSURL* const managed_preferences_url = base::apple::FilePathToNSURL(
437437
GetLibraryFolderPath(UpdaterScope::kSystem)
438438
->AppendASCII("Managed Preferences")
439-
.AppendASCII("com.google.Keystone.plist"));
439+
.AppendASCII(LEGACY_GOOGLE_UPDATE_APPID ".plist"));
440440
ASSERT_TRUE([[NSDictionary dictionaryWithObject:all_policies
441441
forKey:@"updatePolicies"]
442442
writeToURL:managed_preferences_url

0 commit comments

Comments
 (0)