mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Preserve target-native paths in command approvals (#42577)
## What changed - Pass the selected executor's `PathUri` through user command approval requests instead of converting the working directory to a host-native path. - Make native-path permission helpers explicitly local and require executor-aware permission transforms to receive a `FileSystemSandboxPolicyContext`. - Cover approved remote commands to verify that the approval request reports the selected remote working directory and execution resumes after approval. GitOrigin-RevId: 0aa3042f2d7594af6c7d0abf31d7f99cf67d5556
This commit is contained in:
1 parent
0650d6d1ca
commit
7a7c188682
30 files changed
+304
-368
No files matched your search
@@ -396,7 +396,7 @@ mod tests {
|
||||
use codex_protocol::permissions::FileSystemSpecialPath;
|
||||
use codex_protocol::protocol::AskForApproval;
|
||||
use codex_protocol::protocol::GranularApprovalConfig;
|
||||
use codex_sandboxing::policy_transforms::intersect_permission_profiles;
|
||||
use codex_sandboxing::policy_transforms::intersect_permission_profiles_with_context;
|
||||
use codex_sandboxing::policy_transforms::merge_permission_profiles;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_path_uri::PathUri;
|
||||
@@ -538,21 +538,21 @@ mod tests {
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
let stored_grant = intersect_permission_profiles(
|
||||
let cwd_uri = PathUri::from_host_native_path(cwd.path()).expect("cwd URI");
|
||||
let stored_grant = intersect_permission_profiles_with_context(
|
||||
requested_permissions.clone(),
|
||||
requested_permissions.clone(),
|
||||
cwd.path(),
|
||||
&local_context(&cwd_uri),
|
||||
);
|
||||
let effective_permissions =
|
||||
merge_permission_profiles(Some(&requested_permissions), Some(&stored_grant))
|
||||
.expect("merged permissions");
|
||||
let cwd = PathUri::from_host_native_path(cwd.path()).expect("cwd URI");
|
||||
|
||||
assert_eq!(
|
||||
preapproved_permission_profile(
|
||||
&effective_permissions,
|
||||
&stored_grant,
|
||||
&local_context(&cwd),
|
||||
&local_context(&cwd_uri),
|
||||
),
|
||||
Some(stored_grant)
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user