Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codex-rs/app-server-protocol/src/protocol/v2/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ pub enum NetworkDomainPermission {
#[ts(export_to = "v2/")]
pub enum NetworkUnixSocketPermission {
Allow,
None,
Deny,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/app-server-protocol/src/protocol/v2/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2277,7 +2277,7 @@ fn network_requirements_serializes_canonical_and_legacy_fields() {
),
(
"/tmp/ignored.sock".to_string(),
NetworkUnixSocketPermission::None,
NetworkUnixSocketPermission::Deny,
),
])),
allow_unix_sockets: Some(vec!["/tmp/proxy.sock".to_string()]),
Expand All @@ -2301,7 +2301,7 @@ fn network_requirements_serializes_canonical_and_legacy_fields() {
"allowedDomains": ["api.openai.com"],
"deniedDomains": ["blocked.example.com"],
"unixSockets": {
"/tmp/ignored.sock": "none",
"/tmp/ignored.sock": "deny",
"/tmp/proxy.sock": "allow"
},
"allowUnixSockets": ["/tmp/proxy.sock"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ fn map_network_unix_socket_permission_to_api(
) -> NetworkUnixSocketPermission {
match permission {
codex_config::NetworkUnixSocketPermissionToml::Allow => NetworkUnixSocketPermission::Allow,
codex_config::NetworkUnixSocketPermissionToml::None => NetworkUnixSocketPermission::None,
codex_config::NetworkUnixSocketPermissionToml::Deny => NetworkUnixSocketPermission::Deny,
}
}

Expand Down
21 changes: 14 additions & 7 deletions codex-rs/config/src/config_requirements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ impl NetworkUnixSocketPermissionsToml {
#[serde(rename_all = "lowercase")]
pub enum NetworkUnixSocketPermissionToml {
Allow,
None,
Deny,
}

impl std::fmt::Display for NetworkUnixSocketPermissionToml {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let permission = match self {
Self::Allow => "allow",
Self::None => "none",
Self::Deny => "deny",
};
f.write_str(permission)
}
Expand Down Expand Up @@ -2868,6 +2868,7 @@ command = "python3 /enterprise/hooks/pre.py"

[experimental_network.unix_sockets]
"/tmp/example.sock" = "allow"
"/tmp/blocked.sock" = "deny"
"#;

let source = RequirementSource::CloudRequirements;
Expand Down Expand Up @@ -2912,10 +2913,16 @@ command = "python3 /enterprise/hooks/pre.py"
assert_eq!(
sourced_network.value.unix_sockets.as_ref(),
Some(&NetworkUnixSocketPermissionsToml {
entries: BTreeMap::from([(
"/tmp/example.sock".to_string(),
NetworkUnixSocketPermissionToml::Allow,
)]),
entries: BTreeMap::from([
(
"/tmp/blocked.sock".to_string(),
NetworkUnixSocketPermissionToml::Deny,
),
(
"/tmp/example.sock".to_string(),
NetworkUnixSocketPermissionToml::Allow,
),
]),
})
);
assert_eq!(sourced_network.value.allow_local_binding, Some(false));
Expand Down Expand Up @@ -3053,7 +3060,7 @@ command = "python3 /enterprise/hooks/pre.py"
),
(
"/tmp/ignored.sock".to_string(),
NetworkUnixSocketPermissionToml::None,
NetworkUnixSocketPermissionToml::Deny,
),
]),
};
Expand Down
6 changes: 3 additions & 3 deletions codex-rs/config/src/permissions_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,14 @@ impl NetworkUnixSocketPermissionsToml {
#[serde(rename_all = "lowercase")]
pub enum NetworkUnixSocketPermissionToml {
Allow,
None,
Deny,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain legacy none parsing for socket denies

For any existing user/profile config that already has [permissions.*.network.unix_sockets] entries set to "none", this enum now deserializes only "allow"/"deny", so Codex will reject the config during startup instead of treating that entry as a denied override. The new outward spelling can still be "deny", but Deny should keep a #[serde(alias = "none")] compatibility alias here and on the mirrored managed/feature/proxy config enums, matching the filesystem permission migration pattern.

Useful? React with 👍 / 👎.

}

impl std::fmt::Display for NetworkUnixSocketPermissionToml {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let permission = match self {
Self::Allow => "allow",
Self::None => "none",
Self::Deny => "deny",
};
f.write_str(permission)
}
Expand Down Expand Up @@ -547,7 +547,7 @@ impl NetworkToml {
NetworkUnixSocketPermissionToml::Allow => {
ProxyNetworkUnixSocketPermission::Allow
}
NetworkUnixSocketPermissionToml::None => ProxyNetworkUnixSocketPermission::None,
NetworkUnixSocketPermissionToml::Deny => ProxyNetworkUnixSocketPermission::Deny,
};
proxy_unix_sockets.entries.insert(path.clone(), permission);
}
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/core/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@
"NetworkProxyUnixSocketPermissionToml": {
"enum": [
"allow",
"none"
"deny"
],
"type": "string"
},
Expand Down Expand Up @@ -1825,7 +1825,7 @@
"NetworkUnixSocketPermissionToml": {
"enum": [
"allow",
"none"
"deny"
],
"type": "string"
},
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/core/src/config/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ pub(crate) fn apply_network_proxy_feature_config(
NetworkProxyUnixSocketPermissionToml::Allow => {
NetworkUnixSocketPermissionToml::Allow
}
NetworkProxyUnixSocketPermissionToml::None => {
NetworkUnixSocketPermissionToml::None
NetworkProxyUnixSocketPermissionToml::Deny => {
NetworkUnixSocketPermissionToml::Deny
}
};
(path.clone(), permission)
Expand Down
8 changes: 5 additions & 3 deletions codex-rs/core/src/config/permissions_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn network_permission_containers_project_allowed_and_denied_entries() {
),
(
"/tmp/ignored.sock".to_string(),
NetworkUnixSocketPermissionToml::None,
NetworkUnixSocketPermissionToml::Deny,
),
]),
};
Expand Down Expand Up @@ -211,7 +211,7 @@ fn network_toml_overlays_unix_socket_permissions_by_path() {
),
(
"/tmp/override.sock".to_string(),
NetworkUnixSocketPermissionToml::None,
NetworkUnixSocketPermissionToml::Deny,
),
]),
}),
Expand All @@ -233,7 +233,7 @@ fn network_toml_overlays_unix_socket_permissions_by_path() {
),
(
"/tmp/override.sock".to_string(),
ProxyNetworkUnixSocketPermission::None,
ProxyNetworkUnixSocketPermission::Deny,
),
]),
})
Expand Down Expand Up @@ -265,6 +265,7 @@ enabled = true

