Files
cursor-devbox/cursor-agent-wrapper.sh
T
Ubuntu 90c6b6c425
build-and-push / build (push) Successful in 8m40s
Force cursor-agent egress through node2 SOCKS5 via local CONNECT bridge
The Bun-based cursor-agent only honors http://-scheme HTTP(S)_PROXY values
and silently ignores socks5(h):// — with the pod's socks5h env it egressed
directly. Add devbox-proxy-bridge (loopback HTTP CONNECT -> node2 SOCKS5),
run it supervised from the entrypoint, and shadow cursor-agent/agent with a
wrapper that points at the bridge (fail-loud, no bypass). CI path triggers
updated for the new files.
2026-09-27 09:48:55 +00:00

29 lines
1.2 KiB
Bash

#!/bin/sh
# Force cursor-agent (and its child processes) through the pod's loopback
# HTTP-CONNECT proxy bridge (devbox-proxy-bridge.js, started by /entrypoint.sh),
# which forwards to node2's SOCKS5 egress.
#
# Why: the Bun-based cursor-agent honors HTTP(S)_PROXY only for http://-scheme
# URLs and silently ignores socks5(h):// values — with the pod's socks5h env
# it would egress directly. This wrapper shadows ~/.local/bin/cursor-agent via
# PATH precedence (/usr/local/bin comes first).
#
# Local and cluster-internal destinations stay direct via NO_PROXY. If the
# bridge is down, the agent fails loudly (proxy-unreachable) instead of
# silently leaking direct traffic. No bypass flag by design.
set -eu
REAL=/home/developer/.local/bin/cursor-agent
if [ ! -x "$REAL" ]; then
echo "cursor-agent wrapper: $REAL is not installed (install cursor-agent first)" >&2
exit 127
fi
BRIDGE=http://127.0.0.1:8118
export HTTP_PROXY="$BRIDGE" HTTPS_PROXY="$BRIDGE" ALL_PROXY="$BRIDGE"
export http_proxy="$BRIDGE" https_proxy="$BRIDGE" all_proxy="$BRIDGE"
export NO_PROXY="localhost,127.0.0.1,::1,.svc,.svc.cluster.local,.svc.clusterset.local"
export no_proxy="$NO_PROXY"
exec "$REAL" "$@"