mirror of
https://github.com/openai/codex.git
synced 2026-11-02 19:43:24 +00:00
disallow command override if it's a network only approval
This commit is contained in:
@@ -2507,7 +2507,17 @@ async fn on_command_execution_request_approval_response(
|
||||
let (decision, completion_status) = match decision {
|
||||
CommandExecutionApprovalDecision::Accept => (ReviewDecision::Approved, None),
|
||||
CommandExecutionApprovalDecision::AcceptWithOverrideCommand { command } => {
|
||||
if command.is_empty() {
|
||||
// Network-only approval prompts omit the command, so they
|
||||
// must not allow clients to steer execution via override.
|
||||
if completion_item.is_none() {
|
||||
error!(
|
||||
"failed to deserialize CommandExecutionRequestApprovalResponse: override command is not allowed for network-only approvals"
|
||||
);
|
||||
(
|
||||
ReviewDecision::Denied,
|
||||
Some(CommandExecutionStatus::Declined),
|
||||
)
|
||||
} else if command.is_empty() {
|
||||
error!(
|
||||
"failed to deserialize CommandExecutionRequestApprovalResponse: override command cannot be empty"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user