mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Allow trusted symlinks beneath CODEX_HOME on macOS (#42716)
## What changed - Add the macOS-only `allow_symlinked_codex_home` user setting. When enabled in the execution host's `$CODEX_HOME/config.toml`, writable roots at or beneath that home may traverse symlinks. - Keep the exception disabled by default and prevent project config, command-line overrides, and ignored user config from enabling it. Other writable roots remain subject to symlink checks. - Propagate the resolved setting through local, interactive, and exec-server sandbox paths, including `CODEX_HOME` aliases. - Explain the opt-out in symlink rejection errors, including that it trusts targets outside `CODEX_HOME` and targets that change between commands. ## Testing - Add macOS coverage for shell commands, patches, filesystem helpers, process execution, and interactive startup with enabled, disabled, aliased, and out-of-scope homes. GitOrigin-RevId: 99fcdf611200c9e1b7713cf06f7fdea5bfa7f089
This commit is contained in:
1 parent
8e6a44b428
commit
d13aeb77ea
24 files changed
+499
-36
No files matched your search
@@ -275,10 +275,12 @@ impl std::error::Error for SandboxTransformError {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct SandboxManager {
|
||||
#[cfg(target_os = "macos")]
|
||||
seatbelt_profile: MacosSeatbeltProfile,
|
||||
#[cfg(target_os = "macos")]
|
||||
allowed_symlinked_codex_home: Option<AbsolutePathBuf>,
|
||||
}
|
||||
|
||||
impl SandboxManager {
|
||||
@@ -291,9 +293,22 @@ impl SandboxManager {
|
||||
Self {
|
||||
#[cfg(target_os = "macos")]
|
||||
seatbelt_profile: MacosSeatbeltProfile::FileSystemHelper,
|
||||
#[cfg(target_os = "macos")]
|
||||
allowed_symlinked_codex_home: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Allows otherwise-authorized writable roots beneath the opted-in user home
|
||||
/// to follow symlinks, including targets outside that home.
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn with_allowed_symlinked_codex_home(
|
||||
mut self,
|
||||
allowed_symlinked_codex_home: Option<AbsolutePathBuf>,
|
||||
) -> Self {
|
||||
self.allowed_symlinked_codex_home = allowed_symlinked_codex_home;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn select_initial(
|
||||
&self,
|
||||
permission_profile: &PermissionProfile,
|
||||
@@ -395,6 +410,7 @@ impl SandboxManager {
|
||||
extra_allow_unix_sockets: &[],
|
||||
},
|
||||
self.seatbelt_profile,
|
||||
self.allowed_symlinked_codex_home.as_ref(),
|
||||
)
|
||||
.map_err(|err| match err {
|
||||
SeatbeltPreparationError::FileSystem(message) => {
|
||||
|
||||
Reference in new issue
Block a user