Skip to content

Commit 3295769

Browse files
authored
fix(desktop): load downloaded mesh runtime on signed macOS builds (#1932)
1 parent f308762 commit 3295769

4 files changed

Lines changed: 63 additions & 3 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,18 @@ jobs:
203203
DMG_PATH: ${{ steps.unsigned.outputs.dmg }}
204204
run: desktop/scripts/set-dmg-finder-text-size.sh "$DMG_PATH" 14
205205

206+
# mdx-ios-codesign-helper discovers this file by its exact lowercase basename.
207+
- name: Stage signing entitlements
208+
run: cp desktop/src-tauri/Entitlements.plist "${RUNNER_TEMP}/entitlements.plist"
209+
206210
- name: Codesign and Notarize
207211
id: codesign
208212
uses: block/apple-codesign-action@679535d1ab7c5a7c18e6f9afcba3464512cc3dde # v1.1.0
209213
with:
210214
osx-codesign-role: ${{ secrets.OSX_CODESIGN_ROLE }}
211215
codesign-s3-bucket: ${{ secrets.CODESIGN_S3_BUCKET }}
212216
unsigned-artifact-path: ${{ steps.unsigned.outputs.dmg }}
213-
entitlements-plist-path: desktop/src-tauri/Entitlements.plist
217+
entitlements-plist-path: ${{ runner.temp }}/entitlements.plist
214218
artifact-name: buzz-${{ github.sha }}-${{ github.run_id }}-arm64
215219

216220
- name: Replace DMG and rebuild updater archive
@@ -247,6 +251,8 @@ jobs:
247251
desktop/src-tauri/target/release/bundle/macos/Buzz.app
248252
spctl --assess --type execute --verbose=4 \
249253
desktop/src-tauri/target/release/bundle/macos/Buzz.app
254+
desktop/scripts/verify-macos-entitlements.sh \
255+
desktop/src-tauri/target/release/bundle/macos/Buzz.app
250256
251257
- name: Locate build artifacts
252258
id: artifacts
@@ -369,14 +375,18 @@ jobs:
369375
DMG_PATH: ${{ steps.unsigned.outputs.dmg }}
370376
run: desktop/scripts/set-dmg-finder-text-size.sh "$DMG_PATH" 14
371377

378+
# mdx-ios-codesign-helper discovers this file by its exact lowercase basename.
379+
- name: Stage signing entitlements
380+
run: cp desktop/src-tauri/Entitlements.plist "${RUNNER_TEMP}/entitlements.plist"
381+
372382
- name: Codesign and Notarize
373383
id: codesign
374384
uses: block/apple-codesign-action@679535d1ab7c5a7c18e6f9afcba3464512cc3dde # v1.1.0
375385
with:
376386
osx-codesign-role: ${{ secrets.OSX_CODESIGN_ROLE }}
377387
codesign-s3-bucket: ${{ secrets.CODESIGN_S3_BUCKET }}
378388
unsigned-artifact-path: ${{ steps.unsigned.outputs.dmg }}
379-
entitlements-plist-path: desktop/src-tauri/Entitlements.plist
389+
entitlements-plist-path: ${{ runner.temp }}/entitlements.plist
380390
artifact-name: buzz-${{ github.sha }}-${{ github.run_id }}-x64
381391

382392
- name: Replace DMG and rebuild updater archive
@@ -411,6 +421,7 @@ jobs:
411421
APP_DIR="desktop/src-tauri/target/${TARGET}/release/bundle/macos/Buzz.app"
412422
codesign --verify --deep --strict --verbose=2 "$APP_DIR"
413423
spctl --assess --type execute --verbose=4 "$APP_DIR"
424+
desktop/scripts/verify-macos-entitlements.sh "$APP_DIR"
414425
415426
- name: Locate updater archive
416427
id: artifacts
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
# Fail a macOS release if the signing service dropped Buzz's entitlements.
3+
4+
set -euo pipefail
5+
6+
if [[ $# -ne 1 ]]; then
7+
echo "Usage: $0 <path-to-Buzz.app>" >&2
8+
exit 2
9+
fi
10+
11+
APP_PATH="$1"
12+
INFO_PLIST="$APP_PATH/Contents/Info.plist"
13+
14+
[[ -d "$APP_PATH" ]] || { echo "Missing app bundle: $APP_PATH" >&2; exit 1; }
15+
[[ -f "$INFO_PLIST" ]] || { echo "Missing app Info.plist: $INFO_PLIST" >&2; exit 1; }
16+
17+
EXECUTABLE_NAME="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$INFO_PLIST")"
18+
EXECUTABLE_PATH="$APP_PATH/Contents/MacOS/$EXECUTABLE_NAME"
19+
[[ -f "$EXECUTABLE_PATH" ]] || { echo "Missing app executable: $EXECUTABLE_PATH" >&2; exit 1; }
20+
21+
ENTITLEMENTS="$(mktemp -t buzz-entitlements)"
22+
trap 'rm -f "$ENTITLEMENTS"' EXIT
23+
24+
codesign --display --entitlements "$ENTITLEMENTS" --xml "$EXECUTABLE_PATH" 2>/dev/null
25+
[[ -s "$ENTITLEMENTS" ]] || {
26+
echo "Signed app has no embedded entitlements: $EXECUTABLE_PATH" >&2
27+
exit 1
28+
}
29+
30+
required_entitlements=(
31+
com.apple.security.device.audio-input
32+
com.apple.security.device.camera
33+
com.apple.security.cs.disable-library-validation
34+
)
35+
36+
for entitlement in "${required_entitlements[@]}"; do
37+
value="$(/usr/libexec/PlistBuddy -c "Print :$entitlement" "$ENTITLEMENTS" 2>/dev/null || true)"
38+
if [[ "$value" != "true" ]]; then
39+
echo "Signed app is missing required entitlement: $entitlement" >&2
40+
exit 1
41+
fi
42+
done
43+
44+
echo "Verified required macOS entitlements on $EXECUTABLE_PATH"

‎desktop/src-tauri/Entitlements.plist‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
<true/>
77
<key>com.apple.security.device.camera</key>
88
<true/>
9+
<!-- MeshLLM installs versioned native runtimes outside the app bundle. -->
10+
<key>com.apple.security.cs.disable-library-validation</key>
11+
<true/>
912
</dict>
1013
</plist>

‎desktop/src-tauri/src/mesh_llm/mod.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ async fn initialize_mesh_native_runtime() -> anyhow::Result<()> {
228228
// requiring a separate `mesh-llm runtime install` command.
229229
mesh_llm_host_runtime::initialize_host_runtime()
230230
.await
231-
.map_err(|error| anyhow::anyhow!("mesh native runtime failed to install or load: {error}"))
231+
.map_err(|error| {
232+
anyhow::anyhow!("mesh native runtime failed to install or load: {error:#}")
233+
})
232234
}
233235

234236
/// Tokio worker stack size for the runtime that polls mesh-llm futures.

0 commit comments

Comments
 (0)