Skip to content

Commit d511098

Browse files
committed
fix(setup-action): set SFW_UNKNOWN_HOST_ACTION=ignore in generated shims
sfw-enterprise's built-in default for unknownHostAction is 'block' — which rejects every host outside the registries[] allowlist, breaking dev/CI workflows that hit api.anthropic.com, github.com, telemetry endpoints, etc. sfw-free hardcodes 'ignore' internally and ignores the env var, so setting it unconditionally is safe — free mode is a no-op, enterprise picks it up. The host allowlist (registries[]) is still required — it's what gets ACTIVELY SCORED by Socket. unknownHostAction only changes the default for non-allowlisted hosts from "block" to "pass through unscored." Covers both bash and Windows .cmd shim variants. Source-of-truth check: firewall/src/lib/firewall/connect.ts handleConnect. Sibling change in socket-wheelhouse template/docs/references/sfw-local- install.md updates the local-install doc to instruct users to add the same export when hand-rolling their regenerate-shims.sh.
1 parent 5a82eaa commit d511098

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

.github/actions/setup/action.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,22 @@ runs:
327327
REAL="$(PATH="$CLEAN_PATH" command -v "$CMD" 2>/dev/null || true)"
328328
if [ -n "$REAL" ]; then
329329
REAL="$(msys_to_win_path "$REAL")"
330+
# SFW_UNKNOWN_HOST_ACTION=ignore: only sfw-enterprise reads this
331+
# env var (sfw-free hardcodes 'ignore' internally). Enterprise's
332+
# built-in default is 'block', which fails dev workflows that hit
333+
# hosts outside the registries[] allowlist (Anthropic API, GitHub
334+
# clones, telemetry, etc.). Setting 'ignore' lets non-allowlisted
335+
# traffic pass unscored while still scanning the registries we
336+
# care about. Free mode ignores the var, so we set it
337+
# unconditionally — no branching needed. See
338+
# firewall/src/lib/firewall/connect.ts.
330339
SHIM_LINES=('#!/bin/bash' "export PATH=\"\$(echo \"\$PATH\" | tr ':' '\n' | grep -vxF '${SHIM_DIR}' | paste -sd: -)\"")
340+
SHIM_LINES+=('export SFW_UNKNOWN_HOST_ACTION=ignore')
331341
SHIM_LINES+=("exec \"${SFW_BIN}\" \"${REAL}\" \"\$@\"")
332342
printf '%s\n' "${SHIM_LINES[@]}" > "$SHIM_DIR/$CMD"
333343
chmod +x "$SHIM_DIR/$CMD"
334344
if $IS_WINDOWS; then
335-
printf '@echo off\r\nset "PATH=;%%PATH%%;"\r\nset "PATH=%%PATH:;%s;=;%%"\r\nset "PATH=%%PATH:~1,-1%%"\r\n"%s" "%s" %%*\r\n' \
345+
printf '@echo off\r\nset "PATH=;%%PATH%%;"\r\nset "PATH=%%PATH:;%s;=;%%"\r\nset "PATH=%%PATH:~1,-1%%"\r\nset "SFW_UNKNOWN_HOST_ACTION=ignore"\r\n"%s" "%s" %%*\r\n' \
336346
"$SHIM_DIR" "$SFW_BIN" "$REAL" > "$SHIM_DIR/$CMD.cmd"
337347
fi
338348
else

0 commit comments

Comments
 (0)