mirror of
https://github.com/openai/codex.git
synced 2026-09-09 15:58:47 +00:00
Use Bash for network approval hook payloads
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -37,8 +37,6 @@ use tokio::sync::RwLock;
|
||||
use tracing::warn;
|
||||
use uuid::Uuid;
|
||||
|
||||
const NETWORK_ACCESS_HOOK_TOOL_NAME: &str = "NetworkAccess";
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub(crate) enum NetworkApprovalMode {
|
||||
Immediate,
|
||||
@@ -389,7 +387,7 @@ impl NetworkApprovalService {
|
||||
&turn_context,
|
||||
&guardian_approval_id,
|
||||
PermissionRequestPayload {
|
||||
tool_name: NETWORK_ACCESS_HOOK_TOOL_NAME.to_string(),
|
||||
tool_name: "Bash".to_string(),
|
||||
command,
|
||||
description: Some(format!("network-access {}", request.host)),
|
||||
},
|
||||
|
||||
@@ -1340,7 +1340,7 @@ allow_local_binding = true
|
||||
.with_pre_build_hook(|home| {
|
||||
if let Err(error) = write_permission_request_hook(
|
||||
home,
|
||||
Some("^NetworkAccess$"),
|
||||
Some("^Bash$"),
|
||||
"allow",
|
||||
"should not be used for allow",
|
||||
) {
|
||||
@@ -1435,7 +1435,7 @@ allow_local_binding = true
|
||||
let hook_inputs = read_permission_request_hook_inputs(test.codex_home_path())?;
|
||||
assert_eq!(hook_inputs.len(), 1);
|
||||
assert_eq!(hook_inputs[0]["hook_event_name"], "PermissionRequest");
|
||||
assert_eq!(hook_inputs[0]["tool_name"], "NetworkAccess");
|
||||
assert_eq!(hook_inputs[0]["tool_name"], "Bash");
|
||||
assert_eq!(hook_inputs[0]["tool_input"]["command"], command);
|
||||
assert_eq!(
|
||||
hook_inputs[0]["tool_input"]["description"],
|
||||
|
||||
Reference in New Issue
Block a user