mirror of
https://github.com/openai/codex.git
synced 2026-11-28 23:34:06 +00:00
Resolve HTTP MCP bearer tokens in executor environments (#39926)
## Why Executor-owned HTTP MCP servers need to read their bearer credentials from the selected executor environment instead of the host process. ## What changed - Preserve `bearer_token_env_var` for executor-owned HTTP MCP configurations and resolve it when the executor sends each request. - Extend delegated HTTP headers with executor-local environment references while rejecting missing, empty, or protected credential variables. - Keep transport-provided bearer authentication compatible with MCP redirect and OAuth handling without sending a placeholder authorization value. ## Testing - Cover authenticated executor-owned MCP requests end to end. - Cover delegated header resolution and rejection of protected variables. - Cover parsing executor-owned bearer configuration and transport-provided bearer behavior. GitOrigin-RevId: 442bf7382198ffb69eba797eb36d4c74faabda88
This commit is contained in:
1 parent
ff0e95007c
commit
93c54bca38
21 files changed
+361
-57
No files matched your search
@@ -786,7 +786,7 @@ fn environment_placement_rejects_orchestrator_env_vars() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remote_environment_placement_rejects_http_env_references() {
|
||||
fn remote_environment_placement_preserves_bearer_and_rejects_header_env_references() {
|
||||
let plugin_root = plugin_root();
|
||||
let outcome = parse_executor_plugin_mcp_config(
|
||||
&plugin_root_uri(&plugin_root),
|
||||
@@ -807,19 +807,20 @@ fn remote_environment_placement_rejects_http_env_references() {
|
||||
assert_eq!(
|
||||
outcome,
|
||||
PluginMcpConfigParseOutcome {
|
||||
servers: BTreeMap::new(),
|
||||
errors: vec![
|
||||
PluginMcpServerParseError {
|
||||
name: "bearer".to_string(),
|
||||
message: "`bearer_token_env_var` requires executor-side environment resolution for an executor-owned HTTP MCP"
|
||||
.to_string(),
|
||||
},
|
||||
PluginMcpServerParseError {
|
||||
name: "headers".to_string(),
|
||||
message: "`env_http_headers` requires executor-side environment resolution for an executor-owned HTTP MCP"
|
||||
.to_string(),
|
||||
},
|
||||
],
|
||||
servers: BTreeMap::from([(
|
||||
"bearer".to_string(),
|
||||
serde_json::from_value(serde_json::json!({
|
||||
"url": "https://example.com/bearer",
|
||||
"bearer_token_env_var": "TOKEN",
|
||||
"environment_id": "executor-1",
|
||||
}))
|
||||
.expect("executor-owned bearer configuration"),
|
||||
)]),
|
||||
errors: vec![PluginMcpServerParseError {
|
||||
name: "headers".to_string(),
|
||||
message: "`env_http_headers` requires executor-side environment resolution for an executor-owned HTTP MCP"
|
||||
.to_string(),
|
||||
}],
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user