[base.network.unix_sockets]
"/tmp/base.sock" = "allow"
"/tmp/blocked.sock" = "deny"

[child]
extends = "base"
Expand Down Expand Up @@ -319,6 +320,7 @@ allow_local_binding = true

[network.unix_sockets]
"/tmp/base.sock" = "allow"
"/tmp/blocked.sock" = "deny"
"/tmp/child.sock" = "allow"
"#,
)
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/features/src/feature_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ pub enum NetworkProxyDomainPermissionToml {
#[serde(rename_all = "lowercase")]
pub enum NetworkProxyUnixSocketPermissionToml {
Allow,
None,
Deny,
}
2 changes: 1 addition & 1 deletion codex-rs/network-proxy/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl NetworkDomainPermissions {
#[serde(rename_all = "lowercase")]
pub enum NetworkUnixSocketPermission {
Allow,
None,
Deny,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
Expand Down
6 changes: 3 additions & 3 deletions codex-rs/tui/src/debug_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ fn format_network_unix_socket_permission(
) -> &'static str {
match permission {
NetworkUnixSocketPermissionToml::Allow => "allow",
NetworkUnixSocketPermissionToml::None => "none",
NetworkUnixSocketPermissionToml::Deny => "deny",
}
}

Expand Down Expand Up @@ -837,7 +837,7 @@ mod tests {
),
(
"/tmp/blocked.sock".to_string(),
NetworkUnixSocketPermissionToml::None,
NetworkUnixSocketPermissionToml::Deny,
),
]),
}),
Expand All @@ -854,7 +854,7 @@ mod tests {

let rendered = render_to_text(&render_debug_config_lines(&stack));
assert!(rendered.contains(
"experimental_network: unix_sockets={/tmp/blocked.sock=none, /tmp/codex.sock=allow} (source: cloud requirements)"
"experimental_network: unix_sockets={/tmp/blocked.sock=deny, /tmp/codex.sock=allow} (source: cloud requirements)"
));
}

Expand Down
Loading