mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
escalating permissions
This commit is contained in:
@@ -82,7 +82,7 @@ impl SessionTask for UserShellCommandTask {
|
||||
command: shell_invocation,
|
||||
workdir: None,
|
||||
timeout_ms: None,
|
||||
with_escalated_permissions: None,
|
||||
with_escalated_permissions: Some(true),
|
||||
justification: None,
|
||||
};
|
||||
|
||||
|
||||
@@ -219,6 +219,7 @@ impl ShellHandler {
|
||||
env: exec_params.env.clone(),
|
||||
with_escalated_permissions: exec_params.with_escalated_permissions,
|
||||
justification: exec_params.justification.clone(),
|
||||
is_user_shell_command,
|
||||
};
|
||||
let mut orchestrator = ToolOrchestrator::new();
|
||||
let mut runtime = ShellRuntime::new();
|
||||
|
||||
@@ -34,6 +34,7 @@ pub struct ShellRequest {
|
||||
pub env: std::collections::HashMap<String, String>,
|
||||
pub with_escalated_permissions: Option<bool>,
|
||||
pub justification: Option<String>,
|
||||
pub is_user_shell_command: bool,
|
||||
}
|
||||
|
||||
impl ProvidesSandboxRetryData for ShellRequest {
|
||||
@@ -121,6 +122,9 @@ impl Approvable<ShellRequest> for ShellRuntime {
|
||||
policy: AskForApproval,
|
||||
sandbox_policy: &SandboxPolicy,
|
||||
) -> bool {
|
||||
if req.is_user_shell_command {
|
||||
return false;
|
||||
}
|
||||
if is_known_safe_command(&req.command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user