fix: allow restricted filesystem profiles to read helper executables#15114
fix: allow restricted filesystem profiles to read helper executables#15114
Conversation
bolinfest
left a comment
There was a problem hiding this comment.
I flagged a number of big-O issues in this PR. Let's take a step back and think about this design some more.
667ebb4 to
5125da0
Compare
| ) -> Vec<AbsolutePathBuf> { | ||
| let arg0_root = AbsolutePathBuf::from_absolute_path(codex_home.join("tmp").join("arg0")).ok(); | ||
| let zsh_path = zsh_path.and_then(|path| AbsolutePathBuf::from_absolute_path(path).ok()); | ||
| let execve_wrapper_root = main_execve_wrapper_exe.and_then(|path| { |
There was a problem hiding this comment.
Ah, I see, so we are relying on getting the parent folder of codex-execve-wrapper to find the right folder of ~/.codex/tmp/arg0. This certainly works for now, but in a follow-up, I would prefer we do something more robust!
Let's add a TODO and then in a subsequent PR, we should:
- update
Arg0DispatchPathsto include the path entry added byprepend_path_entry_for_codex_aliases() - thread all that through to here so that we can add that entry to the return value instead of relying on the parent of
main_execve_wrapper_exe
Also, I see these comments and I think they are out of date:
codex/codex-rs/core/src/config/mod.rs
Lines 452 to 463 in 3aaee0f
That is, I do not think we should be relying on ConfigOverrides to thread the values of Arg0DispatchPaths through. Ideally we would try to clean that up as part of the TODO, as well.
| } | ||
| }); | ||
|
|
||
| let mut readable_roots = Vec::new(); |
There was a problem hiding this comment.
protip (not worth waiting for CI for this one small change, tho)
| let mut readable_roots = Vec::new(); | |
| let mut readable_roots = Vec::with_capacity(2); |
Summary
This PR fixes restricted filesystem permission profiles so Codex's runtime-managed helper executables remain readable without requiring explicit user configuration.
zshhelper path and the main execve wrapper$CODEX_HOME/tmp/arg0root when the execve wrapper lives there, so session-specific helper paths keep workingTesting
before this change: got this error when executing a shell command via zsh fork:
saw this change went away after this change, meaning the readable roots and injected correctly.