mirror of
https://github.com/openai/codex.git
synced 2026-11-18 15:01:48 +00:00
chore: Nest skill and protocol network permissions under network.enabled (#13427)
## Summary
Changes the permission profile shape from a bare network boolean to a
nested object.
Before:
```yaml
permissions:
network: true
```
After:
```yaml
permissions:
network:
enabled: true
```
This also updates the shared Rust and app-server protocol types so
`PermissionProfile.network` is no longer `Option<bool>`, but
`Option<NetworkPermissions>` with `enabled: Option<bool>`.
## What Changed
- Updated `PermissionProfile` in `codex-rs/protocol/src/models.rs`:
- `pub network: Option<bool>` -> `pub network:
Option<NetworkPermissions>`
- Added `NetworkPermissions` with:
- `pub enabled: Option<bool>`
- Changed emptiness semantics so `network` is only considered empty when
`enabled` is `None`
- Updated skill metadata parsing to accept `permissions.network.enabled`
- Updated core permission consumers to read
`network.enabled.unwrap_or(false)` where a concrete boolean is needed
- Updated app-server v2 protocol types and regenerated schema/TypeScript
outputs
- Updated docs to mention `additionalPermissions.network.enabled`
This commit is contained in:
1 parent
2e154a35bc
commit
d622bff384
19 files changed
+216
-40
No files matched your search
@@ -193,7 +193,12 @@ fn merge_network_access(
|
||||
base_network_access: bool,
|
||||
additional_permissions: &PermissionProfile,
|
||||
) -> bool {
|
||||
base_network_access || matches!(additional_permissions.network, Some(true))
|
||||
base_network_access
|
||||
|| additional_permissions
|
||||
.network
|
||||
.as_ref()
|
||||
.and_then(|network| network.enabled)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
fn sandbox_policy_with_additional_permissions(
|
||||
@@ -431,6 +436,7 @@ mod tests {
|
||||
use crate::tools::sandboxing::SandboxablePreference;
|
||||
use codex_protocol::config_types::WindowsSandboxLevel;
|
||||
use codex_protocol::models::FileSystemPermissions;
|
||||
use codex_protocol::models::NetworkPermissions;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use dunce::canonicalize;
|
||||
@@ -470,7 +476,9 @@ mod tests {
|
||||
)
|
||||
.expect("absolute temp dir");
|
||||
let permissions = normalize_additional_permissions(PermissionProfile {
|
||||
network: Some(true),
|
||||
network: Some(NetworkPermissions {
|
||||
enabled: Some(true),
|
||||
}),
|
||||
file_system: Some(FileSystemPermissions {
|
||||
read: Some(vec![path.clone()]),
|
||||
write: Some(vec![path.clone()]),
|
||||
@@ -479,7 +487,12 @@ mod tests {
|
||||
})
|
||||
.expect("permissions");
|
||||
|
||||
assert_eq!(permissions.network, Some(true));
|
||||
assert_eq!(
|
||||
permissions.network,
|
||||
Some(NetworkPermissions {
|
||||
enabled: Some(true),
|
||||
})
|
||||
);
|
||||
assert_eq!(
|
||||
permissions.file_system,
|
||||
Some(FileSystemPermissions {
|
||||
@@ -505,7 +518,9 @@ mod tests {
|
||||
network_access: false,
|
||||
},
|
||||
&PermissionProfile {
|
||||
network: Some(true),
|
||||
network: Some(NetworkPermissions {
|
||||
enabled: Some(true),
|
||||
}),
|
||||
file_system: Some(FileSystemPermissions {
|
||||
read: Some(vec![path.clone()]),
|
||||
write: Some(Vec::new()),
|
||||
|
||||
Reference in new issue
Block a user