Resolve model-provided shells by type (#39607)

## Why

A model-provided shell path should select the requested shell type without
allowing that path to determine which executable Codex runs.

## What changed

- Resolve model-provided shells through Codex's normal shell discovery and
  fallback logic after detecting their type.
- Keep the configured packaged zsh executable when the zsh-fork feature is
  enabled and the file exists.
- Update shell, unified exec, and network approval expectations to use the
  resolved local executable and arguments.

GitOrigin-RevId: ebe6f7eec2cfd1c0548d5bf1a26b7a30dba02cc2
This commit is contained in:
pakrym-oai authored and copyberry committed 2026-08-20 06:03:25 +00:00
1 parent 6869d17cc2
commit 186b449bc2
9 files changed
+73 -422

No files matched your search

-16
View File
@@ -16,21 +16,6 @@ use ctor::ctor;
#[ctor]
pub static CODEX_ALIASES_TEMP_DIR: Option<TestBinaryDispatchGuard> = {
configure_test_binary_dispatch("codex-core-tests", |exe_name, argv1| {
#[cfg(windows)]
if exe_name.eq_ignore_ascii_case("powershell.exe")
|| exe_name.eq_ignore_ascii_case("powershell.evil")
|| exe_name.eq_ignore_ascii_case("pwsh.exe")
{
let executable = std::env::current_exe().expect("locate fake PowerShell executable");
if executable
.with_file_name(".codex-executable-identity-fixture")
.is_file()
{
let marker = executable.with_file_name("attacker-executed");
std::fs::write(marker, b"ran").expect("record fake PowerShell execution");
std::process::exit(0);
}
}
if argv1 == Some(CODEX_CORE_APPLY_PATCH_ARG1) {
return TestBinaryDispatchMode::DispatchArg0Only;
}
@@ -77,7 +62,6 @@ mod cyber_exec_policy;
mod deprecation_notice;
mod exec;
mod exec_policy;
mod executable_identity;
#[cfg(not(target_os = "windows"))]
mod extension_sandbox;
mod external_auth;