mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
## Why Workspace-relative permission rules need to resolve against the execution host's workspace roots so a grant applies to the intended directory. Restricted launches also need to check that the host can provide the required sandbox. ## What changed - Select the platform sandbox while preparing a launch, using the permission profile, network requirements, and Windows sandbox settings. - Pass workspace roots into policy resolution for local commands and shell snapshots. Already-bound command profiles validate their concrete paths without resolving Windows launcher hints on hosts that do not use them. - Share local launch preparation between tool commands and shell snapshots, and require a platform sandbox for exec-server launches that request one. ## Testing Cover network-only restrictions and verify that a `:workspace_roots` write grant allows writes to the configured subdirectory under the command's working directory while denying writes to a sibling file and the corresponding subdirectory under the parent. Exercise the path grant through both app-server command execution and WebSocket exec-server execution. GitOrigin-RevId: 492fe7ab8deddf30cfd2e2bdabf28d02d67e00c5
67 lines
2.8 KiB
Rust
67 lines
2.8 KiB
Rust
#![allow(clippy::expect_used)]
|
|
|
|
mod analytics_server;
|
|
mod auth_fixtures;
|
|
mod config;
|
|
mod json_logging;
|
|
mod local_websocket_exec_server;
|
|
mod mock_model_server;
|
|
mod models_cache;
|
|
mod responses;
|
|
mod rollout;
|
|
mod rpc_delay;
|
|
mod test_app_server;
|
|
|
|
pub use analytics_server::start_analytics_events_server;
|
|
pub use auth_fixtures::ChatGptAuthFixture;
|
|
pub use auth_fixtures::ChatGptIdTokenClaims;
|
|
pub use auth_fixtures::encode_id_token;
|
|
pub use auth_fixtures::mount_workspace_routing;
|
|
pub use auth_fixtures::write_chatgpt_auth;
|
|
use codex_app_server_protocol::JSONRPCResponse;
|
|
pub use config::MockResponsesConfig;
|
|
pub use config::write_mock_responses_config_toml;
|
|
pub use config::write_mock_responses_config_toml_with_chatgpt_base_url;
|
|
pub use core_test_support::PathBufExt;
|
|
pub use core_test_support::format_with_current_shell;
|
|
pub use core_test_support::format_with_current_shell_display;
|
|
pub use core_test_support::format_with_current_shell_display_non_login;
|
|
pub use core_test_support::format_with_current_shell_non_login;
|
|
pub use core_test_support::test_absolute_path;
|
|
pub use core_test_support::test_path_buf_with_windows;
|
|
pub use core_test_support::test_tmp_path;
|
|
pub use core_test_support::test_tmp_path_buf;
|
|
pub use json_logging::app_server_json_shutdown_event;
|
|
pub use local_websocket_exec_server::LocalWebsocketExecServer;
|
|
pub use mock_model_server::create_mock_responses_server_repeating_assistant;
|
|
pub use mock_model_server::create_mock_responses_server_sequence;
|
|
pub use mock_model_server::create_mock_responses_server_sequence_unchecked;
|
|
pub use models_cache::write_models_cache;
|
|
pub use models_cache::write_models_cache_with_models;
|
|
pub use responses::create_apply_patch_sse_response;
|
|
pub use responses::create_command_execution_sse_response;
|
|
pub use responses::create_escalated_command_execution_sse_response;
|
|
pub use responses::create_exec_command_sse_response;
|
|
pub use responses::create_final_assistant_message_sse_response;
|
|
pub use responses::create_request_permissions_sse_response;
|
|
pub use responses::create_request_user_input_sse_response;
|
|
pub use rollout::create_fake_paginated_rollout;
|
|
pub use rollout::create_fake_parented_rollout_with_source;
|
|
pub use rollout::create_fake_rollout;
|
|
pub use rollout::create_fake_rollout_with_session_and_thread_source;
|
|
pub use rollout::create_fake_rollout_with_source;
|
|
pub use rollout::create_fake_rollout_with_text_elements;
|
|
pub use rollout::create_fake_rollout_with_token_usage;
|
|
pub use rollout::rollout_path;
|
|
use serde::de::DeserializeOwned;
|
|
pub use test_app_server::DEFAULT_APP_SERVER_TEST_ARGS;
|
|
pub use test_app_server::DEFAULT_CLIENT_NAME;
|
|
pub use test_app_server::TestAppServer;
|
|
pub use test_app_server::TestAppServerBuilder;
|
|
|
|
pub fn to_response<T: DeserializeOwned>(response: JSONRPCResponse) -> anyhow::Result<T> {
|
|
let value = serde_json::to_value(response.result)?;
|
|
let codex_response = serde_json::from_value(value)?;
|
|
Ok(codex_response)
|
|
}
|