Skip to content

fix: use dst ACL for IP addresses in squid config#821

Closed
lpcox with Claude wants to merge 23 commits into
claude/enable-api-proxy-by-defaultfrom
claude/fix-github-actions-workflow-yet-again
Closed

fix: use dst ACL for IP addresses in squid config#821
lpcox with Claude wants to merge 23 commits into
claude/enable-api-proxy-by-defaultfrom
claude/fix-github-actions-workflow-yet-again

Conversation

@Claude

@Claude Claude AI commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Squid proxy was blocking traffic to api-proxy service at 172.30.0.30:10000 because IP addresses were incorrectly added to dstdomain ACL type, which only accepts domain names.

Changes

  • Added allowedIPs parameter to SquidConfig interface for separate IP address handling
  • Updated generateSquidConfig() to generate dst ACL entries for IP addresses instead of treating them as domains
  • Separated IP from hostname in docker-manager.ts when api-proxy is enabled:
    • Hostname 'api-proxy'dstdomain ACL
    • IP 172.30.0.30dst ACL via new allowedIPs parameter

Generated Squid Config

Before (incorrect):

acl allowed_domains dstdomain api-proxy
acl allowed_domains dstdomain 172.30.0.30  # Wrong ACL type for IP

After (correct):

acl allowed_domains dstdomain api-proxy
acl allowed_ips dst 172.30.0.30           # Correct ACL type for IP
http_access allow allowed_ips

Claude AI and others added 22 commits February 13, 2026 04:38
CODEX was not being directed to use the api-proxy because the
OPENAI_BASE_URL and ANTHROPIC_BASE_URL environment variables were
not explicitly set in the smoke-codex workflow.

While AWF automatically sets these variables when generating the
docker-compose configuration (if API keys are present), explicitly
setting them in the workflow env ensures they are available to the
CODEX agent for routing API calls through the api-proxy sidecar.

This fix adds:
- OPENAI_BASE_URL=http://api-proxy:10000
- ANTHROPIC_BASE_URL=http://api-proxy:10001

to the 'Run Codex' step environment variables.

Fixes job failure in run 63483600453.
* Initial plan

* fix(ci): remove API keys from agent env when api-proxy is enabled

When api-proxy is enabled (indicated by BASE_URL environment variables),
API keys should NOT be exposed to the agent container for security.
The api-proxy sidecar holds the credentials and injects auth headers.

Previously, the workflow was passing both:
- CODEX_API_KEY and OPENAI_API_KEY (should NOT be in agent env)
- OPENAI_BASE_URL and ANTHROPIC_BASE_URL (should be in agent env)

This defeated the security isolation provided by api-proxy.

Changes:
- Removed CODEX_API_KEY and OPENAI_API_KEY from agent environment block
- Kept OPENAI_BASE_URL and ANTHROPIC_BASE_URL for routing to api-proxy
- The awf CLI still receives keys via `sudo -E` and `--env-all`
- awf passes keys only to api-proxy container, not agent container

Security model:
- awf reads keys from host environment (process.env)
- awf passes keys only to api-proxy sidecar (src/docker-manager.ts:908-909)
- Agent only receives BASE_URL variables (src/docker-manager.ts:948-955)
- api-proxy injects auth headers and routes through Squid

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* Initial plan

* fix(firewall): add api-proxy to allowed domains when enabled

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…805)

* Initial plan

* fix(squid): handle bare hostnames without leading dot for api-proxy

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
#807)

* Initial plan

* fix(agent): enable direct api-proxy access and remove api key from env

- Add iptables bypass for api-proxy in setup-iptables.sh
- Pass AWF_ENABLE_API_PROXY env var from docker-manager.ts
- Remove ANTHROPIC_API_KEY from agent env in workflows
- Update postprocess script to strip API key from compiled workflows

Fixes agent->api-proxy connectivity and security vulnerability where
API key was exposed to agent container instead of isolated to api-proxy.

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
* Initial plan

