-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Execute user-issued bang commands without sandboxing #6013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fc96c13
9d4fb78
eb130da
1435da7
5d15259
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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; | ||||||||||||||||
|
||||||||||||||||
| return false; | |
| // Only bypass approval for user shell commands that are not dangerous and do not request escalation. | |
| let wants_escalation = req.with_escalated_permissions.unwrap_or(false); | |
| if !wants_escalation && !command_might_be_dangerous(&req.command) { | |
| return false; | |
| } | |
| // Otherwise, fall through to approval logic for dangerous/escalated user commands. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping approval for any local shell call
The new is_user_shell_command flag short‑circuits wants_initial_approval whenever it is set, but ShellHandler sets this flag to true for every ToolPayload::LocalShell, including model‑initiated local shell calls. As a result, dangerous local shell commands emitted by the model under AskForApproval::OnRequest or AskForApproval::UnlessTrusted no longer trigger an approval request at all; they now execute immediately (still sandboxed, but without the human approval that these policies are meant to enforce). This quietly disables user‑configured approval policies for the model’s local shell tool, which seems unintended and opens a security hole.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting
with_escalated_permissions: Some(true)for all user-requested shell commands could be a security risk. User commands inherit escalated permissions without any validation, potentially allowing privilege escalation attacks. Consider requiring explicit user confirmation for commands that need escalation, or evaluate whether escalation is actually needed based on the command content.