-
Notifications
You must be signed in to change notification settings - Fork 239
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
Electron 8 & fix App Store submission #120
Conversation
minor code changes required for uuid, eslint-config-scratch, and uglifyjs-webpack-plugin
Hopefully these will help solve the crash that Mac App Store reviewers are encountering...
Skipping notarization isn't strictly wrong, but needs a big warning since the build probably won't run on Catalina.
apparently the `com.apple.security.app-sandbox` entitlement and the `hardenedRuntime: true` setting are mututally exclusive with `electron-builder`, so the hardened runtime is now only used by non-MAS builds ('mac' but not 'mas' or 'mas-dev')
* | ||
* @param {string} mediaType - one of Electron's media types, like 'microphone' or 'camera' | ||
* @returns {boolean} - true if permission granted, false otherwise. | ||
* @returns {boolean|Promise.<boolean>} - true if permission granted, false otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just always return a promise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about this separately but just to record it here: functionally this is fine because it's called with await
, which hides the difference between returning a promise and returning a raw Boolean. To avoid possible future problems I will make a followup change where this function always returns a promise, especially since there's basically no down-side to doing so in this context. (This isn't performance-critical, no synchronous work is happening around this call, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than the question about the function that returns both a promise and a boolean. Seems like that could cause bugs later.
Regardless, I don't think that question has to block this PR
I wasn't sure who would be best to review this. Please feel free to reassign if you don't have time!
Resolves
Resolves #118
Resolves #119
Proposed Changes
This PR represents a few different changes which ideally would be separated, but because test builds were made with these commits I'm presenting them here as-is.
The most important changes are:
hardenedRuntime: false
to themas
section ofelectron-builder.yaml
to resolve Crashing / no main window for Mac App Store reviewers #118masDev
settings toelectron-builder.yaml
to resolvemas-dev
build won't run due to invalid code signature #119mas-dev
target requires a "Mac Developer" provisioning profile to be placed in thescratch-desktop
directory and namedmacDeveloperThisDevice.provisionprofile
. I chose that file name in the hope that it would be somewhat self-documenting.*.provisionprofile
to.gitignore
Other changes include:
com.apple.security.cs.allow-dyld-environment-variables
andcom.apple.security.device.microphone
to the entitlements for bothmac
andmas
builds.allow-dyld-environment-variables
and Apple documentation seems to suggest thatcom.apple.security.device.microphone
should be present ifcom.apple.security.device.audio-input
is in use.minilog
instead ofconsole.log
for logginguglifyjs
to fix a security complaint fromnpm audit
Reason for Changes
Fixing the
mas-dev
build allowed me to test locally. Primarily this was about adding themasDev
section inelectron-builder.yaml
, but I also needed to buildapp-builder-bin
locally with this as-yet-unreleased change: develar/app-builder#34. These two changes fixed #119, allowing me to reproduce the issue that the Mac App Store reviewers have been reporting.Fixing #118 boiled down to just setting
hardenedRuntime: false
for themas
build, which is sort of embarrassing given how long it has taken to figure out the problem. In essence, it turns out thatelectron-builder
(or one of its dependencies) doesn't work correctly ifhardenedRuntime
is enabled and the app's entitlements list includescom.apple.security.app-sandbox
. The sandbox entitlement is required for Catalina compatibility, so the solution for now (and maybe forever) is to disable the hardened runtime for Mac App Store builds. See electron/electron#22656 for further discussion on this.Test Coverage
There are effectively three things to test:
mac
target): this can be tested withnpm start
or, for a more strict test,npm run dist
.mas
target): we can't really test this locally. We can build it withnpm run dist
to create the build but only Apple can run it.mas-dev
target): adjustscripts/electron-builder-wrapper.js
to buildmas-dev
instead ofmas
and runnpm run dist
, then run the application created indist/mas-dev
.The build process for each of these requires various digital certificates and provisioning profiles, so practically speaking they can only really be done by a member of the Scratch Team.
I have done all three of these things locally and they all work for me. If you'd like to try this out yourself (and you're a Scratch Team member) I'd be happy to help.
Everyone else: hopefully this PR will help us get the Mac App Store version up to date soon!