mirror of
https://github.com/openai/codex.git
synced 2026-11-17 14:58:36 +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:
1 parent
5e8b22488f
commit
164b3bfeab
12 files changed
+194
-39
No files matched your search
@@ -128,12 +128,16 @@ impl McpServerConnectionIdentity {
|
||||
None
|
||||
};
|
||||
let oauth_credentials = stored_oauth_url.map_or(Ok(None), |url| {
|
||||
stored_oauth_credentials(server_name, url, store_mode, keyring_backend_kind).map_err(
|
||||
|error| {
|
||||
warn!(server_name, %error, "failed to read stored MCP OAuth credentials");
|
||||
error.to_string()
|
||||
},
|
||||
stored_oauth_credentials(
|
||||
config.oauth_credential_name(server_name).as_ref(),
|
||||
url,
|
||||
store_mode,
|
||||
keyring_backend_kind,
|
||||
)
|
||||
.map_err(|error| {
|
||||
warn!(server_name, %error, "failed to read stored MCP OAuth credentials");
|
||||
error.to_string()
|
||||
})
|
||||
});
|
||||
let local_stdio_fallback_cwd = (config.is_local_environment()
|
||||
&& matches!(
|
||||
|
||||
Reference in new issue
Block a user