mirror of
https://github.com/openai/codex.git
synced 2026-11-17 14:58:36 +00:00
Enforce Agent Plugin runtime boundaries (#37027)
## What changed - Track Agent Plugin manifests through plugin, skill, and MCP loading so their capabilities use format-specific behavior without changing legacy plugins. - Discover only direct-child skills, exclude app and hook capabilities, isolate MCP data, and reject MCP configuration files that are non-regular or resolve outside the plugin root. - Bound model-visible skill instructions, plugin instructions, MCP descriptions, schemas, individual tools, and the aggregate Agent Plugin MCP tool set. - Stop MCP and OAuth redirects when Agent Plugins send configured or authorization headers, while retaining existing redirect behavior for legacy MCP servers. ## Testing - Add coverage for capability filtering, skill discovery, isolated MCP data and reserved-path expansion, unsafe MCP configuration files, context limits, and redirect handling. GitOrigin-RevId: c9af66b051269f3226628ca280a58d32c808c38f
This commit is contained in:
1 parent
f21dc46388
commit
56b82e676c
63 files changed
+1830
-106
No files matched your search
@@ -24,11 +24,20 @@ use tracing::warn;
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EffectiveMcpServer {
|
||||
config: McpServerConfig,
|
||||
agent_plugin: bool,
|
||||
}
|
||||
|
||||
impl EffectiveMcpServer {
|
||||
pub fn configured(config: McpServerConfig) -> Self {
|
||||
Self { config }
|
||||
Self {
|
||||
config,
|
||||
agent_plugin: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_agent_plugin(mut self, agent_plugin: bool) -> Self {
|
||||
self.agent_plugin = agent_plugin;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn config(&self) -> &McpServerConfig {
|
||||
@@ -42,6 +51,10 @@ impl EffectiveMcpServer {
|
||||
pub fn required(&self) -> bool {
|
||||
self.config.required
|
||||
}
|
||||
|
||||
pub fn is_agent_plugin(&self) -> bool {
|
||||
self.agent_plugin
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn has_explicit_http_authorization(config: &McpServerConfig) -> bool {
|
||||
@@ -92,6 +105,7 @@ pub(crate) struct McpServerConnectionIdentity {
|
||||
codex_apps_cache_identity: Option<(PathBuf, ConnectorRuntimeContextKey)>,
|
||||
client_elicitation_capability: ElicitationCapability,
|
||||
client_mcp_extensions: ClientMcpExtensions,
|
||||
agent_plugin: bool,
|
||||
}
|
||||
|
||||
impl McpServerConnectionIdentity {
|
||||
@@ -165,6 +179,7 @@ impl McpServerConnectionIdentity {
|
||||
codex_apps_cache_identity,
|
||||
client_elicitation_capability,
|
||||
client_mcp_extensions,
|
||||
agent_plugin: server.is_agent_plugin(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,6 +208,7 @@ impl McpServerConnectionIdentity {
|
||||
&& self.codex_apps_cache_identity == other.codex_apps_cache_identity
|
||||
&& self.client_elicitation_capability == other.client_elicitation_capability
|
||||
&& self.client_mcp_extensions == other.client_mcp_extensions
|
||||
&& self.agent_plugin == other.agent_plugin
|
||||
}
|
||||
|
||||
pub(crate) fn oauth_credentials(&self) -> Result<&Option<StoredOAuthTokens>, &String> {
|
||||
|
||||
Reference in new issue
Block a user