* fix: pass ANTHROPIC_API_KEY to validation step in smoke-claude workflow

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

* fix: pass ANTHROPIC_API_KEY to validation in all Claude workflows

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* Initial plan

* fix: only enable api-proxy when API keys are provided

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

* feat(workflow): enable api-proxy for smoke-claude workflow

- Add --enable-api-proxy flag to awf command
- Add --anthropic-api-key flag to pass API key to api-proxy sidecar
- Add ANTHROPIC_API_KEY to env block for agent step
- API key is shared with api-proxy, kept out of agent container
- Agent uses ANTHROPIC_BASE_URL to direct requests to api-proxy

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

* refactor(workflow): remove redundant --enable-api-proxy flag

The --enable-api-proxy flag defaults to true (src/cli.ts:724), so it
doesn't need to be explicitly specified. The api-proxy sidecar will
automatically deploy when API keys are present.

See docs/api-proxy-sidecar.md:51 which states "The API proxy is
enabled by default and automatically deploys when API keys are present"

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…ow (#811)

* Initial plan

* fix: remove unknown --anthropic-api-key flag from smoke-claude workflow

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* Initial plan

* fix: use api-proxy IP address instead of hostname for BASE_URL

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…#815)

* Initial plan

* fix: use api-proxy IP address instead of hostname for BASE_URL (#813)

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
In chroot mode, Docker container hostname resolution can fail because
the DNS resolver may not properly reach Docker's embedded DNS. Use the
api-proxy IP address directly (e.g., http://172.30.0.30:10001) instead
of the hostname (http://api-proxy:10001) to eliminate DNS resolution as
a failure point.

Also add test coverage for the host-iptables api-proxy ACCEPT rule.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Initial plan

* fix: exclude API keys from agent when api-proxy is enabled

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
…#817)

* Initial plan

* fix(agent): use AWF_API_PROXY_IP env var for api-proxy iptables

Move api-proxy iptables rules to use pre-set AWF_API_PROXY_IP environment
variable instead of dynamic hostname resolution, and place FILTER rules in
the correct position (after NAT setup, before final DROP rule).

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…er (#816)

* Initial plan

* feat: add debug logging for BASE_URL environment variables

Add logging to display ANTHROPIC_BASE_URL and OPENAI_BASE_URL values
that are set for the agent container. This helps debug configuration
issues when running Claude Code CLI in the workflow.

The logging is added after the Docker Compose config is generated,
showing whether BASE_URL variables are set or using defaults.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
* Initial plan

* fix: simplify api-proxy iptables bypass condition

The NAT bypass for api-proxy traffic was checking both AWF_ENABLE_API_PROXY
and AWF_API_PROXY_IP, but this was too strict. When the HTTP_PROXY
environment variable is set, HTTP clients will send requests through the
proxy unless NO_PROXY is configured or iptables rules prevent it.

The issue was that the NAT bypass required both flags, causing traffic
to 172.30.0.30 (api-proxy) to be sent through Squid when it should go
directly. Squid then blocked these requests because the IP address wasn't
in the domain whitelist.

The fix simplifies the condition to only check AWF_API_PROXY_IP, matching
the pattern used for the OUTPUT FILTER ACCEPT rules (lines 285-289).
This ensures that when AWF_API_PROXY_IP is set, traffic to that IP
bypasses Squid at the NAT level, preventing HTTP clients from routing
through the proxy regardless of HTTP_PROXY settings.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
* Initial plan

* fix: add api-proxy IP to squid allowlist

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Base automatically changed from claude/fix-github-actions-workflow-again to claude/enable-api-proxy-by-default February 13, 2026 07:52
@Claude Claude AI changed the title [WIP] Fix failing GitHub Actions workflow agent fix: use dst ACL for IP addresses in squid config Feb 13, 2026
@Claude Claude AI requested a review from lpcox February 13, 2026 07:52
@Mossaka

Mossaka commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Closing PR in favor of tracking issue #835.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants