Skip to content

fix: harden temporary artifact handling - #8663

Merged
lpcox merged 2 commits into
mainfrom
pelikhan-security-remediations
Sep 17, 2026
Merged

lpcox merged 2 commits into
mainfrom
pelikhan-security-remediations

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

Remediates every finding tracked by github/vuln-mgmt#251067 for github/gh-aw-firewall.

  • github/vuln-mgmt#251055: removes the predictable timestamp-based default work directory and creates defaults atomically with mkdtempSync; validates reused directories as real directories with trusted root/SUDO_UID-aware ownership and rejects group/world-writable modes.
  • github/vuln-mgmt#251064: writes enclave-audit-incomplete.txt through the shared descriptor-based no-follow writer with fstat, fchmod, fsync, and guaranteed close; adds a real-filesystem symlink regression proving the external target remains unchanged.
  • github/vuln-mgmt#251043, github/vuln-mgmt#251057, github/vuln-mgmt#251053, github/vuln-mgmt#251047, github/vuln-mgmt#251040, github/vuln-mgmt#251065, github/vuln-mgmt#251061, github/vuln-mgmt#251063: replaces test-only URL/domain substring assertions with exact ACL-line equality and removes the redundant diagnostics substring lookup, without changing production domain matching.
  • Cleans fixed /tmp fixtures in the implicated main-action, Docker cleanup/coverage, and SSL key-storage tests; real filesystem cases now use unique mkdtempSync parents with reliable cleanup while fully mocked cases use explicit synthetic paths.
  • github/vuln-mgmt#251051: adds top-level pull-requests: read permissions to the pinned PR-title workflow.

Validation

  • Focused affected suite: 215 passed across 11 suites.
  • npm run lint -- --quiet
  • npm run type-check
  • npm run build
  • actionlint .github/workflows/pr-title.yml
  • Full unit suite: 5,868 passed, 2 skipped; 21 infrastructure-only failures remain in untouched tests because this macOS host has not accepted the Xcode license (Python-backed enclave harnesses), plus one environment-sensitive compose fixture.
  • Integration suite attempted: 72 passed, 2 skipped; remaining tests require passwordless sudo/Docker and failed because this host prompts for a sudo password.

A subsequent GitHub CodeQL scan is required to formally close the eight test-only alerts; no false-positive dismissal should be necessary because the flagged assertion patterns were removed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 16, 2026 23:04

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

Reused directory permissions can expose sensitive endpoints, and early failures leak auto-created directories.

Get a fresh assessment by requesting another Copilot review.

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

Open (2)
What changed in this PR

Hardens temporary work directories and audit artifact writes against predictable paths and symlink attacks.

Changes:

  • Creates default work directories atomically and validates reused directories.
  • Adds descriptor-based, no-follow artifact writing and regression coverage.
  • Tightens ACL assertions, fixtures, and workflow permissions.
File Description
src/​test-helpers/​config-writer-test-harness.test-utils.ts Adapts ownership simulation.
src/​ssl-key-storage.test.ts Uses synthetic mocked paths.
src/​squid/​acl-generator.test.ts Uses exact ACL assertions.
src/​fs-utils.ts Adds secure file writer.
src/​docker-manager-coverage.test.ts Isolates temporary fixtures.
src/​docker-manager-cleanup.test.ts Isolates cleanup fixtures.
src/​container-startup-diagnostics-coverage.test.ts Removes redundant substring assertions.
src/​config-writer.ts Validates ownership and reuses secure writer.
src/​config-writer.test.ts Updates ownership mocking.
src/​config-writer-new-branches.test.ts Covers ownership and permissions.
src/​commands/​main-action.ts Creates unique defaults and securely writes markers.
src/​commands/​main-action.test.ts Tests default-directory and marker behavior.
src/​commands/​main-action.test-utils.ts Updates synthetic work directory.
src/​commands/​main-action-security.test.ts Adds symlink regression coverage.
src/​commands/​main-action-fs-mock.test-utils.ts Mocks atomic directory creation.
src/​cli-options.ts Removes predictable timestamp default.
.github/​workflows/​pr-title.yml Grants pull-request read permission.

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

Comment thread src/config-writer.ts Outdated
Comment thread src/commands/main-action.ts Outdated
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.

@pelikhan 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 94.18% 94.20% 📈 +0.02%
Statements 92.85% 92.87% 📈 +0.02%
Functions 93.46% 93.47% 📈 +0.01%
Branches 86.63% 86.67% 📈 +0.04%
📁 Per-file Coverage Changes (6 files)
File Lines (Before → After) Statements (Before → After)
src/fs-utils.ts 98.5% → 97.5% (-1.02%) 98.5% → 97.5% (-1.02%)
src/config-writer.ts 89.5% → 89.7% (+0.20%) 89.5% → 89.7% (+0.20%)
src/commands/main-action-fs-mock.test-utils.ts 94.1% → 94.4% (+0.33%) 95.0% → 95.2% (+0.23%)
src/test-helpers/config-writer-test-harness.test-utils.ts 96.7% → 97.0% (+0.39%) 96.8% → 97.1% (+0.37%)
src/commands/main-action.ts 97.0% → 97.5% (+0.46%) 97.1% → 97.5% (+0.45%)
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 Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

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

