Skip to content

fix: allow --enable-host-access with --network-isolation (topology mode) - #6657

Merged
lpcox merged 3 commits into
mainfrom
copilot/awf-fix-network-isolation-conflict
Jul 28, 2026
Merged

fix: allow --enable-host-access with --network-isolation (topology mode)#6657
lpcox merged 3 commits into
mainfrom
copilot/awf-fix-network-isolation-conflict

Conversation

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The gh-aw compiler emits network.isolation: true + topologyAttach alongside security.enableHostAccess: true (auto-triggered when localhost is in the domain allowlist). AWF was rejecting this combination — either a hard error in legacy mode or a silent suppression with a misleading "pass --legacy-security" warning in strict mode.

The mutual exclusion was wrong: in topology mode the agent runs on an internal Docker network with no host route, so no iptables-based host access is ever configured. --enable-host-access in that mode drives Squid port ACLs and the host.docker.internal hosts-file entry for topology peers — neither of which requires host-level iptables.

Changes

  • infrastructure-validator.ts — removes the hard error for networkIsolation + enableHostAccess; replaces it with a comment explaining the combination is intentionally valid.

  • security-mode.ts — adds && !config.networkIsolation to the strict-mode suppression block for enableHostAccess/allowHostPorts. Since strict mode forces networkIsolation = true before this check runs, host-access options are now preserved in all standard Docker-compose runs. allowHostServicePorts (iptables-based GitHub Actions services) is still suppressed unconditionally.

  • Testsconfig-assembly-flags.test.ts repurposed from "should exit" to "should accept" for the combination; security-mode.test.ts updated to assert enableHostAccess is preserved in topology mode and allowHostServicePorts is still cleared.

  • docs/network-isolation-design.md — updated §8.1 to reflect that --enable-host-access is no longer rejected alongside --network-isolation.

In network-isolation mode the agent runs on an internal Docker network
with no direct host route, so host-level iptables are never configured.
The --enable-host-access flag in that mode drives Squid port ACLs and
the host.docker.internal hosts-file entry for topology peers
(--topology-attach) rather than iptables rules, making the combination
safe and valid.

Before this change:
- strict mode: silently disabled enableHostAccess with a misleading
  "pass --legacy-security" warning even though legacy-security +
  enableHostAccess + networkIsolation would hard-error in the validator
- legacy mode: hard error "not supported with --enable-host-access"

After this change:
- enableHostAccess is preserved when networkIsolation=true (strict mode
  always forces networkIsolation=true, so the suppression block is only
  reached when networkIsolation=false, which never happens in strict mode)
- The hard error in validateFeatureFlagCompatibility is removed; a
  comment explains why the combination is intentionally allowed
- allowHostServicePorts (iptables-based GitHub Actions services) is
  still suppressed in strict mode regardless of topology mode

Closes #6651
Copilot AI changed the title [WIP] Fix network isolation conflict with host access fix: allow --enable-host-access with --network-isolation (topology mode) Jul 27, 2026
Copilot finished work on behalf of lpcox July 27, 2026 20:12
Copilot AI requested a review from lpcox July 27, 2026 20:12
@lpcox
lpcox marked this pull request as ready for review July 27, 2026 22:49
Copilot AI review requested due to automatic review settings July 27, 2026 22:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Allows host-access options to coexist with topology-based network isolation.

Changes:

  • Removes the incompatible-option rejection.
  • Preserves host-access settings in strict topology mode.
  • Updates tests and network-isolation documentation.
Show a summary per file
File Description
src/commands/validators/security-mode.ts Preserves topology-compatible host access.
src/commands/validators/security-mode.test.ts Updates strict-mode expectations.
src/commands/validators/infrastructure-validator.ts Removes mutual-exclusion validation.
src/commands/validators/config-assembly-flags.test.ts Verifies the combination is accepted.
docs/network-isolation-design.md Documents the new compatibility.

Review details

Tip

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Medium

