mirror of
https://github.com/openai/codex.git
synced 2026-11-29 00:00:54 +00:00
Isolate MCP OAuth credentials by environment (#36310)
## Why MCP servers running in an executor must not reuse host-owned OAuth credentials, even when they have the same configured server name and URL. ## What changed - Derive environment-scoped credential names for executor-owned MCP servers and use them consistently for login, logout, authentication, and connection setup. - Mark executor-owned entries in the file credential store and fail closed when loading or saving an entry could cross the host/executor boundary. - Preserve compatibility with existing local OAuth credentials, including local server names that overlap the new reserved prefixes. ## Testing - Extend the executor MCP integration test to verify that executor requests use the executor token, never send the host token, and persist both credentials separately. GitOrigin-RevId: 4fc92d0533b0fe2e0df34f6d47b81e3d20d07807
This commit is contained in:
@@ -1923,13 +1923,14 @@ impl PluginRequestProcessor {
|
||||
let callback_url = config.mcp_oauth_callback_url.clone();
|
||||
let outgoing = Arc::clone(&self.outgoing);
|
||||
let notification_name = name.clone();
|
||||
let oauth_credential_name = server.oauth_credential_name(&name).into_owned();
|
||||
let thread_manager = Arc::clone(&self.thread_manager);
|
||||
let http_client = Arc::clone(&http_client);
|
||||
|
||||
tokio::spawn(async move {
|
||||
let oauth_client_id = server.oauth_client_id();
|
||||
let first_attempt = perform_oauth_login_silent(
|
||||
&name,
|
||||
&oauth_credential_name,
|
||||
&oauth_config.url,
|
||||
store_mode,
|
||||
keyring_backend_kind,
|
||||
@@ -1947,7 +1948,7 @@ impl PluginRequestProcessor {
|
||||
let final_result = match first_attempt {
|
||||
Err(err) if should_retry_without_scopes(&resolved_scopes, &err) => {
|
||||
perform_oauth_login_silent(
|
||||
&name,
|
||||
&oauth_credential_name,
|
||||
&oauth_config.url,
|
||||
store_mode,
|
||||
keyring_backend_kind,
|
||||
|
||||
Reference in New Issue
Block a user