Let the transport create the Windows remote-control socket directory (#50700)

## Why

Foreground remote control on Windows should let the transport create its socket parent with a protected DACL instead of inheriting the broader ACL from a temporary directory.

## What changed

Use `codex-remote-control/rc-<pid>.sock` under `std::env::temp_dir()` on Windows, leaving parent directory creation to the transport. Keep the existing temporary socket directory behavior on other platforms.

GitOrigin-RevId: 6482ed0fc4ebc6b0e5de4e1d0e13adc93afa56d1
This commit is contained in:
Eric Traut
2026-10-03 19:10:17 +00:00
committed by copyberry
parent 3a69ec3ef8
commit b172810921
+8
View File
@@ -112,12 +112,20 @@ async fn run_foreground_remote_control(
arg0_paths: Arg0DispatchPaths,
root_config_overrides: CliConfigOverrides,
) -> anyhow::Result<()> {
#[cfg(not(windows))]
let socket_dir = tempfile::Builder::new()
.prefix("codex-rc-")
.tempdir_in("/tmp")
.or_else(|_| tempfile::tempdir())
.context("failed to create private app-server socket directory")?;
#[cfg(not(windows))]
let socket_path = socket_dir.path().join("rc.sock");
// Let the transport create this parent with a protected DACL instead of
// inheriting the broader ACL from a directory created under `%TEMP%`.
#[cfg(windows)]
let socket_path = std::env::temp_dir()
.join("codex-remote-control")
.join(format!("rc-{}.sock", std::process::id()));
let socket_path = AbsolutePathBuf::from_absolute_path(&socket_path)
.context("private app-server socket path was not absolute")?;
let transport = AppServerTransport::UnixSocket {