// NOTE: at this point in the pipeline, networkIsolation has already been
// forced to true above (for non-microVM runtimes), so
// !config.networkIsolation is false for standard Docker-compose runs.
if (config.enableHostAccess && !config.networkIsolation) {
Comment on lines +63 to +66
// NOTE: at this point in the pipeline, networkIsolation has already been
// forced to true above (for non-microVM runtimes), so
// !config.networkIsolation is false for standard Docker-compose runs.
if (config.enableHostAccess && !config.networkIsolation) {
@lpcox

lpcox commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed in 193466e.

I updated strict-mode handling so microVM runtimes still suppress enableHostAccess even if networkIsolation: true, and fixed topology-mode routing so host-gateway entries are no longer injected into NO_PROXY/hosts in compose topology mode. I also added compose-level and unit test assertions for this behavior.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit 8a9b83e

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

Contribution check complete: PR #6657 follows the applicable CONTRIBUTING.md guidelines. It includes tests for the new behavior, updates documentation, has a clear description with a related issue reference, and keeps files in the expected src/ and docs/ locations.

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Result
API status ✅ PASS
GH check ✅ PASS
File status ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #6657 · haiku45 · 30.9 AIC · ⊞ 3.3K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) ✅

Test Results:

  • ✅ MCP connectivity verified (PR data accessible)
  • ✅ GitHub.com reachable (HTTP 200)
  • ✅ File write/read working (smoke-test-copilot-byok.txt)
  • ✅ BYOK inference path operational (agent → api-proxy → api.githubcopilot.com)

Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY via api-proxy sidecar)

Status: PASS

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox — Smoke test: Copilot network isolation egress enforcement

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (api.github.com) — HTTP 200
✅ Blocked domain (example.com) — 403 proxy denial

Overall: PASS

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions github-actions Bot added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results — Services Connectivity

Check Result
Redis PING ❌ Name resolution failed for host.docker.internal
PostgreSQL pg_isready ❌ No response
PostgreSQL SELECT 1 ❌ Name resolution failed

Overall: FAILhost.docker.internal is not resolvable in this environment. The AWF sandbox cannot reach the GitHub Actions service containers.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions github-actions Bot mentioned this pull request Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📡 OTel Tracing Smoke Test Results

Scenario Status Notes
S1: Module Loading otel.js loads; exports: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled + internals. isEnabled: true.
S2: Test Suite 59 passed, 0 failed across 2 test suites (otel.test.js, otel-fanout.test.js) in 2.1s
S3: Env Var Forwarding ⚠️ OTEL_EXPORTER_OTLP_ENDPOINT / GITHUB_AW_OTEL_TRACE_ID not yet forwarded in src/services/api-proxy-service.ts — expected during development
S4: Token Tracker Integration token-tracker-http.js has onUsage callback (4 occurrences)
S5: OTEL Diagnostics i️ No span file at runtime (api-proxy not live during smoke test) — expected

Overall: ✅ All implemented scenarios pass. S3 env-var forwarding is a known pending item (development phase).

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Gemini Engine Validation

  • GitHub MCP Testing: ❌ (Blocked by integrity policy)
  • GitHub.com Connectivity: ❌ (Transparent proxy failed)
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅

Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.13 ✅ YES
Node.js v24.18.0 v22.23.1 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: ❌ FAILED — Node.js version mismatch (host: v24.18.0, chroot: v22.23.1).

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx All passed ✅ PASS
Node.js execa All passed ✅ PASS
Node.js p-limit All passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for #6657 · sonnet46 · 22.2 AIC · ⊞ 8.3K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Smoke Test: Docker Sbx — PASS

Test Result
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read

Overall: PASS

@lpcox

📰 BREAKING: Report filed by Smoke Docker Sbx
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

✅ Playwright GitHub title check
✅ Temp file write/read check
npm ci && npm run build
⚠️ Merged PR review and discussion query were unavailable in this runner
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox smoke test results:

  • GitHub MCP Connectivity: ✅
  • GitHub.com Connectivity: ✅
  • File Write/Read Test: ✅
  • BYOK Inference Test: ✅

Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra

Overall PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox

GitHub MCP connectivity: ["fix: allow --enable-host-access with --network-isolation (topology mode)", "docs: Runner Doctor 2026-07-27 scan — B13 update + B15/B16 new failure modes"] ✅
GitHub.com connectivity ✅
File I/O ✅
Direct BYOK mode ✅
Overall: PASS
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)
Add label ready-for-aw to run again

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.

[awf] cli: --network-isolation conflicts with auto-enabled --enable-host-access for localhost allowlist

3 participants