Fix entitlements loss during app re-signing (issue #302)#472
Merged
Conversation
The Xcode build signs the app with CODE_SIGN_ENTITLEMENTS, but the release pipeline re-signs the bundle (codesign --force --deep) after sealing the bundled macdown CLI binary. That re-sign replaced the signature without --entitlements, stripping com.apple.security.files.user-selected.read-write from shipped builds. Without it, NSSavePanel (Move To / Save As…) fails with ViewBridge error 14 on macOS Sequoia and later. - Pass --entitlements MacDown/MacDown.entitlements to the app re-sign - Assert the entitlement is present at three gates so a build that loses it fails CI instead of shipping: after the re-sign and on the app inside the DMG (release.yml), and at final pre-publish verification (staple-release.yml) - Document the re-sign requirement and a troubleshooting entry Related to #302
Contributor
Code Coverage ReportCurrent Coverage: 62.01% Coverage Details (Summary) |
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.
Summary
Fixes a critical bug where the app bundle lost its
com.apple.security.files.user-selected.read-writeentitlement during the post-build re-signing step in the release workflow. This entitlement is required forNSSavePanel(Move To / Save As…) to function on macOS Sequoia and later; without it, users encounter ViewBridge error 14.Root Cause
The release workflow re-signs the app bundle after signing the bundled CLI binary to update the code signature seal. However,
codesign --force --deepreplaces the existing signature entirely. If--entitlementsis not passed, the re-signed app loses all entitlements that were applied by the Xcode build.Changes
.github/workflows/release.yml--entitlements "MacDown/MacDown.entitlements"to thecodesigncommand to preserve entitlements during the post-build re-signcom.apple.security.files.user-selected.read-writeand fail the build if missing--entitlementsis mandatory.github/workflows/staple-release.ymlplans/release-process.mdImplementation Details
codesign -d --entitlements :-to extract and inspect the app's entitlementshttps://claude.ai/code/session_014YWsBJ616nvkLYKKe1NhkW