Skip to content

Strip stale raw-network capabilities from agent images - #7659

Merged
lpcox merged 3 commits into
mainfrom
copilot/github-issue-7658-fix-security-finding
Aug 23, 2026
Merged

Strip stale raw-network capabilities from agent images#7659
lpcox merged 3 commits into
mainfrom
copilot/github-issue-7658-fix-security-finding

Conversation

Copilot AI commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

ping and mtr-packet retained inert cap_net_raw file capabilities in runner-based agent images, creating unnecessary attack surface if the capability bounding set regresses.

  • Image hardening

    • Strip all file capabilities from both binaries when present.
    • Fail the image build if capability removal does not succeed.
  • Regression coverage

    • Verify the Dockerfile covers both binaries and retains fail-closed validation.

Copilot AI linked an issue Aug 23, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix security finding for issue #7658 Strip stale raw-network capabilities from agent images Aug 23, 2026
Copilot AI requested a review from lpcox August 23, 2026 15:40
@lpcox
lpcox marked this pull request as ready for review August 23, 2026 15:42
Copilot AI balanced review requested due to automatic review settings August 23, 2026 15:42

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

Hardens agent images by removing stale raw-network file capabilities.

Changes:

  • Removes capabilities from ping and mtr-packet.
  • Adds static regression coverage for the Dockerfile hardening.
Show a summary per file
File Description
containers/agent/Dockerfile Adds capability removal and validation.
scripts/ci/agent-dockerfile-security.test.ts Checks for the hardening block.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Comment thread containers/agent/Dockerfile Outdated
Comment on lines +113 to +117
setcap -r "$binary" 2>/dev/null || true; \
if getcap "$binary" | grep -q .; then \
echo "ERROR: Failed to remove file capabilities from $binary" >&2; \
exit 1; \
fi; \
Comment on lines +14 to +16
expect(hardeningBlock).toContain('setcap -r "$binary"');
expect(hardeningBlock).toContain('getcap "$binary"');
expect(hardeningBlock).toContain('exit 1');
@lpcox

lpcox commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

@github-actions

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.

Copilot AI commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed in 84bf722: capability inspection/removal now fails closed, and the regression test exercises failing getcap/setcap stubs plus the no-capability path. Targeted Jest test and CodeQL both pass.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.71% 93.73% 📈 +0.02%
Statements 92.57% 92.59% 📈 +0.02%
Functions 92.88% 92.88% ➡️ +0.00%
Branches 85.82% 85.84% 📈 +0.02%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)

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

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini reports failed. Facets need polishing...

💎 Faceted by Smoke Gemini

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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

Warning

Firewall blocked 3 domains

The following domains were blocked by the firewall during workflow execution:

  • msfeed2.pkgs.visualstudio.com
  • msfeed25.pkgs.visualstudio.com
  • registry.npmjs.org

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

network:
  allowed:
    - defaults
    - "msfeed2.pkgs.visualstudio.com"
    - "msfeed25.pkgs.visualstudio.com"
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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

📰 BREAKING: Report filed by Smoke Docker Sbx

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

🔌 Service connectivity validated by Smoke Services

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

Generated by Smoke Claude for #7659

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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

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

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅

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

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

Generated by Build Test Suite for #7659

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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

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

@lpcox
lpcox deployed to aoai-model August 23, 2026 16:35 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Status
API ✅ PASS
GitHub CLI ✅ PASS
File ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #7659 · haiku45 · 32.7 AIC · ⊞ 4.5K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine

Overall: PASS

cc @lpcox

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

@github-actions github-actions Bot added smoke-copilot smoke-copilot-network-isolation Copilot network-isolation egress smoke test labels Aug 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (api.github.com) reachable — HTTP 200
✅ Blocked domain (example.com) denied — 403 CONNECT tunnel failed

Overall: PASS

@lpcox network isolation egress enforcement working as expected.

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

Copy link
Copy Markdown
Contributor

✅ Direct BYOK Smoke Test PASSED

Test Results:

  • ✅ GitHub MCP connectivity (list_pull_requests)
  • ✅ GitHub.com connectivity (HTTP 200)
  • ✅ File write/read test
  • ✅ BYOK inference working (direct mode via api-proxy → api.githubcopilot.com)

Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY) with api-proxy sidecar injection

Status: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Services Connectivity

  • Redis PING: ❌ (Temporary failure in name resolution)
  • pg_isready: ❌ (no response)
  • PostgreSQL SELECT 1: ❌ (could not translate host name)

Overall: FAILhost.docker.internal did not resolve in the AWF sandbox.

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

@github-actions

Copy link
Copy Markdown
Contributor

Docker Sbx Smoke Test

Overall: PASS

cc @lpcox

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

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox @Copilot

Smoke test results for Strip stale raw-network capabilities from agent images:

  • MCP API: ✅
  • GitHub.com connectivity: ✅
  • File I/O: ✅
  • Direct BYOK mode: ✅

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)

Overall: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison

Runtime Host Version Chroot Version Match?
Python 3.12.14 3.12.14 ✅ YES
Node.js v24.19.0 v22.23.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Not all tests passed — Node.js version differs between host and chroot environment. smoke-chroot label was not added.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test: FAIL

PR titles:

Overall status: FAIL

Warning

Firewall blocked 3 domains

The following domains were blocked by the firewall during workflow execution:

  • msfeed2.pkgs.visualstudio.com
  • msfeed25.pkgs.visualstudio.com
  • registry.npmjs.org

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

network:
  allowed:
    - defaults
    - "msfeed2.pkgs.visualstudio.com"
    - "msfeed25.pkgs.visualstudio.com"
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex
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 passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — PASS

Notes:

  • Java Maven builds initially failed with LocalRepositoryNotAccessibleException because ~/.m2 is root-owned in this environment; resolved by pointing <localRepository> in settings.xml to a writable path (/tmp/gh-aw/agent/m2repo) alongside the required proxy config. No firewall-related issue.
  • All other ecosystems built, installed dependencies, and ran tests successfully through the AWF proxy with no network/firewall errors.

Generated by Build Test Suite for #7659 · auto · 43.9 AIC · ⊞ 12K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

OTel Tracing Smoke Test Results

  • ✅ Scenario 1 (Module Loading): otel.js loaded successfully, isEnabled: true, exports include startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled.
  • ✅ Scenario 2 (Test Suite): 3 suites / 68 tests passed (otel.test.js, otel-fanout.test.js, otel-workload-identity.test.js).
  • ✅ Scenario 3 (Env Var Forwarding): env-passthrough.ts forwards GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID to the agent; api-proxy-env-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, and the trace context to api-proxy.
  • ✅ Scenario 4 (Token Tracker Integration): token-tracker-http.js contains the onUsage callback hook point.
  • ✅ Scenario 5 (OTEL Diagnostics): No otel.jsonl span file was produced this run (no live LLM traffic through api-proxy to generate spans), but token-usage.jsonl (10 records) confirms the proxy ran without errors — graceful degradation confirmed, no failures.

All scenarios pass or are expected-pending. No regressions detected.

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

@lpcox
lpcox deployed to aoai-model August 23, 2026 16:41 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

Strip stale raw-network capabilities from agent images

  • 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

cc @lpcox @Copilot

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

@lpcox
lpcox deployed to aoai-model August 23, 2026 16:41 — with GitHub Actions Active
@lpcox
lpcox merged commit 883eba7 into main Aug 23, 2026
158 of 160 checks passed
@lpcox
lpcox deleted the copilot/github-issue-7658-fix-security-finding branch August 23, 2026 17:06
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.

Security finding

3 participants