aKode: eliminato chatgpt_base_url ormai inutilizzato
- La chiave è ancora accettata nei file di configurazione ma ignorata. - Schemi JSON e TypeScript dell'app-server rigenerati; i bundle ora si chiamano akode_app_server_protocol*.schemas.json, come produce il generatore. - app-server: niente più avviso unused_mut nella build release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4450,12 +4450,10 @@ async fn streamable_http_chatgpt_auth_is_not_sent_to_configured_origin() -> anyh
|
||||
let untrusted_server = MockServer::start().await;
|
||||
let untrusted_apps = McpTestServer::mount(&untrusted_server).await?;
|
||||
let untrusted_mcp_url = format!("{}/mcp", untrusted_apps.base_url);
|
||||
let untrusted_chatgpt_base_url = untrusted_apps.base_url;
|
||||
|
||||
let fixture = test_codex()
|
||||
.with_auth(CodexAuth::from_api_key("Test API Key"))
|
||||
.with_config(move |config| {
|
||||
config.chatgpt_base_url = untrusted_chatgpt_base_url;
|
||||
insert_mcp_server(
|
||||
config,
|
||||
"untrusted_origin",
|
||||
@@ -4506,67 +4504,6 @@ async fn streamable_http_chatgpt_auth_is_not_sent_to_configured_origin() -> anyh
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
|
||||
async fn configured_chatgpt_base_url_does_not_grant_mcp_chatgpt_auth() -> anyhow::Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = responses::start_mock_server().await;
|
||||
let untrusted_server = MockServer::start().await;
|
||||
let untrusted_apps = McpTestServer::mount(&untrusted_server).await?;
|
||||
let untrusted_mcp_url = format!("{}/mcp", untrusted_apps.base_url);
|
||||
let untrusted_chatgpt_base_url = untrusted_apps.base_url;
|
||||
|
||||
let fixture = test_codex()
|
||||
.with_auth(CodexAuth::from_api_key("Test API Key"))
|
||||
.with_pre_build_hook(move |codex_home| {
|
||||
fs::write(
|
||||
codex_home.join("config.toml"),
|
||||
format!(
|
||||
r#"
|
||||
chatgpt_base_url = "{untrusted_chatgpt_base_url}"
|
||||
|
||||
[mcp_servers.untrusted_origin]
|
||||
url = "{untrusted_mcp_url}"
|
||||
auth = "chatgpt"
|
||||
"#,
|
||||
),
|
||||
)
|
||||
.expect("write attacker-controlled MCP config");
|
||||
})
|
||||
.build(&server)
|
||||
.await?;
|
||||
|
||||
wait_for_mcp_server(&fixture.codex, "untrusted_origin").await?;
|
||||
let observed_requests = untrusted_server
|
||||
.received_requests()
|
||||
.await
|
||||
.expect("mock server should capture MCP startup requests")
|
||||
.into_iter()
|
||||
.filter(|request| request.url.path() == "/mcp")
|
||||
.filter_map(|request| {
|
||||
let body: Value = serde_json::from_slice(&request.body).ok()?;
|
||||
let method = body.get("method")?.as_str()?.to_string();
|
||||
let authorization = request
|
||||
.headers
|
||||
.get("authorization")
|
||||
.and_then(|value| value.to_str().ok())
|
||||
.map(str::to_string);
|
||||
Some((method, authorization))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assert_eq!(
|
||||
observed_requests,
|
||||
vec![
|
||||
("initialize".to_string(), None),
|
||||
("notifications/initialized".to_string(), None),
|
||||
("tools/list".to_string(), None),
|
||||
],
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// This test writes to a fallback credentials file in AKODE_HOME.
|
||||
/// Ideally, we wouldn't need to serialize the test but it's much more cumbersome to wire AKODE_HOME through the code.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user