Skip to content

Commit e3b2ae8

Browse files
pztaloncopybara-github
authored andcommitted
wrap the privileged helper executable identifier string in quotes
The browser's Info.plist contains the bundle id of the updater's privileged helper; in cases where the bundle id contains non-alphanumeric non-period characters (e.g. a hyphen) it must be enclosed by double quotes - otherwise the browser cannot launch the privileged helper. This adds the required quotes. See documentation here: https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html Change-Id: I429e15cae2659324496da5a62ea4154e89eb5506 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7168963 Reviewed-by: Mark Mentovai <[email protected]> Commit-Queue: Joshua Pawlicki <[email protected]> Reviewed-by: Joshua Pawlicki <[email protected]> Cr-Commit-Position: refs/heads/main@{#1548372} NOKEYCHECK=True GitOrigin-RevId: accf9ff7d8a27c96102f2a69d09695d86d588b55
1 parent c46435f commit e3b2ae8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

apple/tweak_info_plist.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ def _RemoveBreakpadKeys(plist):
189189
'BreakpadSendAndExit', 'BreakpadSkipConfirm')
190190

191191

192+
def _IsValidBundleId(bundle_identifier):
193+
# Based on apple developer documentation, see
194+
# https://developer.apple.com/documentation/bundleresources/information-property-list/cfbundleidentifier
195+
return re.match(r'^[0-9a-zA-Z-.]+$', bundle_identifier) is not None
196+
197+
192198
def _TagSuffixes():
193199
# Keep this list sorted in the order that tag suffix components are to
194200
# appear in a tag value. That is to say, it should be sorted per ASCII.
@@ -248,7 +254,7 @@ def _RemoveGTMKeys(plist):
248254

249255
def _AddPrivilegedHelperId(plist, privileged_helper_id):
250256
plist['SMPrivilegedExecutables'] = {
251-
privileged_helper_id: 'identifier ' + privileged_helper_id
257+
privileged_helper_id: f'identifier "{privileged_helper_id}"'
252258
}
253259

254260

@@ -415,6 +421,9 @@ def Main(argv):
415421
if options.bundle_identifier is None:
416422
print('Use of Keystone requires the bundle id.', file=sys.stderr)
417423
return 1
424+
if not _IsValidBundleId(options.bundle_identifier):
425+
print(f'Invalid bundle id: {options.bundle_identifier}', file=sys.stderr)
426+
return 1
418427
_AddKeystoneKeys(plist, options.bundle_identifier,
419428
options.keystone_base_tag)
420429
else:
@@ -432,6 +441,10 @@ def Main(argv):
432441

433442
# Add SMPrivilegedExecutables keys.
434443
if options.privileged_helper_id:
444+
if not _IsValidBundleId(options.privileged_helper_id):
445+
print(f'Invalid privileged helper id: {options.privileged_helper_id}',
446+
file=sys.stderr)
447+
return 1
435448
_AddPrivilegedHelperId(plist, options.privileged_helper_id)
436449
else:
437450
_RemovePrivilegedHelperId(plist)

0 commit comments

Comments
 (0)