Skip to content

check PID of named pipe consumer#19283

Merged
iceweasel-oai merged 3 commits into
mainfrom
codex/unify-elevated-runner-transport
Apr 24, 2026
Merged

check PID of named pipe consumer#19283
iceweasel-oai merged 3 commits into
mainfrom
codex/unify-elevated-runner-transport

Conversation

@iceweasel-oai
Copy link
Copy Markdown
Collaborator

@iceweasel-oai iceweasel-oai commented Apr 24, 2026

Why

The elevated Windows command runner currently trusts the first process that connects to its parent-created named pipes. Tightening the pipe ACL already narrows who can reach that boundary, but verifying the connected client PID gives the parent one more fail-closed check: it only accepts the exact runner process it just spawned.

What changed

  • validate GetNamedPipeClientProcessId after ConnectNamedPipe and reject clients whose PID does not match the spawned runner
  • also did some code de-duplication to route the one-shot elevated capture flow in windows-sandbox-rs/src/elevated_impl.rs through spawn_runner_transport() so both elevated codepaths use the same pipe bootstrap and PID validation

Using the transport unification here also reduces duplication in the elevated Windows IPC bootstrap, so future hardening to the runner handshake only needs to land in one place.

Validation

  • cargo test -p codex-windows-sandbox
  • manual testing: one-shot elevated path via target/debug/codex.exe exec running a randomized shell command and confirming captured output
  • manual testing: elevated session path via target/debug/codex.exe -c 'windows.sandbox="elevated"' sandbox windows -- python -u -c ... with stdin/stdout round-trips (READY, then GOT:... for two input lines)
@iceweasel-oai iceweasel-oai changed the title [codex] unify elevated Windows runner transport check PID of named pipe consumer Apr 24, 2026
@iceweasel-oai iceweasel-oai marked this pull request as ready for review April 24, 2026 16:41
Comment thread codex-rs/windows-sandbox-rs/src/elevated_impl.rs
Co-authored-by: Codex noreply@openai.com
@iceweasel-oai iceweasel-oai enabled auto-merge (squash) April 24, 2026 17:39
@iceweasel-oai iceweasel-oai merged commit e787358 into main Apr 24, 2026
25 checks passed
@iceweasel-oai iceweasel-oai deleted the codex/unify-elevated-runner-transport branch April 24, 2026 17:41
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants