mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
refactoring with_escalated_permissions to use SandboxPermissions instead (#7750)
helpful in the future if we want more granularity for requesting escalated permissions: e.g when running in readonly sandbox, model can request to escalate to a sandbox that allows writes
This commit is contained in:
@@ -28,6 +28,7 @@ use crate::protocol::SandboxPolicy;
|
||||
use crate::sandboxing::CommandSpec;
|
||||
use crate::sandboxing::ExecEnv;
|
||||
use crate::sandboxing::SandboxManager;
|
||||
use crate::sandboxing::SandboxPermissions;
|
||||
use crate::spawn::StdioPolicy;
|
||||
use crate::spawn::spawn_child_async;
|
||||
use crate::text_encoding::bytes_to_string_smart;
|
||||
@@ -55,7 +56,7 @@ pub struct ExecParams {
|
||||
pub cwd: PathBuf,
|
||||
pub expiration: ExecExpiration,
|
||||
pub env: HashMap<String, String>,
|
||||
pub with_escalated_permissions: Option<bool>,
|
||||
pub sandbox_permissions: SandboxPermissions,
|
||||
pub justification: Option<String>,
|
||||
pub arg0: Option<String>,
|
||||
}
|
||||
@@ -144,7 +145,7 @@ pub async fn process_exec_tool_call(
|
||||
cwd,
|
||||
expiration,
|
||||
env,
|
||||
with_escalated_permissions,
|
||||
sandbox_permissions,
|
||||
justification,
|
||||
arg0: _,
|
||||
} = params;
|
||||
@@ -162,7 +163,7 @@ pub async fn process_exec_tool_call(
|
||||
cwd,
|
||||
env,
|
||||
expiration,
|
||||
with_escalated_permissions,
|
||||
sandbox_permissions,
|
||||
justification,
|
||||
};
|
||||
|
||||
@@ -192,7 +193,7 @@ pub(crate) async fn execute_exec_env(
|
||||
env,
|
||||
expiration,
|
||||
sandbox,
|
||||
with_escalated_permissions,
|
||||
sandbox_permissions,
|
||||
justification,
|
||||
arg0,
|
||||
} = env;
|
||||
@@ -202,7 +203,7 @@ pub(crate) async fn execute_exec_env(
|
||||
cwd,
|
||||
expiration,
|
||||
env,
|
||||
with_escalated_permissions,
|
||||
sandbox_permissions,
|
||||
justification,
|
||||
arg0,
|
||||
};
|
||||
@@ -857,7 +858,7 @@ mod tests {
|
||||
cwd: std::env::current_dir()?,
|
||||
expiration: 500.into(),
|
||||
env,
|
||||
with_escalated_permissions: None,
|
||||
sandbox_permissions: SandboxPermissions::UseDefault,
|
||||
justification: None,
|
||||
arg0: None,
|
||||
};
|
||||
@@ -902,7 +903,7 @@ mod tests {
|
||||
cwd: cwd.clone(),
|
||||
expiration: ExecExpiration::Cancellation(cancel_token),
|
||||
env,
|
||||
with_escalated_permissions: None,
|
||||
sandbox_permissions: SandboxPermissions::UseDefault,
|
||||
justification: None,
|
||||
arg0: None,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user