Skip to content

fix: check iptables availability before host firewall setup#5136

Merged
zarenner merged 2 commits into
mainfrom
copilot/check-iptables-installation
Jun 18, 2026
Merged

fix: check iptables availability before host firewall setup#5136
zarenner merged 2 commits into
mainfrom
copilot/check-iptables-installation

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Host firewall setup could report misleading DOCKER-USER chain errors when iptables was not installed at all. This adds an explicit availability check so missing dependencies fail with the actionable root cause.

  • Dependency check

    • Runs iptables --version before inspecting DOCKER-USER.
    • Detects ENOENT / missing-command failures and returns a clear install message.
  • Error handling

    • Preserves existing permission-denied handling.
    • Avoids falling into DOCKER-USER chain creation when the iptables binary is absent.
  • Test coverage

    • Adds focused coverage for missing iptables.
    • Updates host iptables test setup for the new preflight command.

Example failure message:

iptables is required but was not found. Please install iptables and try again.

@zarenner zarenner marked this pull request as ready for review June 18, 2026 04:39
Copilot AI review requested due to automatic review settings June 18, 2026 04:39
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 97.27% 97.28% 📈 +0.01%
Statements 97.15% 97.15% ➡️ +0.00%
Functions 98.81% 98.82% ➡️ +0.01%
Branches 91.94% 91.90% 📉 -0.04%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/host-iptables-rules.ts 100.0% → 98.7% (-1.34%) 100.0% → 98.7% (-1.32%)
src/workdir-setup.ts 92.6% → 94.4% (+1.85%) 92.6% → 94.4% (+1.85%)

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

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

This PR improves host firewall setup diagnostics by explicitly checking that iptables is installed before probing/creating the DOCKER-USER chain, and it updates/extends Jest coverage to exercise the new dependency-check path.

Changes:

  • Add an iptables --version preflight in checkPermissionsAndSetupChain() and convert missing-command failures into a clear “install iptables” error.
  • Extend test helpers and update existing iptables-mocking sequences to account for the new preflight call.
  • Add a focused unit test asserting the missing-iptables behavior and ensuring no DOCKER-USER chain operations are attempted.
Show a summary per file
File Description
src/host-iptables-rules.ts Adds iptables availability preflight + helper utilities used during host firewall setup.
src/test-helpers/host-iptables-test-setup.ts Adds an ENOENT/missing-command mock helper and updates default execa mock sequencing.
src/host-iptables-setup.test.ts Adds coverage for missing iptables and updates other tests’ mock call order for --version.
src/host-iptables-doh.test.ts Updates mock sequencing to include the new iptables --version call.
src/host-iptables-coverage.test.ts Updates targeted branch-coverage test setup to include the new preflight call.

Copilot's findings

Tip

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 1

Comment thread src/host-iptables-rules.ts
Copilot AI requested a review from zarenner June 18, 2026 04:47
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@zarenner zarenner changed the title Check iptables availability before host firewall setup fix: check iptables availability before host firewall setup Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 97.27% 97.58% 📈 +0.31%
Statements 97.15% 97.50% 📈 +0.35%
Functions 98.81% 98.85% 📈 +0.04%
Branches 91.94% 92.91% 📈 +0.97%
📁 Per-file Coverage Changes (7 files)
File Lines (Before → After) Statements (Before → After)
src/host-iptables-rules.ts 100.0% → 98.7% (-1.34%) 100.0% → 98.7% (-1.32%)
src/commands/build-config.ts 92.8% → 93.3% (+0.48%) 92.8% → 93.3% (+0.48%)
src/workdir-setup.ts 92.6% → 94.5% (+1.95%) 92.6% → 94.5% (+1.95%)
src/services/agent-service.ts 97.7% → 100.0% (+2.33%) 97.8% → 100.0% (+2.23%)
src/logs/audit-enricher.ts 89.4% → 95.7% (+6.38%) 83.6% → 95.1% (+11.48%)
src/services/agent-volumes/docker-host-staging.ts 87.2% → 95.7% (+8.51%) 87.8% → 95.9% (+8.16%)
src/commands/validators/log-and-limits.ts 90.3% → 100.0% (+9.68%) 90.3% → 100.0% (+9.68%)
✨ New Files (4 files)
  • src/api-proxy-config-domains.ts: 100.0% lines
  • src/api-proxy-config-validation.ts: 100.0% lines
  • src/api-proxy-config-warnings.ts: 100.0% lines
  • src/api-proxy-env-constants.ts: 100.0% lines

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

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude failed

