Skip to content

Commit ce8d6b1

Browse files
os-zhuangclaude
andcommitted
fix(one): sign bundled Node with JIT entitlements to stop macOS crash-loop
The macOS app crash-loops on launch ("sidecar exited; restarting") because the bundled Node runtime is killed the instant V8 initializes. CI signs the Node binary with hardened runtime (--options runtime, required for notarization) but passed no entitlements, so macOS blocks V8's JIT executable memory and kills node with SIGTRAP (exit 133) before it prints anything. Add runtime-entitlements.plist (com.apple.security.cs.allow-jit + allow-unsigned-executable-memory + disable-library-validation) and pass it via --entitlements in the pre-sign step. Verified on the shipped 7.6.0 binary: as-signed → exit 133; re-signed with these entitlements → runs (node v22). Also fail the build if allow-jit is ever missing from the node binary, so this brick can't ship again. Affected 7.2.x–7.6.0 identically; ship as 7.6.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 32894a5 commit ce8d6b1

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

.github/workflows/one.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ jobs:
179179
# with the same Developer ID, hardened runtime, and a secure
180180
# timestamp. Tauri's own codesign pass doesn't deep-sign embedded
181181
# Node native binaries, so we sign them here before Tauri bundles.
182+
#
183+
# CRITICAL: the Node binary runs V8, which maps executable (JIT)
184+
# memory at startup. Under hardened runtime that is blocked unless
185+
# the binary carries the JIT entitlements below — otherwise macOS
186+
# kills node with SIGTRAP (exit 133) the instant it launches, which
187+
# surfaces as the bundled runtime crash-looping on every start
188+
# ("sidecar exited; restarting"). Always pass --entitlements.
189+
ENTITLEMENTS="apps/objectos-one/src-tauri/runtime-entitlements.plist"
182190
echo "Scanning $RUNTIME for Mach-O binaries..."
183191
find "$RUNTIME" -type f \
184192
\( -name '*.node' -o -name '*.dylib' -o -name '*.so' \
@@ -188,7 +196,8 @@ jobs:
188196
if file -b "$f" | grep -qE 'Mach-O'; then
189197
echo " signing $f"
190198
codesign --force --sign "$APPLE_SIGNING_IDENTITY" \
191-
--timestamp --options runtime "$f"
199+
--timestamp --options runtime \
200+
--entitlements "$ENTITLEMENTS" "$f"
192201
fi
193202
done
194203
@@ -197,6 +206,21 @@ jobs:
197206
codesign -dv --verbose=2 "$f" 2>&1 | head -10 || true
198207
done
199208
209+
# Guard against the JIT-entitlement regression: the node binary MUST
210+
# carry com.apple.security.cs.allow-jit or the runtime crash-loops at
211+
# launch. Fail the build loudly here rather than shipping a brick.
212+
NODE_BIN="$RUNTIME/node"
213+
if [ -f "$NODE_BIN" ]; then
214+
echo "Verifying node JIT entitlement:"
215+
if codesign -d --entitlements - --xml "$NODE_BIN" 2>/dev/null \
216+
| tr -d '\0' | grep -q 'com.apple.security.cs.allow-jit'; then
217+
echo " ✓ allow-jit present on node"
218+
else
219+
echo " ✗ allow-jit MISSING on node — runtime would crash-loop." >&2
220+
exit 1
221+
fi
222+
fi
223+
200224
- name: Build Tauri bundle
201225
env:
202226
# AppImage tools need FUSE on Linux; ubuntu-22.04 dropped it.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<!-- The bundled Node runtime is signed with hardened runtime (required for
6+
notarization). V8 maps executable (JIT) memory at startup, which the
7+
hardened runtime blocks unless these entitlements are granted — without
8+
them macOS kills node with SIGTRAP (exit 133) before it prints anything,
9+
producing the "sidecar exited; restarting" crash-loop. -->
10+
<key>com.apple.security.cs.allow-jit</key>
11+
<true/>
12+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
13+
<true/>
14+
<key>com.apple.security.cs.disable-library-validation</key>
15+
<true/>
16+
</dict>
17+
</plist>

0 commit comments

Comments
 (0)