mirror of
https://github.com/openai/codex.git
synced 2026-11-17 14:58:36 +00:00
Resolve enterprise-managed MCP registrations in the catalog (#45459)
## What changed - Retain the trusted enterprise identity provider in runtime configuration and bind winning MCP registrations during catalog finalization. Require `features.use_xaa` and a configured identity provider for activation, while preserving existing server restrictions. - Apply plugin `ema_auth` client, issuer, resource, and scope settings to installed and selected plugins. Disable registrations with mismatched endpoints or empty resources without rewriting plugin endpoints. - Preserve enterprise auth policy across catalog rebuilds and rebind registrations when materialized server settings change. Keep registration rejection separate from persistent server-name vetoes so it does not disable replacement hosted apps. ## Testing Add coverage for activation gates, configuration ownership, plugin endpoint validation, catalog rebuilds, and skipping interactive OAuth during installation of enterprise-managed plugins. Stabilize the sandbox network proxy test by reading request headers before closing the loopback connection. GitOrigin-RevId: 3374f507d120835b285767cedbbb511fc7b0fba2
This commit is contained in:
1 parent
b876f88981
commit
374c4b2d82
15 files changed
+792
-47
No files matched your search
@@ -1492,18 +1492,30 @@ url = "https://example.com/allowed-mcp"
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test_case("disabled")]
|
||||
#[test_case("enterprise")]
|
||||
#[tokio::test]
|
||||
async fn plugin_install_skips_mcp_oauth_disabled_by_plugin_config() -> Result<()> {
|
||||
async fn plugin_install_skips_mcp_oauth_managed_by_plugin_config(case: &str) -> Result<()> {
|
||||
let oauth_server = MockServer::start().await;
|
||||
let endpoint = format!("{}/mcp", oauth_server.uri());
|
||||
let mcp_settings = match case {
|
||||
"disabled" => "enabled = false".to_string(),
|
||||
"enterprise" => format!(
|
||||
"ema_auth = {{ url = '{endpoint}', resource = '{endpoint}', client_id = 'resource-client', authorization_server_issuer = 'https://as.example' }}"
|
||||
),
|
||||
_ => unreachable!("unknown test case"),
|
||||
};
|
||||
let codex_home = TempDir::new()?;
|
||||
std::fs::write(
|
||||
codex_home.path().join("config.toml"),
|
||||
r#"[features]
|
||||
format!(
|
||||
r#"[features]
|
||||
plugins = true
|
||||
|
||||
[plugins."sample-plugin@debug".mcp_servers.sample-mcp]
|
||||
enabled = false
|
||||
"#,
|
||||
{mcp_settings}
|
||||
"#
|
||||
),
|
||||
)?;
|
||||
|
||||
let repo_root = TempDir::new()?;
|
||||
@@ -1550,10 +1562,8 @@ enabled = false
|
||||
.get("plugins")
|
||||
.and_then(|plugins| plugins.get("sample-plugin@debug"))
|
||||
.and_then(|plugin| plugin.get("mcp_servers"))
|
||||
.and_then(|servers| servers.get("sample-mcp"))
|
||||
.and_then(|server| server.get("enabled"))
|
||||
.and_then(toml::Value::as_bool),
|
||||
Some(false)
|
||||
.and_then(|servers| servers.get("sample-mcp")),
|
||||
Some(&toml::from_str::<toml::Value>(&mcp_settings)?)
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user