mirror of
https://github.com/openai/codex.git
synced 2026-12-01 00:20:48 +00:00
fix(windows): avoid temp profile leak for sandbox runner
This commit is contained in:
@@ -36,7 +36,6 @@ use windows_sys::Win32::System::Pipes::PeekNamedPipe;
|
||||
use windows_sys::Win32::System::Threading::CreateProcessWithLogonW;
|
||||
use windows_sys::Win32::System::Threading::GetCurrentProcess;
|
||||
use windows_sys::Win32::System::Threading::GetCurrentThread;
|
||||
use windows_sys::Win32::System::Threading::LOGON_WITH_PROFILE;
|
||||
use windows_sys::Win32::System::Threading::PROCESS_INFORMATION;
|
||||
use windows_sys::Win32::System::Threading::STARTUPINFOW;
|
||||
use windows_sys::Win32::System::Threading::TerminateProcess;
|
||||
@@ -46,6 +45,7 @@ const RUNNER_SPAWN_READY_TIMEOUT: Duration = Duration::from_secs(15);
|
||||
const RUNNER_PIPE_CONNECT_TIMEOUT: Duration = Duration::from_secs(15);
|
||||
const RUNNER_SPAWN_READY_POLL_INTERVAL: Duration = Duration::from_millis(50);
|
||||
const RUNNER_ERROR_MODE_FLAGS: u32 = 0x0001 | 0x0002;
|
||||
const RUNNER_LOGON_FLAGS: u32 = 0;
|
||||
const WAIT_OBJECT_0: u32 = 0;
|
||||
|
||||
pub(crate) struct RunnerTransport {
|
||||
@@ -256,7 +256,10 @@ pub(crate) fn spawn_runner_transport(
|
||||
user_w.as_ptr(),
|
||||
domain_w.as_ptr(),
|
||||
password_w.as_ptr(),
|
||||
LOGON_WITH_PROFILE,
|
||||
// The runner only needs a sandbox-user token. Forcing profile loading on every
|
||||
// spawn can trigger Windows TEMP.* fallback profiles when profile initialization
|
||||
// or unload is unhealthy, which matches issue #21455's leak pattern.
|
||||
RUNNER_LOGON_FLAGS,
|
||||
exe_w.as_ptr(),
|
||||
cmdline_vec.as_mut_ptr(),
|
||||
windows_sys::Win32::System::Threading::CREATE_NO_WINDOW
|
||||
|
||||
Reference in New Issue
Block a user