feat: automate identifier entitlements when a provisioning profile is supplied - #443
Merged
Merged
Conversation
… supplied A provisioning profile only grants its restricted entitlements to code that also carries matching com.apple.application-identifier and com.apple.developer.team-identifier entitlements, but preAutoEntitlements only ran for sandboxed apps, so a Developer ID app embedding a profile had to hand-write both (and ElectronTeamID) or the profile did nothing. Run the automation for non-sandboxed apps too when a profile is supplied, injecting the two identifiers (team taken from the profile) and leaving application-groups alone, since that is a sandbox concern. Sandboxed apps and profile-less Developer ID apps are unchanged.
MarshallOfSound
force-pushed
the
sam/auto-entitlements-provisioning-profile
branch
from
August 10, 2026 21:22
0b69f96 to
bd97a80
Compare
erickzhao
approved these changes
Aug 18, 2026
|
🎉 This PR is included in version 2.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
preAutoEntitlementsonly kicks in when the entitlements enablecom.apple.security.app-sandbox, so it is effectively MAS-only today. Developer ID apps need the same treatment as soon as they embed a provisioning profile: the profile only grants its restricted entitlements (keychain-access-groups, thecom.apple.developer.*family, etc) to code that also carries matchingcom.apple.application-identifierandcom.apple.developer.team-identifierentitlements, and AMFI just ignores the profile otherwise. Right now every non-sandboxed app passingprovisioningProfilehas to hand-write both of those plusElectronTeamIDin Info.plist, which is exactly the boilerplate this automation exists to remove (we've been carrying this as a patch in the desktop app for a while).So: run the automation when a profile is supplied as well as when the sandbox is on. On the non-sandboxed path we inject the two identifier entitlements (team id from the profile, same as the sandboxed path does when a profile is present) and skip
application-groups, since that is the sandbox half of the automation and a Developer ID app shouldn't grow a group it never asked for. Anything the caller already wrote wins, same as before.Nothing changes for sandboxed apps (the output is byte for byte what it was, there's a test pinning that) or for Developer ID apps without a profile (still an early return, also pinned).
preAutoEntitlements: falsestill turns the whole thing off. The memo key now includes whether a profile was in play so a later profile-less run on the same app doesn't get handed the profile result.Checked it end to end by running
sign()withcodesignandsecuritystubbed out and a fake Developer ID profile against a real Electron.app: on main the app is signed with the caller's entitlements untouched and Info.plist has noElectronTeamID; with this the app is signed with a generated file that addscom.apple.application-identifier=<profile team>.com.github.Electronandcom.apple.developer.team-identifier, noapplication-groups, and Info.plist picks up the profile's team id.spec/util-entitlements.spec.tscovers the four combinations plus the memo case, three of which are red on main.