From c8bd6c1da9782bb92cf300a8768f87232b2d5631 Mon Sep 17 00:00:00 2001 From: iceweasel-oai Date: Wed, 28 Oct 2026 16:31:06 +0000 Subject: [PATCH] Exclude unrelated network shares from MXC default reads (#57783) Default read access on Windows now excludes network shares unless they contain the policy or command working directory. Skip object-identity probes and implicit read enumeration for unrelated shares while preserving explicit read/write grants. GitOrigin-RevId: 869bacd578989f5348a449277ffbea795494f487 --- codex-rs/mxc-sandbox/README.md | 3 +++ codex-rs/mxc-sandbox/src/windows.rs | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/codex-rs/mxc-sandbox/README.md b/codex-rs/mxc-sandbox/README.md index 50a66c9810..3afb89521a 100644 --- a/codex-rs/mxc-sandbox/README.md +++ b/codex-rs/mxc-sandbox/README.md @@ -95,6 +95,9 @@ to 4096 bytes; the helper removes them before native process creation. Use - Windows volume-root grants do not recurse. The adapter grants the root and its immediate children; directories added or newly mounted during a running command are not implicitly granted. +- Default read access excludes network shares unrelated to the policy or command + cwd. Explicit read/write grants remain supported. Unrelated shares are not + probed for object identity or enumerated for implicit reads. - The native API represents paths and environment values as Unicode strings. Non-Unicode values fail instead of undergoing lossy conversion. - An empty child environment still uses the Windows user-profile defaults. diff --git a/codex-rs/mxc-sandbox/src/windows.rs b/codex-rs/mxc-sandbox/src/windows.rs index 99ef6179ad..c475066d31 100644 --- a/codex-rs/mxc-sandbox/src/windows.rs +++ b/codex-rs/mxc-sandbox/src/windows.rs @@ -8,8 +8,6 @@ use std::path::PathBuf; use anyhow::Result; use anyhow::ensure; use codex_utils_path_uri::PathUri; -use mxc_sdk::mxc_common::filesystem_object::ExistingObjectComparison; -use mxc_sdk::mxc_common::filesystem_object::compare_existing_filesystem_objects; use windows_sys::Win32::Foundation::RPC_E_CHANGED_MODE; use windows_sys::Win32::Storage::FileSystem::GetDriveTypeW; use windows_sys::Win32::Storage::FileSystem::GetLogicalDrives; @@ -92,8 +90,8 @@ pub(super) fn volume_roots( Ok(volumes) } -// Omit only implicit network roots whose object identity MXC cannot inspect. -// Keep healthy shares and cwd volumes; explicit grants follow the normal path. +// Default reads cover local volumes and cwd shares, not unrelated network shares. +// Explicit grants follow the normal policy path. pub(super) fn implicit_read_roots( volume_roots: &[PathBuf], policy_cwd: &Path, @@ -111,7 +109,6 @@ pub(super) fn implicit_read_roots( drive_type != DRIVE_REMOTE || policy_cwd.starts_with(root) || command_cwd.starts_with(root) - || compare_existing_filesystem_objects(root, root) == ExistingObjectComparison::Same }) .map(PathUri::from_host_native_path) .collect()