Skip to content

Commit 7345e98

Browse files
jfversluisCopilot
andauthored
fix: only re-sign nested binaries, preserve MAUI Catalyst signature (#564)
Stop re-signing the top-level .app bundle. MAUI already signs it with the correct Mac Catalyst entitlements (including application-identifier). Our manual re-sign was overwriting these with a format Apple rejects. Now only nested binaries are re-signed: copilot (with helper entitlements), dylibs, and frameworks. The app bundle keeps its original MAUI signature. Also removes the application-identifier injection step which caused the catch-22. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 26d3724 commit 7345e98

File tree

1 file changed

+7
-30
lines changed

1 file changed

+7
-30
lines changed

.github/workflows/release-apps.yml

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -278,37 +278,16 @@ jobs:
278278
echo "CFBundleIdentifier already uses base ID: $CURRENT_ID"
279279
fi
280280
281-
- name: Inject application-identifier into entitlements
282-
run: |
283-
# Extract application-identifier and team-identifier from provisioning profile.
284-
# codesign doesn't auto-inject these (Xcode does); we must include them in entitlements.
285-
PROFILE_PLIST=$(security cms -D -i "$RUNNER_TEMP/maccatalyst.provisionprofile")
286-
APP_ID=$(echo "$PROFILE_PLIST" | /usr/libexec/PlistBuddy -c "Print :Entitlements:com.apple.application-identifier" /dev/stdin)
287-
TEAM_ID=$(echo "$PROFILE_PLIST" | /usr/libexec/PlistBuddy -c "Print :Entitlements:com.apple.developer.team-identifier" /dev/stdin)
288-
echo "Profile application identifier: $APP_ID"
289-
echo "Team identifier: $TEAM_ID"
290-
291-
# The profile uses maccatalyst-prefixed ID (e.g., AY5KBJ6RN9.maccatalyst.nl.versluis.polypilot)
292-
# but Apple requires TEAMID.bundleID format (e.g., AY5KBJ6RN9.nl.versluis.polypilot).
293-
# Strip the maccatalyst. prefix to match the patched CFBundleIdentifier.
294-
APP_ID=$(echo "$APP_ID" | sed "s/${TEAM_ID}\.maccatalyst\./${TEAM_ID}./")
295-
echo "Patched application identifier: $APP_ID"
296-
297-
ENTITLEMENTS="PolyPilot/Platforms/MacCatalyst/Entitlements.AppStore.plist"
298-
/usr/libexec/PlistBuddy -c "Add :com.apple.application-identifier string $APP_ID" "$ENTITLEMENTS" 2>/dev/null || \
299-
/usr/libexec/PlistBuddy -c "Set :com.apple.application-identifier $APP_ID" "$ENTITLEMENTS"
300-
/usr/libexec/PlistBuddy -c "Add :com.apple.developer.team-identifier string $TEAM_ID" "$ENTITLEMENTS" 2>/dev/null || \
301-
/usr/libexec/PlistBuddy -c "Set :com.apple.developer.team-identifier $TEAM_ID" "$ENTITLEMENTS"
302-
echo "Updated entitlements:"
303-
cat "$ENTITLEMENTS"
304-
305-
- name: Re-sign app bundle (inside-out)
281+
- name: Re-sign nested binaries only (preserve MAUI's Catalyst signature)
306282
env:
307283
CODESIGN_KEY: ${{ secrets.IOS_CODESIGN_KEY }}
308284
run: |
309285
APP_PATH=$(find PolyPilot/bin/Release/net10.0-maccatalyst -name "PolyPilot.app" -type d | head -1)
310286
echo "App path: $APP_PATH"
311287
288+
echo "=== Original app signature ==="
289+
codesign -d --entitlements - "$APP_PATH" 2>/dev/null | head -30
290+
312291
# Sign the copilot CLI binary with minimal helper entitlements (sandbox + inherit)
313292
COPILOT_BIN="$APP_PATH/Contents/MonoBundle/copilot"
314293
if [ -f "$COPILOT_BIN" ]; then
@@ -335,11 +314,9 @@ jobs:
335314
--sign "$CODESIGN_KEY" "$f"
336315
done
337316
338-
# Re-sign the top-level app bundle with full app entitlements
339-
codesign --force --sign "$CODESIGN_KEY" \
340-
--entitlements PolyPilot/Platforms/MacCatalyst/Entitlements.AppStore.plist \
341-
--options runtime --timestamp \
342-
"$APP_PATH"
317+
# Do NOT re-sign the top-level .app bundle — MAUI's original Catalyst
318+
# signature contains the correct application-identifier entitlement format.
319+
# Re-signing with custom entitlements overwrites it and breaks validation.
343320
344321
echo "=== Verify signature ==="
345322
codesign --verify --deep --strict "$APP_PATH" 2>&1

0 commit comments

Comments
 (0)