From 3c0c775143a599d533660788a29b0b707ee2cfdb Mon Sep 17 00:00:00 2001 From: Matthew Zeng Date: Tue, 5 May 2026 11:09:31 -0700 Subject: [PATCH] Reuse shared ChatGPT host allowlist --- codex-rs/Cargo.lock | 1 + codex-rs/codex-mcp/Cargo.toml | 1 + codex-rs/codex-mcp/src/mcp/mod.rs | 9 ++------- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lock index 53a1c4cc6b..8bf342155a 100644 --- a/codex-rs/Cargo.lock +++ b/codex-rs/Cargo.lock @@ -2983,6 +2983,7 @@ dependencies = [ "async-channel", "codex-api", "codex-async-utils", + "codex-client", "codex-config", "codex-exec-server", "codex-login", diff --git a/codex-rs/codex-mcp/Cargo.toml b/codex-rs/codex-mcp/Cargo.toml index c3061adca9..de6615ad06 100644 --- a/codex-rs/codex-mcp/Cargo.toml +++ b/codex-rs/codex-mcp/Cargo.toml @@ -16,6 +16,7 @@ anyhow = { workspace = true } async-channel = { workspace = true } codex-async-utils = { workspace = true } codex-api = { workspace = true } +codex-client = { workspace = true } codex-config = { workspace = true } codex-exec-server = { workspace = true } codex-login = { workspace = true } diff --git a/codex-rs/codex-mcp/src/mcp/mod.rs b/codex-rs/codex-mcp/src/mcp/mod.rs index 196cfa18bd..cb81b54eed 100644 --- a/codex-rs/codex-mcp/src/mcp/mod.rs +++ b/codex-rs/codex-mcp/src/mcp/mod.rs @@ -17,6 +17,7 @@ use std::path::PathBuf; use std::time::Duration; use async_channel::unbounded; +use codex_client::is_allowed_chatgpt_host; use codex_config::Constrained; use codex_config::McpServerConfig; use codex_config::McpServerProvenance; @@ -474,13 +475,7 @@ fn is_allowed_codex_apps_chatgpt_host(host: &Option>) -> bool { let Some(Host::Domain(host)) = host else { return false; }; - let host = *host; - - host == "chatgpt.com" - || host == "chat.openai.com" - || host == "chatgpt-staging.com" - || host.ends_with(".chatgpt.com") - || host.ends_with(".chatgpt-staging.com") + is_allowed_chatgpt_host(host) } fn is_localhost_for_codex_apps(host: &Option>) -> bool {