Smoke test invocation received with no specific task in the user prompt. No GitHub action required — workflow context loaded successfully (skills, CLAUDE.md project guidance, and safe-outputs MCP server all available).

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 18, 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 Jun 18, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — Service connectivity was cancelled ⚠️

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 18, 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 Jun 18, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

Copy link
Copy Markdown
Contributor

🔥 Smoke Test Results

PR: fix: check iptables availability before host firewall setup
Author: @Copilot | Assignees: @zarenner @Copilot

Test Result
GitHub MCP connectivity
GitHub.com connectivity
File write/read

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor

Add comprehensive gVisor firewall comparison workflow ✅
refactor: extract provider env var constants to a shared module ✅
GitHub title check ✅
File write/read ✅
Discussion query/comment ✅
Build ✅
Overall status: PASS

Warning

Firewall blocked 1 domain

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

  • registry.npmjs.org

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

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results — Auth mode: PAT (COPILOT_GITHUB_TOKEN)

Test Result
GitHub MCP connectivity ✅ (PR #5236 retrieved)
GitHub.com HTTP ✅ HTTP 200
File write/read ❌ template vars not substituted (workflow config issue)

Overall: FAIL — file test unverifiable due to unresolved ${{ steps.smoke-data.outputs.* }} variables.

@zarenner @Copilot — pre-step outputs were not injected; the smoke-data step may have failed or its outputs weren't passed through.

🔑 PAT report filed by Smoke Copilot PAT

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Result Details
1. Module Loading otel.js loads cleanly; exports 14 symbols: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled, plus test helpers
2. Test Suite 59 tests passed, 0 failed — across otel.test.js + otel-fanout.test.js
3. Env Var Forwarding api-proxy-service-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, OTEL_SERVICE_NAME
4. Token Tracker Integration onUsage callback present in token-tracker-http.js (line 324) as the OTEL hook point
5. Graceful Degradation No errors without OTEL config; falls back to file exporter at /var/log/api-proxy/otel.jsonl

All 5 scenarios passed.

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

Copy link
Copy Markdown
Contributor

@Copilot @zarenner

  • GitHub MCP: ✅
  • GitHub.com: ✅
  • File write/read: ✅
  • BYOK inference: ✅

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

Status: PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)

@github-actions

Copy link
Copy Markdown
Contributor

Copilot BYOK Smoke Test: PASS ✅

  • ✅ MCP connectivity (GitHub API)
  • ✅ HTTP connectivity (github.com)
  • ✅ File write/read test
  • ✅ BYOK inference path (direct mode via api-proxy)

Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY) → api-proxy sidecar → api.githubcopilot.com

Assignees: @zarenner, @Copilot

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

Copy link
Copy Markdown
Contributor

@Copilot @zarenner

docs: sync schemas and specs with source changes: ✅
[Test Coverage] Add coverage for parsers, services, host-identity: ✅
GitHub.com connectivity: ✅
File I/O test: ✅
BYOK inference: ✅
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)

PASS

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)

@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.3 ❌ No
Node.js v24.16.0 v22.22.3 ❌ No
Go go1.22.12 go1.22.12 ✅ Yes

Overall: ❌ FAILED — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results

  • GitHub MCP Testing: ❌ (Tool github not found in PATH)
  • GitHub.com Connectivity: ✅ (Verified via curl with proxy)
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅

PR Titles:

  1. Add comprehensive gVisor firewall comparison workflow
  2. refactor: extract provider env var constants to a shared module

Overall Status: PASS (Workaround used for GitHub reads)

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

@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 issue #5136 ·

@zarenner zarenner merged commit 9e65405 into main Jun 18, 2026
91 of 98 checks passed
@zarenner zarenner deleted the copilot/check-iptables-installation branch June 18, 2026 20:23
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.

3 participants