Skip to content

fix: filter workflow commands from microVM output - #7892

Merged
lpcox merged 2 commits into
mainfrom
lpcox-filter-workflow-commands
Aug 31, 2026
Merged

fix: filter workflow commands from microVM output#7892
lpcox merged 2 commits into
mainfrom
lpcox-filter-workflow-commands

Conversation

@lpcox

@lpcox lpcox commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a streaming, byte-preserving GitHub Actions workflow-command filter at the microVM runner-output boundary
  • handle VSOCK chunk splits, CRLF, runner-recognized Unicode whitespace, invalid UTF-8, long lines, timeout finalization, and writable backpressure
  • retain exact raw guest stdout/stderr as bounded 1 MiB private diagnostic tails and persist them to configured audit directories
  • document the security boundary and the decision to allow no guest-originated workflow commands

Validation

  • npm test -- --runInBand (330 suites, 5,285 tests)
  • focused microVM tests (4 suites, 87 tests)
  • npm run type-check
  • npm run build
  • npm run lint
  • npm run lint:md

Neutralize untrusted Actions command syntax at the runner-facing boundary.

Retain bounded raw guest output for diagnostics and audit.

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:38
@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 1627692

@lpcox lpcox changed the title Filter workflow commands from microVM output fix(microvm): filter workflow commands from guest output Aug 31, 2026
@lpcox lpcox changed the title fix(microvm): filter workflow commands from guest output fix: filter workflow commands from microVM output Aug 31, 2026

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

Legacy runner commands remain executable, and transport failures can discard buffered ordinary output.

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

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

New issues introduced by this change (2)
Severity Finding
Medium severity src/​microvm/​vsock-client.ts — This finalizer is only called for result/error frames and cancellation-grace expiry. Transport…
High severity src/​microvm/​workflow-command-filter.ts — This only neutralizes the ::...:: form, so a guest can still invoke the runner's legacy workflow…
What changed in this PR

Adds host-side filtering and private auditing for untrusted microVM output.

Changes:

  • Neutralizes workflow-command syntax across streamed output.
  • Captures bounded raw stdout/stderr audit tails.
  • Documents and tests filtering, backpressure, and persistence behavior.
File Description
src/​microvm/​workflow-command-filter.ts Implements streaming command filtering.
src/​microvm/​workflow-command-filter.test.ts Tests filtering edge cases.
src/​microvm/​vsock-client.ts Filters presented output and captures raw bytes.
src/​microvm/​vsock-client.test.ts Tests VSOCK filtering and finalization.
src/​cloud-hypervisor/​manager.ts Manages bounded guest-output captures.
src/​cloud-hypervisor/​manager.test.ts Tests capture and audit persistence.
src/​cloud-hypervisor/​diagnostics.ts Writes private raw-output artifacts.
src/​cloud-hypervisor-runtime-backend.ts Enables filtering and audit collection.
src/​cloud-hypervisor-runtime-backend.test.ts Tests backend integration.
docs/​cloud-hypervisor-foundation.md Documents the output security boundary.

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

Comment thread src/microvm/vsock-client.ts
Comment thread src/microvm/workflow-command-filter.ts
@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.92% 📈 +0.06%
Statements 92.67% 92.68% 📈 +0.01%
Functions 93.24% 93.19% 📉 -0.05%
Branches 86.14% 86.17% 📈 +0.03%
📁 Per-file Coverage Changes (5 files)
File Lines (Before → After) Statements (Before → After)
src/microvm/vsock-client.ts 97.3% → 96.3% (-1.05%) 93.8% → 92.5% (-1.27%)
src/cloud-hypervisor-runtime-backend.ts 96.3% → 96.3% (+0.03%) 93.5% → 93.5% (+0.05%)
src/cloud-hypervisor/manager.ts 88.9% → 89.4% (+0.50%) 87.5% → 88.0% (+0.53%)
src/cloud-hypervisor/diagnostics.ts 84.7% → 87.2% (+2.53%) 82.8% → 85.4% (+2.66%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)
✨ New Files (1 files)
  • src/microvm/workflow-command-filter.ts: 98.8% lines

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

Neutralize legacy runner commands and flush filter state on transport failures.

Add regression coverage for split commands, disconnects, and stream errors.

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

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

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

