mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Freeze plugin roots in MCP tool attribution (#41117)
## Why Plugin MCP trust decisions must describe the exact host-discovered server registration. Looking up a plugin again by ID can resolve a different root. ## What changed - Retain the host plugin root in MCP catalog attribution and connection identity. - Reconnect an MCP server when its attributed plugin root changes. - Pass the retained root through tool lifecycle attribution and use it directly when building trusted tool context. ## Testing Add coverage for catalog identity, connection reconciliation, lifecycle attribution, and rejecting a different root associated with the same plugin ID. GitOrigin-RevId: bc92743dd40ab44065a07c3ea972b4956ef8351f
This commit is contained in:
1 parent
6c59264b14
commit
aa89cf62bb
11 files changed
+279
-38
No files matched your search
@@ -30,6 +30,7 @@ use std::sync::atomic::Ordering;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::binding::call_tool_result_from_rmcp;
|
||||
use crate::catalog::McpServerSource;
|
||||
use crate::elicitation::ElicitationRequestManager;
|
||||
use crate::elicitation::ElicitationRequestRouter;
|
||||
use crate::mcp::CODEX_APPS_MCP_SERVER_NAME;
|
||||
@@ -284,14 +285,19 @@ impl McpConnectionSet {
|
||||
.into_iter()
|
||||
.filter(|(_, server)| server.enabled())
|
||||
{
|
||||
let is_host_owned_codex_apps = config
|
||||
.mcp_server_catalog
|
||||
.server(&server_name)
|
||||
.is_some_and(|server| {
|
||||
server
|
||||
.source()
|
||||
.is_host_owned_apps(&server_name, server.config())
|
||||
});
|
||||
let registration = config.mcp_server_catalog.server(&server_name);
|
||||
let is_host_owned_codex_apps = registration.is_some_and(|server| {
|
||||
server
|
||||
.source()
|
||||
.is_host_owned_apps(&server_name, server.config())
|
||||
});
|
||||
let host_plugin_root = registration.and_then(|server| match server.source() {
|
||||
McpServerSource::Plugin(plugin) => plugin.host_root(),
|
||||
McpServerSource::SelectedPlugin(_)
|
||||
| McpServerSource::Config
|
||||
| McpServerSource::Compatibility { .. }
|
||||
| McpServerSource::Extension { .. } => None,
|
||||
});
|
||||
let catalog_item_limit = if is_host_owned_codex_apps {
|
||||
MAX_CODEX_APPS_TOOL_CATALOG_ITEMS
|
||||
} else {
|
||||
@@ -348,6 +354,7 @@ impl McpConnectionSet {
|
||||
let connection_identity = McpServerConnectionIdentity::new(
|
||||
&server_name,
|
||||
&server,
|
||||
host_plugin_root,
|
||||
store_mode,
|
||||
keyring_backend_kind,
|
||||
&resolved_environment,
|
||||
|
||||
Reference in new issue
Block a user