Warning

Firewall blocked 8 domains

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

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • msfeed25.pkgs.visualstudio.com
  • update.googleapis.com
  • www.google.com
  • www.gstatic.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "msfeed25.pkgs.visualstudio.com"
    - "update.googleapis.com"
    - "www.google.com"
    - "www.gstatic.com"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented Sep 17, 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 Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

❌ Smoke Gemini reports failed. Facets need polishing...

💎 Faceted by Smoke Gemini

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...

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

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

🔌 Service connectivity validated by Smoke Services

@github-actions

github-actions Bot commented Sep 17, 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 Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

❌ Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

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

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Build Test Suite completed successfully!

Generated by Build Test Suite for #8663

@github-actions

github-actions Bot commented Sep 17, 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 Sep 17, 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 Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

📰 DEVELOPING STORY: Smoke Docker Sbx reports failed. Our correspondents are investigating the incident...

📰 BREAKING: Report filed by Smoke Docker Sbx

@github-actions

github-actions Bot commented Sep 17, 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 Sep 17, 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 #8663

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

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode ✅

Test Results:

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

Status: PASS

Assignees: @lpcox

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

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox

EGRESS_RESULT allow=pass deny=pass

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

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

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

@lpcox
lpcox deployed to aoai-model September 17, 2026 00:11 — with GitHub Actions Active
@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 #8663 · claude · haiku45 · 55.2 AIC · ⊞ 4.5K · ◷
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OpenTelemetry Tracing — Results

Scenario Result
1. Module Loading ✅ otel.js loads successfully; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled, plus internal exporter/provider helpers
2. Test Suite ✅ 3 suites (otel.test.js, otel-fanout.test.js, otel-workload-identity.test.js), 68/68 tests passed
3. Env Var Forwarding ✅ env-passthrough.ts forwards COPILOT_OTEL_FILE_EXPORTER_PATH, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID to the agent container; api-proxy-env-config.ts (buildOtelEnv) forwards OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_SERVICE_NAME, and the same trace-context vars into the api-proxy container
4. Token Tracker Integration ✅ onUsage callback present in token-tracker-http.js (invoked with normalized usage + model as the OTEL hook point)
5. OTEL Diagnostics ⚪ Not applicable in this smoke test — no live proxy run was executed, so no spans were expected to be exported

Summary: All applicable scenarios passed. OTEL tracing integration is working as expected.

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

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Services Connectivity — PASS ✅

  • Redis PING: ✅ PONG
  • Postgres pg_isready: ✅ accepting connections
  • Postgres SELECT 1: ✅ 1

Overall: PASS

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

@github-actions

Copy link
Copy Markdown
Contributor

Merged PRs: "Fix Refactoring Scanner safe-output fallback"; "Fix Duplicate Code Detector Copilot model"
PR detail fetch: ✅
Playwright title check: ✅
File write/readback: ✅
Latest discussion comment: ✅
AWF build (npm ci && npm run build): ✅
Overall: PASS

Warning

Firewall blocked 8 domains

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

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • msfeed25.pkgs.visualstudio.com
  • update.googleapis.com
  • www.google.com
  • www.gstatic.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "msfeed25.pkgs.visualstudio.com"
    - "update.googleapis.com"
    - "www.google.com"
    - "www.gstatic.com"

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 (ran successfully) ✅ PASS
.NET json-parse ✅ N/A (ran successfully) ✅ PASS
Go color ✅ passed ✅ PASS
Go env ✅ passed ✅ PASS
Go uuid ✅ 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's default ~/.m2 directory was root-owned and inaccessible to the runner user; builds/tests were run with -Dmaven.repo.local=/tmp/gh-aw/agent/m2-repo as a workaround, using the squid-proxy:3128 proxy settings from ~/.m2/settings.xml as configured. Both projects compiled and passed all tests.
  • All other ecosystems built/installed and passed tests without issue via the firewall proxy.

Generated by Build Test Suite for #8663 · copilot · auto · 44.7 AIC · ⊞ 10.6K · ◷
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.20.0 v22.23.2 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall result: ❌ Not all tests passed (Node.js version mismatch between host and chroot environment). Skipping the smoke-chroot label since ALL_TESTS_PASSED=false.

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

This branch was successfully deployed

1 active deployment
aoai-model — 4f09507f Deployed Sep 17, 2026 by lpcox via conclusion #1680
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