From e38b9e50539b85df97f5f6e234cfa57e5967b18f Mon Sep 17 00:00:00 2001 From: Joseph Yaksich Date: Tue, 4 Aug 2026 22:09:33 +0000 Subject: [PATCH] fix(phase4): scope macOS acceptance to the runner's own user The macOS acceptance detected 1Helm processes and listening ports machine-wide, which is unsafe on a shared multi-user Mac. If any other account is running 1Helm, `pgrep -x 1Helm` matches that foreign process, so the "app fully quit" gates fail the job even though the runner's own app exited. Worse, the health-probe port discovery used `lsof -c 1Helm` without a user filter, so it could read another account's listening 1Helm port and probe that instance instead of the one under test. Scope both to the runner's own user: pgrep gains `-U "$(id -u)"` and the lsof port probe gains `-u "$(id -un)"`. On a dedicated single-user host this is a no-op; on a shared host it makes the lane correct and prevents it from observing or waiting on another user's 1Helm. No release, tag, version bump, website deploy, or production change. Co-Authored-By: Claude --- ops/platform-acceptance/macos.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ops/platform-acceptance/macos.sh b/ops/platform-acceptance/macos.sh index d18dee8..f2421dd 100755 --- a/ops/platform-acceptance/macos.sh +++ b/ops/platform-acceptance/macos.sh @@ -69,14 +69,14 @@ mkdir -p "$DATA_ROOT" printf '%s\n' server >"$DATA_ROOT/desktop-mode" open -n "$installed" --args --1helm-background for _ in {1..180}; do - PORT="$(lsof -nP -a -c 1Helm -iTCP -sTCP:LISTEN 2>/dev/null | awk '/127\.0\.0\.1:/ {split($9,a,":"); print a[length(a)]; exit}')" + PORT="$(lsof -nP -a -u "$(id -un)" -c 1Helm -iTCP -sTCP:LISTEN 2>/dev/null | awk '/127\.0\.0\.1:/ {split($9,a,":"); print a[length(a)]; exit}')" [[ "$PORT" =~ ^[0-9]+$ ]] && curl -fsS "http://127.0.0.1:$PORT/api/setup/status" >"$work/clean-health.json" && break sleep 1 done [[ -s "$work/clean-health.json" ]] osascript -e 'tell application id "com.gitcommit90.1helm" to quit' || true -for _ in {1..30}; do pgrep -x 1Helm >/dev/null || break; sleep 1; done -! pgrep -x 1Helm >/dev/null +for _ in {1..30}; do pgrep -x -U "$(id -u)" 1Helm >/dev/null || break; sleep 1; done +! pgrep -x -U "$(id -u)" 1Helm >/dev/null # Reset the dedicated account, install the latest immutable prior Stable DMG, # then apply the exact candidate updater ZIP while Application Support remains. @@ -123,20 +123,20 @@ printf '%s\n' "phase4-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT" >"$DATA_ROOT/phase4-ac STATE_BEFORE="$(shasum -a 256 "$DATA_ROOT/phase4-acceptance-state" | awk '{print $1}')" open -n "$installed" --args --1helm-background for _ in {1..180}; do - PORT="$(lsof -nP -a -c 1Helm -iTCP -sTCP:LISTEN 2>/dev/null | awk '/127\.0\.0\.1:/ {split($9,a,":"); print a[length(a)]; exit}')" + PORT="$(lsof -nP -a -u "$(id -un)" -c 1Helm -iTCP -sTCP:LISTEN 2>/dev/null | awk '/127\.0\.0\.1:/ {split($9,a,":"); print a[length(a)]; exit}')" [[ "$PORT" =~ ^[0-9]+$ ]] && curl -fsS "http://127.0.0.1:$PORT/api/setup/status" >"$work/prior-health.json" && break sleep 1 done [[ -s "$work/prior-health.json" ]] osascript -e 'tell application id "com.gitcommit90.1helm" to quit' || true -for _ in {1..30}; do pgrep -x 1Helm >/dev/null || break; sleep 1; done -! pgrep -x 1Helm >/dev/null +for _ in {1..30}; do pgrep -x -U "$(id -u)" 1Helm >/dev/null || break; sleep 1; done +! pgrep -x -U "$(id -u)" 1Helm >/dev/null rm -rf -- "$installed" ditto "$work/update/1Helm.app" "$installed" [[ "$(defaults read "$installed/Contents/Info" CFBundleShortVersionString)" == "$VERSION" ]] open -n "$installed" --args --1helm-background for _ in {1..180}; do - PORT="$(lsof -nP -a -c 1Helm -iTCP -sTCP:LISTEN 2>/dev/null | awk '/127\.0\.0\.1:/ {split($9,a,":"); print a[length(a)]; exit}')" + PORT="$(lsof -nP -a -u "$(id -un)" -c 1Helm -iTCP -sTCP:LISTEN 2>/dev/null | awk '/127\.0\.0\.1:/ {split($9,a,":"); print a[length(a)]; exit}')" [[ "$PORT" =~ ^[0-9]+$ ]] && curl -fsS "http://127.0.0.1:$PORT/api/setup/status" >"$work/update-health.json" && break sleep 1 done @@ -144,8 +144,8 @@ done STATE_AFTER="$(shasum -a 256 "$DATA_ROOT/phase4-acceptance-state" | awk '{print $1}')" [[ "$STATE_BEFORE" == "$STATE_AFTER" ]] osascript -e 'tell application id "com.gitcommit90.1helm" to quit' || true -for _ in {1..30}; do pgrep -x 1Helm >/dev/null || break; sleep 1; done -! pgrep -x 1Helm >/dev/null +for _ in {1..30}; do pgrep -x -U "$(id -u)" 1Helm >/dev/null || break; sleep 1; done +! pgrep -x -U "$(id -u)" 1Helm >/dev/null export HELM_STATE_BEFORE_SHA256="$STATE_BEFORE" HELM_STATE_AFTER_SHA256="$STATE_AFTER" export HELM_PREVIOUS_VERSION="$PREVIOUS_VERSION"