From af2bc9f06c95e1c6f8b969f996ccdb44efaeead1 Mon Sep 17 00:00:00 2001 From: Archer Date: Mon, 26 Oct 2026 16:54:20 +0000 Subject: [PATCH] fix(aggregator): give the collector egress proxy env before it runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Under the fleet-feed-collector systemd unit's minimal env, the collector ran with no proxy: its Bitwarden fetch (GitHub Project token) and api.github.com GraphQL read both failed fail-soft, so the projects section (#910 stage 5) was silently omitted from every unit-produced feed. Export the same proxy credential the push uses (env only, never argv — #948) plus NO_PROXY for loopback/tailnet reads, before invoking the collector. Verified: clean-env run (env -i, HOME pinned) produces 'projects 27 items' and pushes; push-fleet-feed.guard.sh passes. --- .../aggregator/scripts/push-fleet-feed.sh | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pm-stack/aggregator/scripts/push-fleet-feed.sh b/pm-stack/aggregator/scripts/push-fleet-feed.sh index ec4c97c8e5..4092f4e794 100755 --- a/pm-stack/aggregator/scripts/push-fleet-feed.sh +++ b/pm-stack/aggregator/scripts/push-fleet-feed.sh @@ -37,6 +37,28 @@ LAPTOP=user@100.99.113.103 DEST_DIR="~/pm-stack/aggregator" KNOWN_HOSTS="${PUSH_FLEET_FEED_KNOWN_HOSTS:-$PKG/scripts/laptop_known_hosts}" +# The collector itself needs egress under the systemd unit's minimal +# env: Bitwarden (the GitHub Project token for the projects section) +# and api.github.com (the Project pool GraphQL read). Reuse the same +# proxy credential the push below uses, exported as env only — never +# argv (the #948 rule the guard enforces). NO_PROXY keeps the +# collector's loopback/tailnet reads (sandbox OpenCode server, laptop) +# off the proxy. +if [ -z "${HTTPS_PROXY:-}" ] && [ -f "$HOME/tools/secrets.d/mcpx-daemon.env" ]; then + _proxy_url="$(python3 -c 'import os, re +try: + t = open(os.path.expanduser("~/tools/secrets.d/mcpx-daemon.env")).read() +except OSError: + t = "" +m = re.search(r"(https?://[^\s\"\x27]+@[^\s\"\x27]+)", t) +print(m.group(1) if m else "")' 2>/dev/null || true)" + if [ -n "$_proxy_url" ]; then + export HTTPS_PROXY="$_proxy_url" https_proxy="$_proxy_url" + fi + unset _proxy_url +fi +export NO_PROXY="${NO_PROXY:-127.0.0.1,localhost,100.99.113.103}" no_proxy="${no_proxy:-127.0.0.1,localhost,100.99.113.103}" + bun run scripts/collect-fleet-feed.ts --out "$FEED" exec python3 - "$FEED" "$LAPTOP" "$DEST_DIR" "$KNOWN_HOSTS" <<'PYEOF'