Add network policy metadata to environment configuration (#39055)

## What changed

- Add `EnvironmentNetworkPolicy` as a serializable view of portable domain,
  Unix-socket, upstream-proxy, and local-binding restrictions without exposing
  controller-owned proxy runtime settings.
- Add an optional `network_policy` field to `EnvironmentConfig` and re-export
  the policy and related permission types through the core APIs.
- Reject owner-provided network policies during environment preview and
  readiness until runtime enforcement is implemented, while preserving the
  existing controller policy when the field is absent.

## Testing

- Cover rejection through both environment preview and readiness, including
  preservation of the existing environment selection.

GitOrigin-RevId: 80ad4cf4d4a45632daa7a823e6cf568eb0e8bb80
This commit is contained in:
sayan-oai authored and copyberry committed 2026-08-17 19:22:45 +00:00
1 parent fe5889928c
commit 4a7b51c560
21 files changed
+144

No files matched your search

@@ -788,6 +788,7 @@ mod tests {
permission_profile: PermissionProfileSnapshot::legacy(PermissionProfile::read_only()),
shell_environment_policy: Default::default(),
exec_policy: None,
network_policy: None,
selected_capability_roots: Vec::new(),
}
}
@@ -961,6 +962,7 @@ url = "ws://127.0.0.1:8765"
),
shell_environment_policy: Default::default(),
exec_policy: None,
network_policy: None,
selected_capability_roots: Vec::new(),
};
let turn_environments = ThreadEnvironments::new(
@@ -1164,6 +1166,7 @@ url = "ws://127.0.0.1:8765"
),
shell_environment_policy: Default::default(),
exec_policy: None,
network_policy: None,
selected_capability_roots: Vec::new(),
};
let cwd = PathUri::from_abs_path(&cwd);
@@ -1499,6 +1502,7 @@ url = "ws://127.0.0.1:8765"
),
shell_environment_policy: Default::default(),
exec_policy: None,
network_policy: None,
selected_capability_roots: Vec::new(),
};
let environments = ThreadEnvironments::new(
@@ -1544,6 +1548,7 @@ url = "ws://127.0.0.1:8765"
permission_profile: PermissionProfileSnapshot::legacy(PermissionProfile::read_only()),
shell_environment_policy: Default::default(),
exec_policy: None,
network_policy: None,
selected_capability_roots: vec![root("parent-root")],
};
let mut owner_selection = selection.clone();