Skip to content

fix: isolate agent runtimes from host tmp - #11686

Merged
lpcox merged 8 commits into
mainfrom
codex-backdoor-hardening
Nov 16, 2026
Merged

lpcox merged 8 commits into
mainfrom
codex-backdoor-hardening

Conversation

@lpcox

@lpcox lpcox commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • replace broad host /tmp binds with private, executable, size-capped tmpfs for Docker and gVisor agents
  • preserve only the narrow /tmp/gh-aw runtime handoff and keep sbx guest /tmp private
  • reject explicit whole-host /tmp mounts and fail closed when CoreCLR debug or diagnostic endpoints remain visible
  • redact suspected GitHub tokens and JWTs from agent output and stop the container on detection
  • update mount-policy documentation and add unit plus live host-runtime regression coverage

Security 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

  • focused TypeScript build and unit suites pass
  • ARC/DinD mount suite passes with a representative workspace path
  • live CoreCLR integration test builds successfully but requires a running Docker daemon to execute locally

Consolidates the fixes from #11685.

lpcox and others added 2 commits November 16, 2026 16:17
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 AI adaptive review requested due to automatic review settings November 16, 2026 16:21
@lpcox

lpcox commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot merge main and resolve conflicts

Comment thread src/container-lifecycle.ts Outdated
};
const redactOutput = (source: NodeJS.ReadableStream | null): NodeJS.ReadableStream | null =>
source?.pipe(new CredentialRedactingStream(stopOnCredentialDisclosure)) ?? null;
const captureRawOutput = (

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.

🟡 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
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 /tmp mounts.
  • 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.
Comment thread src/credential-redactor.ts Outdated
Comment on lines +50 to +55
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);
Comment on lines +69 to +74
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);
}
Comment thread src/services/agent-service.ts Resolved
Comment on lines 28 to 29
`${workspaceDir}:/host${workspaceDir}:rw`,
'/tmp:/host/tmp:rw',
];
Comment thread src/container-lifecycle.ts Outdated
Comment on lines +549 to +551
const outputDrainPromises = [
forwardOutput(redactOutput(logsProcess.stdout), process.stdout, 'stdout'),
forwardOutput(redactOutput(logsProcess.stderr), process.stderr, 'stderr'),
Comment thread src/credential-redactor.ts Resolved
Comment thread src/services/agent-service.ts Outdated
// (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]>

Copilot AI commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@copilot merge main and resolve conflicts

Merged main, resolved the conflicts, and published two-parent merge commit 434ab6f.

Comment thread src/credential-redactor.ts Outdated
}

override _transform(chunk: Buffer | string, encoding: BufferEncoding, callback: TransformCallback): void {
if (Buffer.isBuffer(chunk) && !Buffer.from(chunk.toString('utf8')).equals(chunk)) {
@lpcox

lpcox commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address all review feedback

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@copilot address all review feedback

Addressed the review feedback in commit bb2d17f.

lpcox and others added 2 commits November 16, 2026 11:44
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]>
@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

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11686 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 1f6664d

Comment thread src/agent-run.ts
env: getLocalDockerEnv(),
});
let credentialStopPromise: Promise<unknown> | undefined;
const stopOnCredentialDisclosure = (): void => {
Comment on lines +20 to +27
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 },
});
Comment on lines +69 to +76
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' },
});
@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 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

@lpcox
lpcox merged commit 11ebdda into main Nov 16, 2026
45 of 46 checks passed
@lpcox
lpcox deleted the codex-backdoor-hardening branch November 16, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants