mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
Honor managed network in bubblewrap probe
This commit is contained in:
@@ -629,9 +629,10 @@ pub async fn run_main_with_transport_options(
|
||||
range: None,
|
||||
});
|
||||
}
|
||||
if let Some(warning) =
|
||||
codex_core::config::system_bwrap_warning(config.permissions.permission_profile())
|
||||
{
|
||||
if let Some(warning) = codex_core::config::system_bwrap_warning(
|
||||
config.permissions.permission_profile(),
|
||||
config.managed_network_requirements_enabled(),
|
||||
) {
|
||||
config_warnings.push(ConfigWarningNotification {
|
||||
summary: warning,
|
||||
details: None,
|
||||
|
||||
@@ -845,8 +845,10 @@ async fn run_exec_session(args: ExecRunArgs) -> anyhow::Result<()> {
|
||||
// is using.
|
||||
event_processor.print_config_summary(&config, &prompt_summary, &session_configured);
|
||||
if !json_mode
|
||||
&& let Some(message) =
|
||||
codex_core::config::system_bwrap_warning(config.permissions.permission_profile())
|
||||
&& let Some(message) = codex_core::config::system_bwrap_warning(
|
||||
config.permissions.permission_profile(),
|
||||
config.managed_network_requirements_enabled(),
|
||||
)
|
||||
{
|
||||
event_processor.process_warning(message);
|
||||
}
|
||||
|
||||
@@ -52,12 +52,15 @@ enum SystemBwrapProbeResult {
|
||||
Failed,
|
||||
}
|
||||
|
||||
pub fn system_bwrap_warning(permission_profile: &PermissionProfile) -> Option<String> {
|
||||
pub fn system_bwrap_warning(
|
||||
permission_profile: &PermissionProfile,
|
||||
has_managed_network_requirements: bool,
|
||||
) -> Option<String> {
|
||||
let (file_system_policy, network_policy) = permission_profile.to_runtime_permissions();
|
||||
if !should_require_platform_sandbox(
|
||||
&file_system_policy,
|
||||
network_policy,
|
||||
/*has_managed_network_requirements*/ false,
|
||||
has_managed_network_requirements,
|
||||
) {
|
||||
return None;
|
||||
}
|
||||
@@ -65,7 +68,7 @@ pub fn system_bwrap_warning(permission_profile: &PermissionProfile) -> Option<St
|
||||
let system_bwrap_path = find_system_bwrap_in_path();
|
||||
system_bwrap_warning_for_path(
|
||||
system_bwrap_path.as_deref(),
|
||||
/*unshare_network*/ !network_policy.is_enabled(),
|
||||
/*unshare_network*/ !network_policy.is_enabled() || has_managed_network_requirements,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ use codex_protocol::error::CodexErr;
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
pub fn system_bwrap_warning(
|
||||
_permission_profile: &codex_protocol::models::PermissionProfile,
|
||||
_has_managed_network_requirements: bool,
|
||||
) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -105,9 +105,10 @@ pub(super) fn emit_project_config_warnings(app_event_tx: &AppEventSender, config
|
||||
}
|
||||
|
||||
pub(super) fn emit_system_bwrap_warning(app_event_tx: &AppEventSender, config: &Config) {
|
||||
let Some(message) =
|
||||
codex_sandboxing::system_bwrap_warning(config.permissions.permission_profile())
|
||||
else {
|
||||
let Some(message) = codex_sandboxing::system_bwrap_warning(
|
||||
config.permissions.permission_profile(),
|
||||
config.managed_network_requirements_enabled(),
|
||||
) else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
@@ -193,6 +193,20 @@ fn bypass_hook_trust_startup_warning_snapshot() {
|
||||
|
||||
assert_app_snapshot!("bypass_hook_trust_startup_warning", rendered);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disconnected_proc_sys_startup_warning_snapshot() {
|
||||
let rendered = lines_to_single_string(
|
||||
&history_cell::new_warning_event(
|
||||
"Codex's Linux sandbox cannot access /proc/sys because the mount is disconnected. Restart the environment or container before running sandboxed commands."
|
||||
.to_string(),
|
||||
)
|
||||
.display_lines(/*width*/ 80),
|
||||
);
|
||||
|
||||
assert_app_snapshot!("disconnected_proc_sys_startup_warning", rendered);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn enqueue_primary_thread_session_replays_buffered_approval_after_attach() -> Result<()> {
|
||||
let (mut app, mut app_event_rx, _op_rx) = make_test_app_with_channels().await;
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
---
|
||||
source: tui/src/app/tests.rs
|
||||
assertion_line: 207
|
||||
expression: rendered
|
||||
---
|
||||
⚠ Codex's Linux sandbox cannot access /proc/sys because the mount is
|
||||
disconnected. Restart the environment or container before running sandboxed
|
||||
commands.
|
||||
Reference in New Issue
Block a user