Three bugs, all found standing up a second rig on m3ultra:
1. SECURITY: HTTPServer(("", 8017)) bound 0.0.0.0 with no auth, and POST /save
base64-writes bytes to an absolute `dest` taken straight from the request body.
Anyone on the same wifi could write arbitrary files as this user — drop a
~/Library/LaunchAgents plist and you have code execution. It was live on ultra
(verified: `TCP *:8017 (LISTEN)`, 204 from 192.168.1.249). Now binds 127.0.0.1;
FLOW_BIND overrides for a tailnet IP (utun-routed, LAN still can't reach it).
2. The launchd "self-heal" never healed anything. launch.sh backgrounds the queue
server and exits; without AbandonProcessGroup launchd SIGKILLs the process group
on exit, so every 10-min tick started a server that died a second later. The
server that was actually up had been started by a manual ./launch.sh.
Verified after the fix: kill -> 000 -> kickstart -> 204 on a fresh pid.
3. launch.sh hard-coded "Brave Browser" in the osascript. The extension is loaded
into Chrome on m3ultra. FLOW_BROWSER now names it (default Brave, unchanged
for ultra); m3ultra's plist sets "Google Chrome".
Also chmod +x install.sh launch.sh (both had lost the bit).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.7 KiB
Bash
Executable File
41 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Install (or resync) the self-healing launchd agent for the Flow rinse.
|
|
# Run ON the rig Mac, from this directory: ./install.sh
|
|
#
|
|
# Mirrors the vault-backup pattern (mrpgi-vault/backup.sh): launchd can't
|
|
# execute scripts inside ~/Documents (macOS TCC blocks it), so the agent runs
|
|
# a COPY of the runtime at "~/Library/Application Support/flowrinse/".
|
|
# Once the agent owns the server, queue.jsonl / results.jsonl / downloads
|
|
# live THERE — enqueue via http://localhost:8017/enqueue as usual.
|
|
#
|
|
# Re-run after editing launch.sh / local_server_example.py to resync the copy.
|
|
#
|
|
# One-time macOS prompts on first run (click Allow on the rig's screen):
|
|
# * Automation: "sh"/"osascript" wants to control "Brave Browser"
|
|
#
|
|
# Manage the job:
|
|
# launchctl kickstart -k gui/$(id -u)/games.monsterrobot.flowrinse # run now
|
|
# launchctl bootout gui/$(id -u)/games.monsterrobot.flowrinse # stop it
|
|
set -e
|
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
APP="$HOME/Library/Application Support/flowrinse"
|
|
LABEL=games.monsterrobot.flowrinse
|
|
PLIST="$HOME/Library/LaunchAgents/$LABEL.plist"
|
|
|
|
# runtime copy (code always refreshed; live state never overwritten)
|
|
mkdir -p "$APP"
|
|
cp "$DIR/launch.sh" "$DIR/local_server_example.py" "$DIR/flowclient.py" "$APP/"
|
|
chmod +x "$APP/launch.sh"
|
|
for f in queue.jsonl results.jsonl; do
|
|
[ -f "$APP/$f" ] || { [ -f "$DIR/$f" ] && cp "$DIR/$f" "$APP/$f" || true; }
|
|
done
|
|
|
|
mkdir -p "$HOME/Library/LaunchAgents"
|
|
cp "$DIR/$LABEL.plist" "$PLIST"
|
|
launchctl bootout gui/$(id -u)/$LABEL 2>/dev/null || true
|
|
launchctl bootstrap gui/$(id -u) "$PLIST"
|
|
|
|
echo "installed $LABEL — fires at load + every 10 min"
|
|
echo "run now: launchctl kickstart -k gui/$(id -u)/$LABEL"
|