Skip to content

fix: remove HTTP_PROXY/HTTPS_PROXY env vars from agent container#524

Merged
Mossaka merged 1 commit intomainfrom
fix/remove-http-proxy-env
Feb 5, 2026
Merged

fix: remove HTTP_PROXY/HTTPS_PROXY env vars from agent container#524
Mossaka merged 1 commit intomainfrom
fix/remove-http-proxy-env

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Feb 5, 2026

Summary

  • Remove HTTP_PROXY/HTTPS_PROXY env vars from the agent container environment — intercept mode (iptables DNAT 80/443 → squid:3129) handles all routing transparently
  • Add proxy vars (upper and lowercase) to EXCLUDED_ENV_VARS to prevent host proxy settings leaking via --env-all
  • Update entrypoint.sh logging to reflect intercept mode instead of unconditionally printing empty proxy vars

Problem

Codex (Rust/reqwest) honors the HTTP_PROXY env var and attempts to connect to squid on port 3128. In intercept mode, port 3128 is not reachable from the agent container (only port 3129 via iptables DNAT), causing "Connection refused" errors. Copilot and Claude work fine because they don't use HTTP_PROXY the same way.

What does NOT change

  • Squid still listens on port 3128 (healthcheck uses it)
  • SQUID_PROXY_HOST, SQUID_PROXY_PORT, SQUID_INTERCEPT_PORT env vars remain (used by setup-iptables.sh)
  • Docker Compose port mapping for 3128/3129 remains
  • --env override path still works for explicit proxy if needed

Test plan

  • Unit tests pass (731 tests, all passing)
  • Build succeeds
  • Lint passes (0 errors)
  • Codex smoke test to verify fix

Fixes #523

🤖 Generated with Claude Code

Intercept mode (iptables DNAT 80/443 → squid:3129) handles all routing
transparently. Port 3128 is unreachable from the agent container, causing
Codex (Rust/reqwest) to fail with "Connection refused" when it honors
the HTTP_PROXY env var.

- Remove HTTP_PROXY/HTTPS_PROXY from the agent container environment
- Add proxy vars (upper and lowercase) to EXCLUDED_ENV_VARS to prevent
  host proxy settings from leaking via --env-all
- Update entrypoint.sh logging to reflect intercept mode
- Users can still override via --env HTTP_PROXY=... if needed

Fixes #523

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 5, 2026 19:45
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Chroot tests failed Smoke Chroot failed - See logs for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.10% 82.10% ➡️ +0.00%
Statements 82.14% 82.14% ➡️ +0.00%
Functions 81.95% 81.95% ➡️ +0.00%
Branches 75.44% 75.44% ➡️ +0.00%

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical issue where Codex (Rust/reqwest) fails to connect because it honors the HTTP_PROXY environment variable pointing to an unreachable port (3128). The solution removes these environment variables from the agent container and relies on intercept mode (iptables DNAT on ports 80/443 → squid:3129) for transparent routing.

Changes:

  • Removed HTTP_PROXY and HTTPS_PROXY environment variables from the agent container environment
  • Added proxy environment variables (all case variants) to the exclusion list to prevent host settings from leaking via --env-all
  • Updated entrypoint.sh logging to reflect intercept mode operation and only print proxy vars if user-provided

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/docker-manager.ts Removed HTTP_PROXY/HTTPS_PROXY from agent environment and added all proxy var variants to EXCLUDED_ENV_VARS
src/docker-manager.test.ts Updated test expectations and added new test to verify proxy vars are excluded with --env-all
containers/agent/entrypoint.sh Updated proxy configuration logging to reflect intercept mode and conditionally print user-provided proxy vars

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Deno Build Test Results

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: ✅ PASS

All Deno tests completed successfully.

AI generated by Build Test Deno

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Node.js Build Test Results

Project Install Tests Status
clsx PASS PASS
execa PASS PASS
p-limit PASS PASS

Overall: PASS

All Node.js projects built and tested successfully.

AI generated by Build Test Node.js

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS

All C++ projects built successfully.

AI generated by Build Test C++

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Go Build Test Results

Project Download Tests Status
color 1/1 PASS
env 1/1 PASS
uuid 1/1 PASS

Overall: PASS

All Go projects built and tested successfully.

AI generated by Build Test Go

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Build Test: Java - FAILED ❌

ERROR: Maven installation is corrupted or incompatible with the system architecture.

Error: /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar: cannot execute binary file: Exec format error

Test Results

Project Compile Tests Status
gson N/A FAILED
caffeine N/A FAILED

Overall: FAILED

Environment Details

  • Java: ✅ Installed (Temurin JDK 21.0.10-7)
  • Maven: ❌ Binary format error (version 3.9.12)

Action Required: The GitHub Actions runner environment has a corrupted Maven installation. This needs to be investigated and fixed before Java build tests can run successfully.

