Skip to content

feat: verify virtiofsd sandbox confinement before VM boot - #7890

Merged
lpcox merged 3 commits into
mainfrom
lpcox-verify-virtiofsd-sandbox
Aug 31, 2026
Merged

feat: verify virtiofsd sandbox confinement before VM boot#7890
lpcox merged 3 commits into
mainfrom
lpcox-verify-virtiofsd-sandbox

Conversation

@lpcox

@lpcox lpcox commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • verify every Cloud Hypervisor virtiofsd parent and sandbox worker from /proc before its socket enters vm.create
  • enforce launch identity, reviewed UID/GID and capability state, NoNewPrivs, seccomp filter mode, isolated mount/PID/network namespaces, pivoted export root, exact cgroup v2 membership, and a scrubbed environment
  • explicitly assign identity-checked workers to the run cgroup, persist mode-0600 confinement evidence, and preserve failure evidence before partial-start cleanup
  • document the boundary and add fail-closed, cgroup-race, evidence, and orchestration coverage

The verification model follows github/agent-microvm v0.9.0 commit 9ca223049a3af490df168cbb74233ab438aceefb.

Validation

  • npm test -- --runInBand (329 suites, 5277 tests)
  • npm run type-check -- --pretty false
  • npm run build -- --pretty false
  • targeted ESLint and Markdownlint (no errors)

Fail closed before VM creation unless every virtiofsd parent and worker matches the expected process identity, capabilities, namespaces, root, cgroup, seccomp, and scrubbed environment. Preserve confinement evidence for runtime diagnostics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 31, 2026 14:34
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation build failed for this PR. View logs.

Built from commit eb65981

@lpcox lpcox changed the title Verify virtiofsd sandbox confinement before VM boot feat: verify virtiofsd sandbox confinement before VM boot Aug 31, 2026
@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 93.86% 93.77% 📉 -0.09%
Statements 92.67% 92.57% 📉 -0.10%
Functions 93.24% 93.28% 📈 +0.04%
Branches 86.14% 85.94% 📉 -0.20%
📁 Per-file Coverage Changes (4 files)
File Lines (Before → After) Statements (Before → After)
src/cloud-hypervisor/manager-start.ts 98.2% → 96.8% (-1.39%) 98.3% → 97.0% (-1.34%)
src/cloud-hypervisor/diagnostics.ts 84.7% → 84.2% (-0.49%) 82.8% → 81.8% (-0.94%)
src/cloud-hypervisor/virtiofsd.ts 77.7% → 78.5% (+0.78%) 74.8% → 75.9% (+1.04%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)
✨ New Files (1 files)
  • src/cloud-hypervisor/virtiofsd-sandbox.ts: 85.4% lines

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.

Copilot review overview

🟡 Changes recommended

Worker capability verification is incomplete, and several security invariants lack negative coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity · 1 Low severity

New issues introduced by this change (2)
Severity Finding
Medium severity src/​cloud-hypervisor/​virtiofsd-sandbox.ts — The worker check ignores CapInh and CapBnd, even though both are collected as part of the…
Low severity src/​cloud-hypervisor/​virtiofsd.test.ts — The added failure coverage only perturbs the environment and cgroup. None of the other security…
What changed in this PR

Adds pre-boot verification and diagnostic evidence for Cloud Hypervisor virtiofsd sandbox confinement.

Changes:

  • Verifies process identity, capabilities, namespaces, cgroups, environment, and export root.
  • Persists confinement evidence before VM creation and during startup failures.
  • Adds orchestration tests and documents the security boundary.
File Description
src/​cloud-hypervisor/​vm-config-builder.test.ts Updates device fixture with evidence path.
src/​cloud-hypervisor/​virtiofsd.ts Integrates verification and evidence tracking.
src/​cloud-hypervisor/​virtiofsd.test.ts Tests failure handling and evidence creation.
src/​cloud-hypervisor/​virtiofsd-sandbox.ts Implements procfs confinement verification.
src/​cloud-hypervisor/​manager.test.ts Tests startup evidence preservation.
src/​cloud-hypervisor/​manager-start.ts Preserves evidence before cleanup.
src/​cloud-hypervisor/​diagnostics.ts Copies evidence into diagnostics.
docs/​cloud-hypervisor-foundation.md Documents confinement guarantees.

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

Comment thread src/cloud-hypervisor/virtiofsd-sandbox.ts
Comment thread src/cloud-hypervisor/virtiofsd.test.ts
lpcox and others added 2 commits August 31, 2026 09:13
Resolve the Cloud Hypervisor lifecycle documentation overlap with #7889 and add negative-path verifier coverage so the branch preserves main's aggregate coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Require empty worker inheritable capabilities and a bounding set that contains the reviewed runtime mask. Expand negative-path coverage across every confinement invariant.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.82% 93.89% 📈 +0.07%
Statements 92.60% 92.68% 📈 +0.08%
Functions 93.23% 93.27% 📈 +0.04%
Branches 85.97% 86.00% 📈 +0.03%
📁 Per-file Coverage Changes (4 files)
File Lines (Before → After) Statements (Before → After)
src/cloud-hypervisor/manager-start.ts 96.6% → 95.5% (-1.16%) 96.8% → 95.7% (-1.12%)
src/cloud-hypervisor/diagnostics.ts 87.4% → 87.6% (+0.25%) 85.6% → 85.3% (-0.24%)
src/cloud-hypervisor/virtiofsd.ts 79.0% → 79.7% (+0.69%) 77.3% → 78.2% (+0.88%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)
✨ New Files (1 files)
  • src/cloud-hypervisor/virtiofsd-sandbox.ts: 100.0% lines

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

