+# destination: upload in the shared plist is what hands the artifact to App Store
+# Connect, and it is the only key a dry run has to change. Generating the copy beats
+# keeping a second file, which would drift the moment either channel gains an option.
+# Takes the value of the caller's own upload flag and echoes the plist to use.
+appstore_export_options() {
=== DIFF: Scripts/release-macos.sh ===
@@ -1,9 +1,19 @@
#!/bin/bash
-# Archive the macOS app (Release, signed), export it with Developer ID,
-# notarize, staple, and zip it for distribution.
+# Archive the macOS app (Release, signed) and ship it through both distribution
+# channels: the Mac App Store (TestFlight) and Developer ID (notarized zip).
-# mise run release:macos # the whole pipeline
-# mise run release:macos -- --no-notarize # stop after the signed export
+# mise run release:macos # both channels
+# mise run release:macos -- --channel appstore # TestFlight only
+# mise run release:macos -- --channel developer-id # notarized zip only
+# mise run release:macos -- --no-notarize # developer-id: stop after signing
+# mise run release:macos -- --no-upload # appstore: export a .pkg locally
+#
+# The last two flags each belong to one channel and are ignored by the other.
+#
+# One archive feeds both exports: it is not signed for a channel, -exportArchive
+# re-signs it per method, so the two artifacts cannot differ in anything but the
+# signature. Developer ID runs first deliberately — it is the artifact that always
+# ships, and an App Store upload that fails should not also cost you the zip.
Needs a "Developer ID Application" certificate in the keychain
(Xcode → Settings → Accounts → Manage Certificates) besides the ASC API key.
+wants_appstore=false
+wants_developer_id=false
+# A case rather than two [ … ] || [ … ] && flag=true lines: that form returns
+# non-zero when neither test matches, and set -e takes the whole list's status.
+case "$channel" in
+appstore) wants_appstore=true ;;
+developer-id) wants_developer_id=true ;;
+both)
wants_appstore=true
wants_developer_id=true
;;
+esac
+# Only notarization needs the key; the App Store channel signs through the Xcode
+# account like the iOS one, for the reason release-env.sh documents.
+if [ "wants_developer_id" = true ] && [ "notarize" = true ]; then
echo "Uploaded macOS build $BUILD_NUMBER to App Store Connect. TestFlight shows it after processing (minutes)."
else
echo "Exported without uploading:"
ls "$EXPORT_DIR/AppStore"/*.pkg
fi
fi
-echo " gh release upload VERSIONZIP"
Investigate per the method in your instructions, then return the findings list.
git rev-list --count HEAD
PlistBuddy
Sinks: xcodebuild, xcrun notarytool, xcrun stapler, ditto, plutil, filesystem paths — all invoked with properly quoted args from trusted sources.
Phase 2b (parser/validator differentials):
--channel uses a strict case allowlist (appstore | developer-id | both); no bypass.
appstore_export_options treats anything other than literal true as "don't upload" — safe default (fails closed toward not uploading).
Phase 2c high-miss patterns:
Allowlist semantic escape: N/A — flag values are bounded.
Gate/action field mismatch: require_asc_key gate is correctly bound to the notarize action (which is the only user of $REACHY_ASC_KEY_PATH). The AppStore channel doesn't need the key because xcodebuild uses the Xcode account for uploads (documented reason).
Fail-open state drift: If the user passes --no-notarize alongside --channel developer-id, require_asc_key is skipped — but that's the intended behavior since notarization is the only consumer.
Under-validated sink arg: $VERSION (from CFBundleShortVersionString in the repo-controlled Info.plist) is interpolated into ZIP path. Source is source-controlled, not attacker-influenceable.
Sensitive-to-observability: The echoed gh release upload $VERSION $ZIP prints only filesystem paths and a version string — no secrets.
mktemp .plist race: $(mktemp -t reachy-export-options).plist writes to a path derived from mktemp's random suffix but not created atomically. This pattern is pre-existing (moved verbatim from release-ios.sh), the tmpdir is per-user on macOS ($TMPDIR under /var/folders/…), and the 8-char random suffix is unguessable — not a real exploit path.
Control regression: require_asc_key moved from unconditional to conditional (wants_developer_id && notarize). The removed unconditional call was over-broad; the new conditional matches actual key consumers. No regression.
Resource-bound placement: N/A.
Phase 3 conclusion:
These are developer-run release scripts in a trusted local environment. No attacker-influenceable input, no external ingress, all argument quoting is correct, and gates match their consumers. No security findings.