Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use different key name for brave channel name in MacOS #2634

Merged
merged 1 commit into from
Jun 7, 2019

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Jun 7, 2019

After recent chromium bumping, KSChannelID is disappeared.
This is strange because we add that key by brave_app_plist.
I suspect chromium code could remove that key from Info.plist because
we use same key name with chrome's KeystoneRegistration.framework and chrome_app_plist
target has code that removes that key from Info.plist.
In theory, I think chrome_app_plist could not remove it because chrome_app_list
is evaluated first and then brave_app_plist is evaluated.

This PR is workaround by using another key name and I think using different key name is more safer.

Fix brave/brave-browser#4753

Submitter Checklist:

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

After recent chromium bumping, KSChannelID is disappeared.
This is strange because we add that key by `brave_app_plist`.
I suspect chromium code could remove that key from Info.plist because
we use same key name with chrome's KeystoneRegistraion and `chrome_app_plist`
target has code that removes that key from Info.plist.
In theory, I think `chrome_app_plist` could not remove it because `chrome_app_list`
is evaluated first and then `brave_app_plist` is evaluated.

This PR is workaround by using another key name.
@simonhong simonhong added this to the 0.68.x - Nightly milestone Jun 7, 2019
@simonhong simonhong requested review from bsclifton and mkarolin June 7, 2019 07:28
@simonhong simonhong self-assigned this Jun 7, 2019
@simonhong
Copy link
Member Author

simonhong commented Jun 7, 2019

@mkarolin
Copy link
Collaborator

mkarolin commented Jun 7, 2019

@simonhong, I wonder if this is related to https://cs.chromium.org/chromium/src/chrome/installer/mac/keystone_install.sh.

In chrome/installer/mac/BUILD.gn it's being included only for chrome branded builds:
if (is_chrome_branded) { sources += [ "keystone_install.sh" ] }

which is why in the new signing script I patched it out:
https://github.com/brave/brave-core/blob/master/patches/chrome-installer-mac-signing-pipeline.py.patch, but perhaps we need it as well. Though I didn't see us patch keystone_isntall.sh before and it seems pretty specific to Chrome.

@simonhong
Copy link
Member Author

simonhong commented Jun 7, 2019

@mkarolin I think keystone_install.sh is not related with this. It doesn't touch KSChannelID.

I found one place that can remove KSChannelID - https://cs.chromium.org/chromium/src/chrome/installer/mac/signing/modification.py?type=cs&q=KSChannelID&sq=package:chromium&g=0&l=62
this modification.py acts during our mac signing?

However, still curious because above unsigned dmg I downloaded from CI also doesn't have KSChannelID key in Info.plist.

@mkarolin
Copy link
Collaborator

mkarolin commented Jun 7, 2019

@simonhong, you are correct, @bsclifton and I have been looking into keystone_install.sh and it appears to be unrelated (and not needed for us).

I have been looking into KSChannelID and I see our tweak being called in BUILD.gn and is writing out in src/out/Release/gen/brave/brave_app_plist_tweaked.plist with the correct KSChannelID. I haven't traced what happens to it after that yet.

@simonhong
Copy link
Member Author

Do you agree using our own key name is more safer to avoid conflicting with chromium's?

@bsclifton
Copy link
Member

This is interesting and the fix looks good-
Checking what the behavior is on Windows...

@simonhong
Copy link
Member Author

@bsclifton This is not related with Windows. only changed bundle's Info.plist.

@mkarolin
Copy link
Collaborator

mkarolin commented Jun 7, 2019

I think it's fine since there are references in the code that only "keystone enabled" builds should have KS channel and they seem to be putting all related code under #if defined(GOOGLE_CHROME_BUILD).

I also verified that modification.py is removing KSChannelID because the config that I created in brave/build/mac/sign_brave.py doesn't have a distribution with channel set. We'd have to add something like

@property
  def distributions(self):
         return [model.Distribution("channel_name")]

to keep KSChannelD.

@bsclifton
Copy link
Member

bsclifton commented Jun 7, 2019

@mkarolin ah - nice to know the root cause 😄
@simonhong yep- definitely know this is not impacting Windows, but was curious how that code path looked. I hadn't really noticed this before! 😄

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 😄

@simonhong
Copy link
Member Author

Many thanks for checking this together @bsclifton @mkarolin !!

@simonhong simonhong merged commit 4def137 into master Jun 7, 2019
@simonhong simonhong deleted the brave_channel_id_macos branch June 7, 2019 22:11
@mkarolin
Copy link
Collaborator

mkarolin commented Jun 7, 2019

Thanks for figuring it all out, @simonhong. Great insight!

@bsclifton
Copy link
Member

@simonhong as you mentioned yesterday, I think we'll need to uplift back to release channel - can you create those? 😄

@simonhong
Copy link
Member Author

@bsclifton Done. sir!

@bsclifton bsclifton added this to the 0.68.x - Nightly milestone Jun 13, 2019
@bridiver
Copy link
Collaborator

This change is not correct and breaks crash reporting because all channels will be reported as release. I'm working on a fix right now to go back to KSChannelID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Channel name doesn't have channel string in chrome://settings/help
4 participants