From 8b096dce07b94aa4428ca310b871e5a873c8d2a2 Mon Sep 17 00:00:00 2001 From: jif Date: Tue, 24 Nov 2026 10:51:42 +0000 Subject: [PATCH] Remove the TUI snapshot test for `/mcp` secret masking (#63619) ## What changed Remove the snapshot test for masking environment variable and HTTP header values in `/mcp` output, its saved snapshot, and the HTTP server fixture helper used by the test. GitOrigin-RevId: d42092505760639776a779e93837a675ac14dece --- ...p_tools_output_masks_sensitive_values.snap | 26 ----- codex-rs/tui/src/history_cell/tests.rs | 98 ------------------- 2 files changed, 124 deletions(-) delete mode 100644 codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__mcp_tools_output_masks_sensitive_values.snap diff --git a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__mcp_tools_output_masks_sensitive_values.snap b/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__mcp_tools_output_masks_sensitive_values.snap deleted file mode 100644 index 329cd232d8..0000000000 --- a/codex-rs/tui/src/history_cell/snapshots/codex_tui__history_cell__tests__mcp_tools_output_masks_sensitive_values.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tui/src/history_cell.rs -expression: rendered ---- -/mcp - -🔌 MCP Tools - - • docs - • Status: enabled - • Auth: Unsupported - • Command: docs-server - • Env: TOKEN=*****, APP_TOKEN=***** - • Tools: list - • Resources: (none) - • Resource templates: (none) - - • http - • Status: enabled - • Auth: Unsupported - • URL: https://example.com/mcp - • HTTP headers: Authorization=***** - • Env HTTP headers: X-API-Key=API_KEY_ENV - • Tools: ping - • Resources: (none) - • Resource templates: (none) diff --git a/codex-rs/tui/src/history_cell/tests.rs b/codex-rs/tui/src/history_cell/tests.rs index dcd0da4681..15cfa36139 100644 --- a/codex-rs/tui/src/history_cell/tests.rs +++ b/codex-rs/tui/src/history_cell/tests.rs @@ -191,38 +191,6 @@ fn stdio_server_config( .expect("test stdio MCP config should deserialize") } -fn streamable_http_server_config( - url: &str, - bearer_token_env_var: Option<&str>, - http_headers: Option>, - env_http_headers: Option>, -) -> McpServerConfig { - let mut table = toml::Table::new(); - table.insert("url".to_string(), toml::Value::String(url.to_string())); - if let Some(bearer_token_env_var) = bearer_token_env_var { - table.insert( - "bearer_token_env_var".to_string(), - toml::Value::String(bearer_token_env_var.to_string()), - ); - } - if let Some(http_headers) = http_headers { - table.insert( - "http_headers".to_string(), - string_map_to_toml_value(http_headers), - ); - } - if let Some(env_http_headers) = env_http_headers { - table.insert( - "env_http_headers".to_string(), - string_map_to_toml_value(env_http_headers), - ); - } - - toml::Value::Table(table) - .try_into() - .expect("test streamable_http MCP config should deserialize") -} - fn string_map_to_toml_value(entries: HashMap) -> toml::Value { toml::Value::Table( entries @@ -1077,72 +1045,6 @@ unset it, then restart Codex" insta::assert_snapshot!(rendered); } -#[tokio::test] -async fn mcp_tools_output_masks_sensitive_values() { - let mut config = test_config().await; - let mut env = HashMap::new(); - env.insert("TOKEN".to_string(), "secret".to_string()); - let stdio_config = stdio_server_config("docs-server", vec![], Some(env), vec!["APP_TOKEN"]); - let mut servers = config.mcp_servers.get().clone(); - servers.insert("docs".to_string(), stdio_config); - - let mut headers = HashMap::new(); - headers.insert("Authorization".to_string(), "Bearer secret".to_string()); - let mut env_headers = HashMap::new(); - env_headers.insert("X-API-Key".to_string(), "API_KEY_ENV".to_string()); - let http_config = streamable_http_server_config( - "https://example.com/mcp", - Some("MCP_TOKEN"), - Some(headers), - Some(env_headers), - ); - servers.insert("http".to_string(), http_config); - config - .mcp_servers - .set(servers) - .expect("test mcp servers should accept any configuration"); - - let mut tools: HashMap = HashMap::new(); - tools.insert( - "mcp__docs__list".to_string(), - Tool { - description: None, - name: "list".to_string(), - title: None, - input_schema: serde_json::json!({"type": "object", "properties": {}}), - output_schema: None, - annotations: None, - icons: None, - meta: None, - }, - ); - tools.insert( - "mcp__http__ping".to_string(), - Tool { - description: None, - name: "ping".to_string(), - title: None, - input_schema: serde_json::json!({"type": "object", "properties": {}}), - output_schema: None, - annotations: None, - icons: None, - meta: None, - }, - ); - - let auth_statuses: HashMap = HashMap::new(); - let cell = new_mcp_tools_output( - &config, - tools, - HashMap::new(), - HashMap::new(), - &auth_statuses, - ); - let rendered = render_lines(&cell.display_lines(/*width*/ 120)).join("\n"); - - insta::assert_snapshot!(rendered); -} - #[tokio::test] async fn mcp_tools_output_lists_tools_for_hyphenated_server_names() { let mut config = test_config().await;