fix: disable IPv6 in agent container to prevent squid proxy bypass#1544
fix: disable IPv6 in agent container to prevent squid proxy bypass#1544
Conversation
Always disable IPv6 via sysctl in setup-iptables.sh regardless of ip6tables availability. The awf-net Docker network is IPv4-only and Squid only listens on IPv4, so IPv6 serves no purpose in the agent container. Leaving it enabled causes Node.js happy-eyeballs to prefer IPv6, resulting in connections to ::1 that Squid rejects with transaction-end-before-headers. Also add IPv6 listeners to Squid config (http_port [::]:3128) as defense-in-depth, so any residual IPv6 traffic is handled rather than silently rejected. Closes #1543 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent IPv6-based proxy bypass / connectivity issues in the agent runtime by disabling IPv6 in the agent network namespace and adding an IPv6 listener to the generated Squid configuration as a defense-in-depth measure.
Changes:
- Update
setup-iptables.shto disable IPv6 viasysctlunconditionally in the agent network namespace. - Update
generateSquidConfig()/ SSL-bump config generation to addhttp_port [::]:<port>listeners alongside IPv4.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/squid-config.ts |
Adds IPv6 http_port listeners in both normal and SSL-bump generated Squid configs. |
containers/agent/setup-iptables.sh |
Disables IPv6 unconditionally to prevent IPv6 traffic bypassing IPv4-only NAT redirection. |
Comments suppressed due to low confidence (1)
src/squid-config.ts:431
- Same as above: “(see #1543)” is ambiguous and inconsistent with existing issue-link style in this repo/file. Please change to “gh-aw-firewall issue #1543” or a full #1543 URL.
// Port configuration: Use normal proxy mode (not intercept mode)
// With targeted port redirection in iptables, traffic is explicitly redirected
// to Squid on specific ports (80, 443, + user-specified), maintaining defense-in-depth
// Listen on both IPv4 and IPv6 as defense-in-depth (see #1543)
let portConfig = `http_port ${port}\nhttp_port [::]:${port}`;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Smoke test results for run
Overall: PASS
|
|
Smoke test results (run 23829922222)
Overall: PASS
|
Chroot Version Comparison Results
Overall: ❌ Not all runtimes match — Python and Node.js versions differ between host and chroot environments.
|
This comment has been minimized.
This comment has been minimized.
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
🚬 Smoke test results for PR #1544 —
Overall: PASS
|
|
Smoke Test Results — Run 23830751977
Overall: PASS
|
Chroot Version Comparison Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
Smoke Test: GitHub Actions Services Connectivity ✅All checks passed:
Note:
|
Smoke Test ResultsPR titles: "feat: add token usage tracking to api-proxy sidecar" | "feat: add smoke-services workflow for --allow-host-service-ports e2e testing"
|
|
Smoke Test Results — run 23848925605 ✅ GitHub MCP: #1544 fix: disable IPv6 in agent container to prevent squid proxy bypass, #1539 feat: add token usage tracking to api-proxy sidecar Overall: PASS
|
Problem
Claude Code running inside the AWF chroot fails to reach the Anthropic API because connections arrive at Squid via IPv6 (
::1), which Squid cannot handle. Squid logs 49transaction-end-before-headerserrors matching Claude Code's retry pattern.Reported in github/gh-aw#23765.
Working (API proxy, IPv4):
{"client":"172.30.0.20","host":"api.anthropic.com:443","method":"CONNECT","status":200}Failing (Claude Code, IPv6):
{"client":"::1","host":"-","method":"-","status":0,"decision":"NONE_NONE","url":"error:transaction-end-before-headers"}Root Cause
Three gaps combine:
http_port 3128binds to0.0.0.0, not[::]Node.js happy-eyeballs (RFC 8305) prefers IPv6 when available, so Claude Code's HTTPS connections go via
::1instead of IPv4, bypassing the proxy entirely.Fix
1. Always disable IPv6 in agent container (
setup-iptables.sh)Unconditionally disable IPv6 via
sysctlregardless of ip6tables availability. The awf-net Docker network is IPv4-only and Squid listens on IPv4, so IPv6 serves no purpose:This forces DNS to return only A records (no AAAA), eliminating the happy-eyeballs race.
2. Add IPv6 listener to Squid (
squid-config.ts) — defense-in-depthAdd
http_port [::]:3128alongside the IPv4 listener (both standard and SSL-bump modes). If IPv6 traffic somehow reaches Squid, it can handle it rather than silently rejecting.Testing
Closes #1543