@github-actions

github-actions Bot commented Aug 31, 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 31, 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 31, 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 31, 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 31, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

🔌 Service connectivity validated by Smoke Services

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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

Tested by Smoke Chroot

@github-actions

github-actions Bot commented Aug 31, 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)

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

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

Warning

Firewall blocked 2 domains

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

  • 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
    - "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 31, 2026

Copy link
Copy Markdown
Contributor

Contribution Check failed. Please review the logs for details.

Generated by Contribution Check for #7890

@github-actions

github-actions Bot commented Aug 31, 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 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini reports failed. Facets need polishing...

💎 Faceted by Smoke Gemini

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

Generated by Build Test Suite for #7890

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

Warning

Firewall blocked 1 domain

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

  • api.anthropic.com

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

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

Generated by Smoke Claude for #7890

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Security Guard has started processing this pull request

@github-actions

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (github.com) reachable: allowed=200
✅ Non-allowed domain (example.com) blocked: CONNECT tunnel 403

Overall: PASS

@lpcox

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 Aug 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Claude Engine Validation

Check Status
API ✅ PASS
GH CLI ✅ PASS
File ✅ PASS

Overall result: PASS

Warning

Firewall blocked 1 domain

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

  • api.anthropic.com

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

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode ✅ PASS

  • ✅ GitHub MCP connectivity: PR list verified
  • ✅ GitHub.com: HTTP 200
  • ✅ File write/read: BYOK test file confirmed
  • ✅ BYOK inference: Running via api-proxy → api.githubcopilot.com

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) with api-proxy sidecar. All systems nominal.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OTEL Tracing — Results

  • Scenario 1 (Module Loading) ✅ — otel.js loads cleanly; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled plus internal helpers (_provider, exporters, parsers).
  • Scenario 2 (Test Suite) ✅ — 3 suites / 68 tests passed (otel.test.js, otel-fanout.test.js, otel-workload-identity.test.js), 0 failures.
  • Scenario 3 (Env Var Forwarding) ✅ — src/services/agent-environment/env-passthrough.ts forwards GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID/COPILOT_OTEL_FILE_EXPORTER_PATH into the agent container; src/services/api-proxy-env-config.ts forwards OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, trace/span IDs, and sets OTEL_SERVICE_NAME for the api-proxy container.
  • Scenario 4 (Token Tracker Integration) ✅ — token-tracker-http.js defines and invokes the onUsage(normalizedUsage, model) callback as the OTEL hook point after usage normalization.
  • Scenario 5 (OTEL Diagnostics) ✅ — Spans were exported during this run; /tmp/gh-aw/otel.jsonl contains a valid OTLP resourceSpans payload with gh-aw.agent.setup span, correct trace/span IDs matching GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID, and GenAI resource attributes.

Overall: All 5 scenarios pass. No issues found.

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

@github-actions

Copy link
Copy Markdown
Contributor

Docker Sbx Smoke Test@lpcox

Overall: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

fix: filter workflow commands from microVM output
feat: verify Cloud Hypervisor runtime confinement

GitHub MCP review: ❌
safeinputs-gh PR query: ❌
Playwright title check: ✅
File write/read: ✅
Discussion query/comment: ❌
Build (npm ci && npm run build): ✅

Overall: FAIL

Warning

Firewall blocked 2 domains

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

  • 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
    - "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

@lpcox

fix: filter workflow commands from microVM output (PR #7892): ✅
feat: verify Cloud Hypervisor runtime confinement (PR #7889): ✅
MCP PR data: ✅
github.com connectivity: ✅
agent file I/O: ✅
BYOK inference: ✅

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

🏗️ 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 (run OK) ✅ PASS
.NET json-parse N/A (run OK) ✅ PASS
Go color ok ✅ PASS
Go env ok ✅ PASS
Go uuid ok ✅ 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

Note: Java initially failed with [ERROR] Could not create local repository at /home/runner/.m2/repository because ~/.m2 was pre-owned by root (not writable by the runner user). Worked around it by pointing Maven at a writable local repo via -Dmaven.repo.local=/tmp/gh-aw/agent/m2repo; the configured Squid HTTP/HTTPS proxy settings in settings.xml worked correctly once the repo path issue was resolved. No other failures were observed across all 8 ecosystems.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot Engine@lpcox

Overall: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: GitHub Actions Services Connectivity

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

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

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

@github-actions

Copy link
Copy Markdown
Contributor

fix: filter workflow commands from microVM output — ❌
feat: verify Cloud Hypervisor runtime confinement — ❌
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 status: FAIL
cc @lpcox

🪪 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

Chroot Version Comparison Results

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

Overall: FAILED — Node.js version mismatch between host and chroot environments. smoke-chroot label not added since not all tests passed.

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

@lpcox
lpcox merged commit 23e225f into main Aug 31, 2026
165 of 167 checks passed
@lpcox
lpcox deleted the lpcox-verify-virtiofsd-sandbox branch August 31, 2026 16:41
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.

2 participants