@@ -22,11 +22,44 @@ if /usr/bin/grep -R -n -E '(writeFile|rename|copyFile|rm).*app\.asar' "$ROOT/scr
2222 printf ' A runtime script appears to mutate app.asar.\n' >&2
2323 exit 1
2424fi
25+ if /usr/bin/grep -n -E ' /usr/bin/python3|(^|[[:space:]])eval([[:space:]]|$)' \
26+ " $ROOT /scripts/common-macos.sh" > /dev/null; then
27+ printf ' The shared macOS runtime must parse state with the bundled Node.js, without python3 or eval.\n' >&2
28+ exit 1
29+ fi
2530
2631" $NODE " " $ROOT /scripts/injector.mjs" --check-payload > /dev/null
2732
2833TMP=" $( /usr/bin/mktemp -d /tmp/codex-dream-skin-tests.XXXXXX) "
2934trap ' /bin/rm -rf "$TMP"' EXIT
35+
36+ RUNTIME_HOME=" $TMP /runtime-home"
37+ RUNTIME_STATE_ROOT=" $RUNTIME_HOME /Library/Application Support/CodexDreamSkinStudio"
38+ RUNTIME_STATE=" $RUNTIME_STATE_ROOT /state.json"
39+ STATE_EVAL_MARKER=" $TMP /state-eval-marker"
40+ EXPECTED_BUNDLE=" /Applications/Codex \$ (touch \" $STATE_EVAL_MARKER \" ).app"
41+ EXPECTED_EXE=" $EXPECTED_BUNDLE /Contents/MacOS/ChatGPT; touch \" $STATE_EVAL_MARKER \" "
42+ EXPECTED_VERSION=' 1.1.2 "nightly"'
43+ EXPECTED_TEAM_ID=" TEAM'ID"
44+ /bin/mkdir -p " $RUNTIME_STATE_ROOT "
45+ " $NODE " -e '
46+ const fs = require("node:fs");
47+ const [file, codexBundle, codexExe, codexVersion, codexTeamId] = process.argv.slice(1);
48+ fs.writeFileSync(file, `${JSON.stringify({ codexBundle, codexExe, codexVersion, codexTeamId })}\n`);
49+ ' " $RUNTIME_STATE " " $EXPECTED_BUNDLE " " $EXPECTED_EXE " " $EXPECTED_VERSION " " $EXPECTED_TEAM_ID "
50+ /usr/bin/env -u NODE -u NODE_VERSION HOME=" $RUNTIME_HOME " /bin/bash -c '
51+ . "$1/scripts/common-macos.sh"
52+ ensure_node_runtime
53+ [ "$CODEX_BUNDLE" = "$2" ]
54+ [ "$CODEX_EXE" = "$3" ]
55+ [ "$CODEX_VERSION" = "$4" ]
56+ [ "$CODEX_TEAM_ID" = "$5" ]
57+ ' _ " $ROOT " " $EXPECTED_BUNDLE " " $EXPECTED_EXE " " $EXPECTED_VERSION " " $EXPECTED_TEAM_ID "
58+ [ ! -e " $STATE_EVAL_MARKER " ] || {
59+ printf ' Runtime state values were evaluated as shell code.\n' >&2
60+ exit 1
61+ }
62+
3063/bin/mkdir -p " $TMP /theme"
3164/bin/cp " $ROOT /assets/portal-hero.png" " $TMP /theme/background.png"
3265" $NODE " " $ROOT /scripts/write-theme.mjs" custom --output-dir " $TMP /theme" \
@@ -71,4 +104,4 @@ NO_DESKTOP_BACKUP="$TMP/theme-backup-without-desktop.json"
71104/usr/bin/env -u HOME /bin/bash -c ' . "$1/scripts/common-macos.sh"; [ -n "$HOME" ] && [ "$SKIN_VERSION" = "1.1.2" ]' _ " $ROOT "
72105" $ROOT /scripts/doctor-macos.sh" > /dev/null
73106
74- printf ' PASS: syntax, payload, custom-theme, config round-trips, HOME recovery, signature, and doctor checks.\n'
107+ printf ' PASS: syntax, payload, runtime-state safety, custom-theme, config round-trips, HOME recovery, signature, and doctor checks.\n'
0 commit comments