@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.86% 93.94% 📈 +0.08%
Statements 92.67% 92.70% 📈 +0.03%
Functions 93.24% 93.32% 📈 +0.08%
Branches 86.14% 86.18% 📈 +0.04%
📁 Per-file Coverage Changes (5 files)
File Lines (Before → After) Statements (Before → After)
src/microvm/vsock-client.ts 97.3% → 97.3% (-0.06%) 93.8% → 93.5% (-0.34%)
src/cloud-hypervisor-runtime-backend.ts 96.3% → 96.3% (+0.03%) 93.5% → 93.5% (+0.05%)
src/cloud-hypervisor/manager.ts 88.9% → 89.4% (+0.50%) 87.5% → 88.0% (+0.53%)
src/cloud-hypervisor/diagnostics.ts 84.7% → 87.2% (+2.53%) 82.8% → 85.4% (+2.66%)
src/log-directory-setup.ts 96.2% → 100.0% (+3.78%) 96.3% → 100.0% (+3.71%)
✨ New Files (1 files)
  • src/microvm/workflow-command-filter.ts: 97.3% 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 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

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

✨ 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

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

🛡️ 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

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

Build Test Suite completed successfully!

Generated by Build Test Suite for #7892

@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

📰 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 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 #7892

@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

Contribution Check failed. Please review the logs for details.

Generated by Contribution Check for #7892

@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

Copy link
Copy Markdown
Contributor

EGRESS_RESULT allow=pass deny=pass

✅ Allowed domain (github.com) reachable: allowed=200
✅ Blocked domain (example.com) denied: proxy 403 CONNECT tunnel failed

Overall: PASS

cc @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: 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: Copilot BYOK (Direct Mode) ✅ PASS

  • ✅ GitHub MCP: Confirmed connectivity (2 recent merged PRs verified)
  • ✅ HTTP Code: 200 (github.com reachable)
  • ✅ File I/O: Read/write operational
  • ✅ BYOK Inference: Active via api-proxy → api.githubcopilot.com

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY)

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

@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 #7892 · claude · haiku45 · 56 AIC · ⊞ 4.5K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

fix(microvm): block legacy workflow commands
fix(microvm): filter workflow commands from guest output
GitHub merged-PR review: ❌
safeinputs-gh PR query: ❌
Playwright title check: ✅
File write/readback: ✅
Discussion query/comment: ❌
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

  • GitHub MCP Testing: ❌
  • GitHub.com Connectivity: ✅
  • File Write/Read Test: ✅
  • BYOK Inference Test: ✅
    Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
    Overall: FAIL

🔑 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

Smoke Test Results: Copilot BYOK (Direct) Mode

Test Results:

  • GitHub MCP connectivity ✅
  • GitHub.com connectivity ✅
  • 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.

Overall: PASS

@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

Smoke Test: Services Connectivity

  • ❌ Redis PING: Temporary failure in name resolution
  • ❌ PostgreSQL pg_isready: no response
  • ❌ PostgreSQL SELECT 1: could not translate host name "host.docker.internal"

Overall: FAIL — DNS resolution for host.docker.internal failed inside AWF sandbox.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Docker Sbx Validation

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

Chroot Version Comparison

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

Overall: FAILED — Node.js version mismatch between host and chroot environments. smoke-chroot label not applied.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OpenTelemetry Tracing

  • Module Loadingotel.js loads successfully, exports: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled (+ internal helpers for exporters/workload identity).
  • Test Suiteotel.test.js, otel-fanout.test.js, otel-workload-identity.test.js: 68/68 tests passed.
  • Env Var Forwardingsrc/services/api-proxy-env-config.ts (buildOtelEnv) forwards OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, OTEL_SERVICE_NAME into api-proxy; 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.
  • Token Tracker Integrationtoken-tracker-http.js implements the onUsage callback hook (invoked with normalized usage + model) as the OTEL integration point; otel.js sets gen_ai.usage.input_tokens/gen_ai.usage.output_tokens/gen_ai.response.model attributes and emits a gen_ai.usage span event per GenAI semantic conventions.
  • OTEL Diagnostics — No spans exported this run (expected: no live LLM traffic was proxied during this smoke test; no otel.jsonl diagnostic artifacts found). Graceful degradation confirmed — no errors from missing OTEL config.

Result: All 5 scenarios pass or are expected-pending. 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

🏗️ 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 (ran, output "Hello, World!") ✅ PASS
.NET json-parse N/A (ran, output correct JSON) ✅ 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:

  • All repositories cloned successfully; the AWF firewall (Squid proxy at squid-proxy:3128) permitted all required network access (git clone, package registry downloads, Deno module fetches).
  • Java builds initially failed with Could not create local repository at /home/runner/.m2/repository due to a pre-existing filesystem permission issue in the runner environment (~/.m2 owned by root, not writable by runner) — unrelated to the firewall. Worked around by pointing <localRepository> in ~/.m2/settings.xml to a writable path (/tmp/gh-aw/agent/m2-repo); both Maven proxy settings for Squid remained active and worked correctly. After the workaround, both Java projects compiled and passed tests.
  • No other issues encountered.

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

@lpcox
lpcox merged commit cafe45f into main Aug 31, 2026
168 of 170 checks passed
@lpcox
lpcox deleted the lpcox-filter-workflow-commands branch August 31, 2026 15:51
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