mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
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
This commit is contained in:
-26
@@ -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)
|
||||
@@ -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<HashMap<String, String>>,
|
||||
env_http_headers: Option<HashMap<String, String>>,
|
||||
) -> 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<String, String>) -> 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<String, Tool> = 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<String, McpAuthStatus> = 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;
|
||||
|
||||
Reference in New Issue
Block a user