You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add upstream corporate proxy support for self-hosted runners (#1976)
* feat: add upstream corporate proxy support for self-hosted runners
Add --upstream-proxy flag and auto-detection from host https_proxy/
http_proxy/no_proxy environment variables. When configured, Squid
chains outbound traffic through the corporate proxy via cache_peer.
Key changes:
- New upstream-proxy.ts with parseProxyUrl(), parseNoProxy(),
detectUpstreamProxy(), and PROXY_ENV_VARS constant
- UpstreamProxyConfig interface in types.ts
- generateUpstreamProxySection() in squid-config.ts for cache_peer,
always_direct (no_proxy bypass), and never_direct directives
- CLI auto-detection with --upstream-proxy explicit override
- Host proxy env vars excluded from --env-all passthrough
- Security: reject credentials, loopback, HTTPS scheme, injection chars
- 35 new tests across upstream-proxy, squid-config, docker-manager
- Documentation in docs/environment.md
Closes#1975
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address PR review feedback for upstream proxy support
- Robust loopback detection: check full 127.0.0.0/8 range and IPv6
variants via isLoopback() helper instead of exact-match list
- Fix misleading comments in squid-config.ts: non-dot no_proxy entries
are treated as suffix matches (domain + subdomains), not exact-only
- Update docs/environment.md: clarify that host proxy vars are excluded
from container passthrough but are read for upstream proxy detection
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
**Proxy variables:**`HTTP_PROXY`, `HTTPS_PROXY`, `https_proxy` (and their lowercase/uppercase variants) from the host are ignored when using `--env-all` because the firewall always sets these to point to Squid. Host proxy settings cannot be passed through as they would conflict with the firewall's traffic routing.
43
+
**Proxy variables:**`HTTP_PROXY`, `HTTPS_PROXY`, `http_proxy`, `https_proxy`, `NO_PROXY`, `no_proxy`, `ALL_PROXY`, and `FTP_PROXY` (all case variants) from the host are **excluded from container passthrough**when using `--env-all`. The firewall sets its own proxy variables pointing to Squid inside the container. However, host proxy variables **are read** for upstream proxy auto-detection — if the host has `https_proxy`/`http_proxy` set, AWF configures Squid to chain outbound traffic through that corporate proxy (see [Upstream Proxy Support](#upstream-corporate-proxy-support)).
44
44
45
45
## `--env-file` Support
46
46
@@ -246,6 +246,46 @@ The DinD TCP address (e.g., `tcp://localhost:2375`) typically refers to the runn
246
246
- **`--enable-host-access`** — allows the agent to reach `host.docker.internal` and set `DOCKER_HOST=tcp://host.docker.internal:2375` inside the agent.
247
247
- **`--enable-dind`** — mounts the local Docker socket (`/var/run/docker.sock`) directly into the agent container (only works when using the local daemon, not a remote DinD TCP socket).
248
248
249
+
## Upstream (Corporate) Proxy Support
250
+
251
+
When running on self-hosted runners behind a corporate proxy, AWF can chain Squid
252
+
through the upstream proxy using the `cache_peer` directive.
253
+
254
+
### Auto-detection
255
+
256
+
If the host has `https_proxy`/`HTTPS_PROXY` or `http_proxy`/`HTTP_PROXY` set, AWF
257
+
automatically configures Squid to route outbound traffic through that proxy.
258
+
`no_proxy`/`NO_PROXY` domain suffixes are honored as bypass rules (`always_direct`).
259
+
260
+
```bash
261
+
# Auto-detected — no flags needed when host proxy env vars are set
0 commit comments