fix(mac): use correct MAS options in signApp() for Mac App Store builds. Closes #9507#9508
fix(mac): use correct MAS options in signApp() for Mac App Store builds. Closes #9507#9508abergs wants to merge 1 commit intoelectron-userland:masterfrom
Conversation
When building for MAS, signApp() was always passing null for masOptions to sign(), causing it to use Darwin (Developer ID) settings instead of MAS settings. This resulted in wrong provisioning profiles and certificate types being used. The fix detects MAS builds via packContext.electronPlatformName and constructs the appropriate MAS options before calling sign(). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
| if (isMas) { | ||
| masOptions = deepAssign({}, this.platformSpecificBuildOptions, this.config.mas) | ||
| // Check if this is a mas-dev build | ||
| const isMasDev = packContext.targets.some(t => t.name === "mas-dev") |
There was a problem hiding this comment.
I think this might backfire since we're using some.
signApp is supposed to be per-target, so an invocation of it could be from a t.name: mas, then a 2nd invocation of it could be t.name: mas-dev. With this current logic, type: development would be set on both invocations.
There was a problem hiding this comment.
Even though I don't necessarily like this specific PR over #9509, but would it be more appropriate to use packContext.electronPlatformName? Tried to grep through and I don't think electronPlatforname necesarily support mas-dev, only mas.
Actually. looking at the code again it seems siSignAfterPack also has a platformSpecificBuildOptions argument with a .target. Perhaps we could feed that through to signApp
Thanks for being an excellent tourist 🙂 |
|
I'm going to pick this up in the larger logic split in #9567 |
This PR tries to fix #9507
I've tried this code on the repro https://github.com/abergs/eb-mas-bug-repro and it worked, with output examples below.
When building for Mac App Store (MAS), the
signApp()method always passednullformasOptionstosign(), causing it to use Darwin (Developer ID) settings instead of MAS settings. This resulted in:mac.provisioningProfileinstead ofmas.provisioningProfile)platform=darwininstead ofplatform=masRoot Cause
In
packages/app-builder-lib/src/macPackager.ts, thesignApp()method was calling:The
sign()method determinesisMasbased on whethermasOptionsis null:So passing
nullalways resulted inisMas = false, even whenpackContext.electronPlatformName === "mas".The Fix
Modified
signApp()to detect MAS builds usingpackContext.electronPlatformNameand construct the appropriate MAS options:Test Results
Tested with a reproduction project using different provisioning profiles for
macvsmasconfig:{ "mac": { "provisioningProfile": "developer_id.provisionprofile" }, "mas": { "provisioningProfile": "appstore.provisionprofile" } }Before Fix (v26.4.0)
arm64:
universal:
After Fix
arm64:
universal:
Affected Builds
mas(single-arch and universal)mas-dev(single-arch and universal)Breaking Changes
None known. But I'm not an expert, merely a tourist.