Repository navigation
fix: isolate agent runtimes from host tmp - #11686
Conversation
Prevent Docker, gVisor, and sbx agents from seeing the runner's host /tmp, and stop suspected credential disclosure through agent logs. Co-authored-by: Copilot App <[email protected]>
|
@copilot merge main and resolve conflicts |
| }; | ||
| const redactOutput = (source: NodeJS.ReadableStream | null): NodeJS.ReadableStream | null => | ||
| source?.pipe(new CredentialRedactingStream(stopOnCredentialDisclosure)) ?? null; | ||
| const captureRawOutput = ( |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved credential-redaction flaws can leak secrets, while tmpfs and mount changes break workloads and leave existing CI checks failing.
8 open issues
Regenerate the filesystem sharing contract · New Scan invalid UTF-8 output for credentials · New Keep credential matches intact across emission boundaries · New Enable execution on both tmpfs mounts · New Update integration tests for removed host /tmp bind · New Resume output forwarding after destination drain · New Avoid matching credential placeholders as disclosures · New Mount requested subdirectories under private /tmp · New
What changed in this PR
Hardens AWF agent isolation by removing automatic host /tmp sharing and adding credential filtering as defense in depth against accidental disclosure.
Changes:
- Use private temporary storage for Docker, gVisor, and sbx agents, rejecting explicit whole-host
/tmpmounts. - Redact suspected credentials from agent logs and stop the container on detection.
- Update mount-policy documentation and regression coverage.
| File | Description |
|---|---|
src/services/init-signal-compatibility.test.ts |
Checks legacy init paths without host /tmp sharing. |
src/services/agent-volumes/workspace-mounts.ts |
Removes the broad temporary bind and rejects custom host /tmp mounts. |
src/services/agent-volumes/workspace-mounts.test.ts |
Covers revised mounts and custom-mount rejection. |
src/services/agent-volumes/system-mounts.ts |
Removes the chroot’s host /tmp bind. |
src/services/agent-volumes/nested-mountpoints.test.ts |
Updates expectations for mountpoints inside private temporary storage. |
src/services/agent-volumes-security.test.ts |
Checks temporary-storage isolation and tmpfs options. |
src/services/agent-volumes-chroot-hosts.test.ts |
Verifies private chroot temporary storage. |
src/services/agent-volumes-basic.test.ts |
Updates baseline mount and tmpfs expectations. |
src/services/agent-service.ts |
Adds private /tmp and /host/tmp tmpfs mounts. |
src/sbx-manager.ts |
Keeps guest /tmp private and rejects whole-host temporary shares. |
src/sbx-manager.test.ts |
Tests revised sbx mounts and rejection paths. |
src/run-agent-command.test.ts |
Adapts output assertions to filtered log streams. |
src/credential-redactor.ts |
Adds streaming credential detection and masking. |
src/credential-redactor.test.ts |
Tests masking, split tokens, and binary passthrough. |
src/container-lifecycle.ts |
Filters presented logs and stops agents on suspected disclosure. |
src/compose-generator-filesystem-gating.test.ts |
Checks private temporary storage with write restrictions. |
src/compose-generator-arc-dind.test.ts |
Checks temporary isolation with staged sysroots. |
docs/selective-mounting.md |
Documents the private temporary-storage policy. |
CLAUDE.md |
Updates architecture descriptions of temporary mounts. |
Review effort: Max (dynamic)
| directories retain their ownership, mode, and contents; a non-directory target | ||
| is rejected. The `rw` bind mode does not override host ownership, permissions, | ||
| ACLs, or a read-only filesystem, so it does not guarantee effective write access. | ||
| `/tmp` and `/host/tmp` are private tmpfs mounts; the host `/tmp` is never exposed. |
| if (Buffer.isBuffer(chunk) && !Buffer.from(chunk.toString('utf8')).equals(chunk)) { | ||
| if (this.pending) { | ||
| this.push(this.sanitize(this.pending)); | ||
| this.pending = ''; | ||
| } | ||
| this.push(chunk); |
| if (this.pending.length > MAX_PENDING_CHARS) { | ||
| const emitLength = this.pending.length - OVERLAP_CHARS; | ||
| const sanitized = this.sanitize(this.pending); | ||
| this.push(sanitized.slice(0, emitLength)); | ||
| this.pending = this.pending.slice(emitLength); | ||
| } |
| `${workspaceDir}:/host${workspaceDir}:rw`, | ||
| '/tmp:/host/tmp:rw', | ||
| ]; |
| const outputDrainPromises = [ | ||
| forwardOutput(redactOutput(logsProcess.stdout), process.stdout, 'stdout'), | ||
| forwardOutput(redactOutput(logsProcess.stderr), process.stderr, 'stderr'), |
| // (Docker's default). noexec and nosuid flags restrict abuse vectors. | ||
| tmpfs: [ | ||
| '/tmp:rw,nosuid,nodev,size=2097152k', | ||
| '/host/tmp:rw,nosuid,nodev,size=2097152k', |
# Conflicts: # docs/selective-mounting.md # src/container-lifecycle.ts # src/sbx-manager.ts Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged |
| } | ||
|
|
||
| override _transform(chunk: Buffer | string, encoding: BufferEncoding, callback: TransformCallback): void { | ||
| if (Buffer.isBuffer(chunk) && !Buffer.from(chunk.toString('utf8')).equals(chunk)) { |
|
@copilot address all review feedback |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Addressed the review feedback in commit |
Merge the CoreCLR IPC preflight, narrow handoff handling, integration coverage, and security documentation from PR 11685 into PR 11686 while retaining credential output redaction. Co-authored-by: Copilot App <[email protected]>
Preserve the consolidated CoreCLR isolation and narrow handoff defenses while incorporating the latest credential-redaction and executable-tmpfs review fixes. Co-authored-by: Copilot App <[email protected]>
|
✅ Copilot review passed with no inline comments. @lpcox Add the |
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit 1f6664d |
| env: getLocalDockerEnv(), | ||
| }); | ||
| let credentialStopPromise: Promise<unknown> | undefined; | ||
| const stopOnCredentialDisclosure = (): void => { |
| return spawnSync('/bin/bash', ['-c', [ | ||
| 'source "$1"', | ||
| prefix, | ||
| 'check_runtime_ipc_paths "$TMPDIR"', | ||
| ].join('\n'), 'ipc-test', entrypoint], { | ||
| encoding: 'utf8', | ||
| env: { ...process.env, TMPDIR: directory, HOME: directory, RUNNER_TEMP: directory }, | ||
| }); |
| const result = spawnSync('/bin/bash', ['-c', [ | ||
| 'source "$1"', | ||
| 'check_runtime_ipc_paths() { printf "%s\\n" "$@"; }', | ||
| 'check_host_runtime_ipc', | ||
| ].join('\n'), 'ipc-test', entrypoint], { | ||
| encoding: 'utf8', | ||
| env: { ...process.env, TMPDIR: '/custom/temp', HOME: '/custom/home', RUNNER_TEMP: '/runner/temp' }, | ||
| }); |
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 94.06% | 94.08% | 📈 +0.02% |
| Statements | 92.65% | 92.67% | 📈 +0.02% |
| Functions | 93.29% | 93.32% | 📈 +0.03% |
| Branches | 87.06% | 87.05% | 📉 -0.01% |
📁 Per-file Coverage Changes (5 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/services/agent-volumes/workspace-mounts.ts |
96.5% → 95.9% (-0.68%) | 96.6% → 96.0% (-0.67%) |
src/sbx/sandbox-create.ts |
100.0% → 100.0% (+0.00%) | 98.8% → 98.9% (+0.10%) |
src/services/agent-volumes/credential-hiding.ts |
96.7% → 96.7% (+0.00%) | 95.5% → 96.4% (+0.91%) |
src/services/agent-volumes/nested-mountpoints.ts |
82.0% → 82.0% (+0.00%) | 80.2% → 79.3% (-0.86%) |
src/agent-run.ts |
92.9% → 94.7% (+1.76%) | 91.8% → 92.7% (+0.84%) |
✨ New Files (1 files)
src/credential-redactor.ts: 100.0% lines
Coverage comparison generated by scripts/ci/compare-coverage.ts


Summary
/tmpbinds with private, executable, size-capped tmpfs for Docker and gVisor agents/tmp/gh-awruntime handoff and keep sbx guest/tmpprivate/tmpmounts and fail closed when CoreCLR debug or diagnostic endpoints remain visibleSecurity impact
This blocks the CoreCLR debug-pipe attack described by Depi from reaching GitHub Runner memory through host
/tmp, including endpoints created after startup and DinD-only paths. The entrypoint visibility check and output filtering provide defense in depth behind the filesystem isolation.Validation
Consolidates the fixes from #11685.