AI generated by Build Test Java

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Build Test: Bun - FAILED ❌

Status: FAILED - Bun installation issue

Test Results

Project Install Tests Status
elysia N/A FAIL
hono N/A FAIL

Overall: FAIL

Error Details

Bun v1.3.8 was successfully installed, but all attempts to run bun install fail with:

error: An internal error occurred (NotDir)

This error occurs consistently:

  • In the cloned test repository directories
  • In freshly created directories
  • With minimal and complete package.json files
  • After reinstalling Bun from scratch

Environment

  • Bun version: 1.3.8
  • OS: GitHub Actions Ubuntu runner
  • Installation method: Official install script (curl -fsSL https://bun.sh/install | bash)

Recommendation

This appears to be an environment incompatibility between Bun v1.3.8 and the GitHub Actions runner environment. Possible solutions:

  1. Use Docker with the official Bun image instead of installing directly
  2. Test in a different environment/runner
  3. Report this issue to the Bun project for GitHub Actions compatibility

The build-test-bun label was NOT added due to test failures.

AI generated by Build Test Bun

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Build Test: Rust - FAILED ❌

Status: BLOCKED

Unable to execute Rust build tests due to container environment restrictions.

Issue Details

The test workflow attempted to:

  1. ✅ Clone test repository: Mossaka/gh-aw-firewall-test-rust
  2. ❌ Build fd project with cargo build
  3. ❌ Build zoxide project with cargo build

Root Cause

The Rust toolchain (rustup/cargo) cannot execute within the AWF agent container. When attempting to run cargo commands, execution is intercepted and returns bash version output instead of cargo output. This suggests:

  • Possible seccomp/AppArmor security policy blocking binary execution
  • Container environment restrictions preventing dynamic linking
  • PTR ACE or similar security mechanism interfering with ELF execution

Attempted Solutions

  • ✅ Installed rustup via official installer
  • ✅ Verified rustup binary exists at /home/runner/.cargo/bin/rustup (1.4MB ELF binary)
  • ❌ Direct execution fails (intercepted)
  • ❌ Execution via ELF interpreter fails (intercepted)
  • ❌ Clean environment execution fails (intercepted)

Next Steps

To enable Rust build testing, one of the following is required:

  1. Pre-install Rust toolchain in the agent container image
  2. Adjust container security policies to allow cargo/rustup execution
  3. Run tests outside agent container (defeats firewall purpose)
  4. Use different container runtime without execution restrictions

Test Results Table:

Project Build Tests Status
fd - BLOCKED
zoxide - BLOCKED

Overall: FAILED - Environment incompatible with Rust toolchain execution

AI generated by Build Test Rust

@Mossaka Mossaka merged commit 54fd26e into main Feb 5, 2026
81 of 87 checks passed
@Mossaka Mossaka deleted the fix/remove-http-proxy-env branch February 5, 2026 20:13
Mossaka added a commit that referenced this pull request Feb 5, 2026
After #524 removed HTTP_PROXY/HTTPS_PROXY from the agent container,
the v0.13.4 images break because their setup-iptables.sh DNATs to
port 3128 (explicit proxy) instead of 3129 (intercept mode).

Recompile all lock files to use v0.13.5 images which have the
intercept port fix (PR #520).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mossaka added a commit that referenced this pull request Feb 5, 2026
After #524 removed HTTP_PROXY/HTTPS_PROXY from the agent container,
the v0.13.4 images break because their setup-iptables.sh DNATs to
port 3128 (explicit proxy) instead of 3129 (intercept mode).

Recompile all lock files to use v0.13.5 images which have the
intercept port fix (PR #520).

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mossaka added a commit that referenced this pull request Feb 5, 2026
After #524 removed HTTP_PROXY/HTTPS_PROXY from the agent container,
the v0.13.4 images break because their setup-iptables.sh DNATs to
port 3128 (explicit proxy) instead of 3129 (intercept mode).

Recompile all lock files to use v0.13.5 images which have the
intercept port fix (PR #520).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mossaka added a commit that referenced this pull request Feb 5, 2026
## Changes

### Mount /etc/hosts in chroot mode and handle missing resolv.conf
- Mount `/etc/hosts` read-only inside the chroot for hostname resolution (e.g., localhost)
- Handle missing `/host/etc/resolv.conf` when using selective /etc mounts: create the file instead of failing, clean it up on exit

### Fix HTTP blocking test for intercept mode
- Fix the HTTP blocking integration test to check HTTP status code instead of exit code, since Squid returns a 403 HTML page for blocked HTTP requests in intercept mode (curl exits 0)

### Ensure .copilot directory permissions before CLI install
- Create `.copilot` directory with correct ownership before installing Copilot CLI in smoke-chroot workflow

---

Note: 4 failing CI checks are pre-existing failures also present on main (caused by HTTPS_PROXY removal in #524).
Mossaka added a commit that referenced this pull request Feb 5, 2026
Two issues introduced by recent agent-authored PRs:

1. PR #524 removed both HTTP_PROXY and HTTPS_PROXY from the agent
   container. While HTTP works via iptables DNAT to Squid's intercept
   port 3129, HTTPS requires the CONNECT method through Squid's
   forward-proxy port 3128 (ssl-bump). Restoring HTTPS_PROXY fixes
   Examples Test, Chroot Edge Cases, and Chroot Package Managers.

2. smoke-chroot.lock.yml used a sparse checkout (.github/.agents only)
   but then runs npm ci && npm run build which needs the full repo.
   Adding actions/checkout to smoke-chroot.md fixes the tsc build
   failure.

Fixes #529

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mossaka added a commit that referenced this pull request Feb 5, 2026
Two issues introduced by recent agent-authored PRs:

1. PR #524 removed both HTTP_PROXY and HTTPS_PROXY from the agent
   container. While HTTP works via iptables DNAT to Squid's intercept
   port 3129, HTTPS requires the CONNECT method through Squid's
   forward-proxy port 3128 (ssl-bump). Restoring HTTPS_PROXY fixes
   Examples Test, Chroot Edge Cases, and Chroot Package Managers.

2. smoke-chroot.lock.yml used a sparse checkout (.github/.agents only)
   but then runs npm ci && npm run build which needs the full repo.
   Adding actions/checkout to smoke-chroot.md fixes the tsc build
   failure.

Fixes #529

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mossaka added a commit that referenced this pull request Feb 5, 2026
Two issues introduced by recent agent-authored PRs:

1. PR #524 removed both HTTP_PROXY and HTTPS_PROXY from the agent
   container. While HTTP works via iptables DNAT to Squid's intercept
   port 3129, HTTPS requires the CONNECT method through Squid's
   forward-proxy port 3128 (ssl-bump). Restoring HTTPS_PROXY fixes
   Examples Test, Chroot Edge Cases, and Chroot Package Managers.

2. smoke-chroot.lock.yml used a sparse checkout (.github/.agents only)
   but then runs npm ci && npm run build which needs the full repo.
   Adding actions/checkout to smoke-chroot.md fixes the tsc build
   failure.

Fixes #529

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mossaka added a commit that referenced this pull request Feb 6, 2026
Reverts the following PRs which introduced unnecessary complexity:

- #520: fix: enable Squid intercept mode for NAT-redirected traffic
- v0.13.5 release: chore(release): bump version to 0.13.5
- #524: fix: remove HTTP_PROXY/HTTPS_PROXY env vars from agent container
- #526: chore: recompile workflow lock files for AWF v0.13.5
- #527: fix: recompile lock files with release action mode
- #522: fix: mount /etc/hosts in chroot and fix HTTP blocking test
- #530: fix: restore HTTPS_PROXY, fix chroot hosts/permissions, fix Bun crash
- v0.13.6 release: chore(release): bump version to 0.13.6

The intercept mode (#520) was introduced to fix Codex failing with
HTTP_PROXY, but the simpler fix is to just not set HTTP_PROXY for
Codex. The intercept mode introduced a cascade of breakage:
- HTTPS can't be transparently intercepted (needs CONNECT method)
- Image version bumps required lock file recompilation
- host.docker.internal traffic crashed Squid under load
- Multiple PRs needed to fix each regression

This reverts to the pre-#520 explicit proxy mode (HTTP_PROXY/HTTPS_PROXY
pointing to Squid port 3128) which worked for all engines.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mossaka added a commit that referenced this pull request Feb 6, 2026
Reverts the following PRs which introduced unnecessary complexity:

- #520: fix: enable Squid intercept mode for NAT-redirected traffic
- v0.13.5 release: chore(release): bump version to 0.13.5
- #524: fix: remove HTTP_PROXY/HTTPS_PROXY env vars from agent container
- #526: chore: recompile workflow lock files for AWF v0.13.5
- #527: fix: recompile lock files with release action mode
- #522: fix: mount /etc/hosts in chroot and fix HTTP blocking test
- #530: fix: restore HTTPS_PROXY, fix chroot hosts/permissions, fix Bun crash
- v0.13.6 release: chore(release): bump version to 0.13.6

The intercept mode (#520) was introduced to fix Codex failing with
HTTP_PROXY, but the simpler fix is to just not set HTTP_PROXY for
Codex. The intercept mode introduced a cascade of breakage:
- HTTPS can't be transparently intercepted (needs CONNECT method)
- Image version bumps required lock file recompilation
- host.docker.internal traffic crashed Squid under load
- Multiple PRs needed to fix each regression

This reverts to the pre-#520 explicit proxy mode (HTTP_PROXY/HTTPS_PROXY
pointing to Squid port 3128) which worked for all engines.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codex smoke test fails: HTTP_PROXY points to port 3128 but explicit proxy is unreachable from agent container

1 participant