mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Harden Windows sandbox provisioning against reparse points (#39083)
## Why Elevated provisioning can apply ACLs beneath a user-supplied `CODEX_HOME`. Following a directory junction or another reparse point could apply those ACLs to a different directory than the one provisioning intended to secure. ## What changed - Require provisioning paths to be absolute paths on a local Windows disk. - In provision-only mode, open or create sandbox directories with `OBJ_DONT_REPARSE` and keep the resulting handle open while applying ACLs with `SetSecurityInfo`. - Reject reparse points in both the final directory and its ancestors while preserving the existing path-based behavior for full setup. ## Testing Add Windows tests covering plain directory creation and rejection of junctions at both the leaf and ancestor levels. GitOrigin-RevId: d165b8b3685c89bc171e4d58c63c739fa9fb2cf9
This commit is contained in:
1 parent
34e4823a1d
commit
a4f37a5b7f
4 files changed
+287
-32
No files matched your search
@@ -1078,6 +1078,24 @@ pub fn run_elevated_provisioning_setup(
|
||||
real_user: &str,
|
||||
settings: crate::WindowsSandboxProvisioningSettings,
|
||||
) -> Result<()> {
|
||||
if !codex_home.is_absolute()
|
||||
|| !matches!(
|
||||
codex_home.components().next(),
|
||||
Some(std::path::Component::Prefix(prefix))
|
||||
if matches!(
|
||||
prefix.kind(),
|
||||
std::path::Prefix::Disk(_) | std::path::Prefix::VerbatimDisk(_)
|
||||
)
|
||||
)
|
||||
{
|
||||
return Err(failure(
|
||||
SetupErrorCode::OrchestratorSandboxDirCreateFailed,
|
||||
format!(
|
||||
"sandbox provisioning CODEX_HOME must be an absolute local disk path: {}",
|
||||
codex_home.display()
|
||||
),
|
||||
));
|
||||
}
|
||||
let sbx_dir = sandbox_dir(codex_home);
|
||||
std::fs::create_dir_all(&sbx_dir).map_err(|err| {
|
||||
failure(
|
||||
|
||||
Reference in new issue
Block a user