Add network environment ID plumbing (#28766)

## Why

Prepare network approval scoping to distinguish execution environments
without changing behavior yet.

## What changed

- Add optional environment IDs to network policy requests.
- Add optional network environment IDs to exec and sandbox request
structs.
- Thread default None values through existing construction points.
- Fix stale constructor call sites that caused the CI compile failures.

## Not included

- Per-environment proxy listeners.
- Network approval cache or prompt behavior changes.
- Ambiguous request attribution handling.

Those behavior changes moved to stacked follow-up #28899.

## Validation

- just fmt
- CI will run tests and clippy
This commit is contained in:
jif authored and GitHub committed 2026-06-18 14:09:38 +02:00
1 parent ecc4c30e28
commit 0369b24d54
21 files changed
+60

No files matched your search

+4
View File
@@ -113,6 +113,7 @@ pub struct SandboxExecRequest {
pub sandbox_policy_cwd: PathUri,
pub env: HashMap<String, String>,
pub network: Option<NetworkProxy>,
pub network_environment_id: Option<String>,
pub sandbox: SandboxType,
pub windows_sandbox_level: WindowsSandboxLevel,
pub windows_sandbox_private_desktop: bool,
@@ -130,6 +131,7 @@ pub struct SandboxTransformRequest<'a> {
pub permissions: &'a PermissionProfile,
pub sandbox: SandboxType,
pub enforce_managed_network: bool,
pub environment_id: Option<&'a str>,
// TODO(viyatb): Evaluate switching this to Option<Arc<NetworkProxy>>
// to make shared ownership explicit across runtime/sandbox plumbing.
pub network: Option<&'a NetworkProxy>,
@@ -305,6 +307,7 @@ impl SandboxManager {
permissions,
sandbox,
enforce_managed_network,
environment_id,
network,
sandbox_policy_cwd,
codex_linux_sandbox_exe,
@@ -422,6 +425,7 @@ impl SandboxManager {
sandbox_policy_cwd: sandbox_policy_cwd.clone(),
env: command.env,
network: network.cloned(),
network_environment_id: environment_id.map(str::to_string),
sandbox,
windows_sandbox_level,
windows_sandbox_private_desktop,