Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(release): sign every bundled Mach-O and check notarization readiness before submitting

M3gA-Mind9700fa2ad434
diff --git a/scripts/release/check-macos-bundled-signatures.sh b/scripts/release/check-macos-bundled-signatures.sh
new file mode 100755
index 0000000000..d18e36953d
--- /dev/null
+++ b/scripts/release/check-macos-bundled-signatures.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+# Fail when any Mach-O under a bundled-modules directory — loose, or inside a
+# shipped .tar.gz release archive — lacks what notarization demands: a
+# Developer ID signature, hardened runtime and a secure timestamp. Apple's
+# notary service unpacks nested archives, so archive members count too.
+#
+# Usage: check-macos-bundled-signatures.sh <bundled-modules dir>
+set -euo pipefail
+
+ROOT="${1:?Usage: check-macos-bundled-signatures.sh <bundled-modules dir>}"
+[ -d "$ROOT" ] || { echo "[sign-check] no bundled modules at $ROOT"; exit 0; }
+
+SCRATCH="$(mktemp -d)"
+trap 'rm -rf "$SCRATCH"' EXIT
+BAD=0
+
+check_tree() { # <dir> <label prefix>
+ while IFS= read -r -d '' f; do
+ file -b "$f" | grep -q '^Mach-O' || continue
+ info="$(codesign -dvv "$f" 2>&1 || true)"
+ problems=""
+ grep -q '^Authority=Developer ID Application' <<<"$info" || problems+=" no-developer-id"
+ grep -q '^Timestamp=' <<<"$info" || problems+=" no-timestamp"
+ grep -q '^CodeDirectory.*flags=.*runtime' <<<"$info" || problems+=" no-hardened-runtime"
+ if [ -n "$problems" ]; then
+ echo "[sign-check] UNSIGNED for notarization:$problems: $2${f#"$1"/}"
+ BAD=1
+ fi
+ done < <(find "$1" -type f -print0)
+}
+
+check_tree "$ROOT" ""
+while IFS= read -r -d '' archive; do
+ dest="$SCRATCH/$(basename "$archive")"
+ mkdir -p "$dest"
+ tar -xzf "$archive" -C "$dest"
+ check_tree "$dest" "${archive#"$ROOT"/}/"
+done < <(find "$ROOT" -name '*.tar.gz' -type f -print0)
+
+if [ "$BAD" -ne 0 ]; then
+ echo "[sign-check] ERROR: notarization would reject the Mach-O files above" >&2
+ exit 1
+fi
+echo "[sign-check] every Mach-O under $ROOT is notarization-ready"
diff --git a/scripts/release/sign-and-notarize-macos.sh b/scripts/release/sign-and-notarize-macos.sh
index e6acf39e5b..3a5edcdb79 100755
--- a/scripts/release/sign-and-notarize-macos.sh
+++ b/scripts/release/sign-and-notarize-macos.sh
@@ -124,12 +124,14 @@ for bin in "$APP_PATH/Contents/Resources/"openhuman-core-*; do
done
# Bundled native modules: notarization rejects unsigned Mach-O under Resources/.
-# tinybus pins the module *archive* digest, not the extracted dylib, so signing
-# the extracted library in place does not break admission.
-while IFS= read -r -d '' lib; do
- echo "[sign] Signing bundled module: ${lib#"$APP_PATH/Contents/Resources/"}"
- codesign_hardened "$lib"
-done < <(find "$APP_PATH/Contents/Resources/bundled-modules" -name '*.dylib' -type f -print0 2>/dev/null)
+# tinybus pins the module *archive* digest, not the extracted files, so signing
+# them in place does not break admission. Every Mach-O, not only the dylib:
+# tinycomputer ships helper executables beside its library.
+while IFS= read -r -d '' bin; do
+ file -b "$bin" | grep -q '^Mach-O' || continue
+ echo "[sign] Signing bundled module: ${bin#"$APP_PATH/Contents/Resources/"}"
+ codesign_hardened "$bin"
+done < <(find "$APP_PATH/Contents/Resources/bundled-modules" -type f -print0 2>/dev/null)
# ── Outer .app bundle ───────────────────────────────────────────────────────
echo "[sign] Signing .app bundle..."
@@ -139,6 +141,10 @@ codesign_hardened "$APP_PATH"
echo "[sign] Verifying signatures"
codesign --verify --deep --strict --verbose=2 "$APP_PATH"
+# Fail here, with every offending path, rather than after a notarization
+# round trip. This includes Mach-O inside the pinned release archives.
+bash "$(dirname "$0")/check-macos-bundled-signatures.sh" "$APP_PATH/Contents/Resources/bundled-modules"
+
# ── Notarize ─────────────────────────────────────────────────────────────────
echo "[sign] Notarizing..."
NOTARIZE_ZIP="$(mktemp /tmp/OpenHuman-notarize-XXXXXX.zip)"