mirror of
https://github.com/openai/codex.git
synced 2026-11-29 15:36:12 +00:00
Isolate MCP resource headers during OAuth requests (#39019)
## Why Headers configured for an MCP resource can contain credentials and must not be forwarded to a different origin during OAuth discovery, registration, or token exchange. ## What changed - Apply configured resource headers only to OAuth requests on the MCP resource origin, while allowing OAuth-generated headers to take precedence. - Follow credentialed OAuth redirects only when each destination remains on the resource origin. Preserve redirect method semantics, the overall timeout, the response size limit, and a maximum of 10 redirects. - Use the Codex MCP user agent for requests to authorization-server origins. ## Testing Add coverage for cross-origin header isolation, same-origin dynamic client registration redirects, OAuth header precedence, token refresh, timeout accounting, and response size limits. GitOrigin-RevId: 609d06e2b065e4aa9ca5382b4ae60455f9e26db9
This commit is contained in:
1 parent
32a383c0ba
commit
02360b48d1
10 files changed
+549
-61
No files matched your search
@@ -225,17 +225,19 @@ async fn discover_streamable_http_oauth_with_headers_and_http_client(
|
||||
OAuthDiscoveryTimeout::Requested => OAuthHttpClientAdapter::new_with_redirect_mode(
|
||||
http_client,
|
||||
default_headers,
|
||||
url,
|
||||
has_configured_headers,
|
||||
redirect_mode,
|
||||
),
|
||||
)?,
|
||||
OAuthDiscoveryTimeout::Capped(max_timeout) => {
|
||||
OAuthHttpClientAdapter::new_with_max_timeout_and_redirect_mode(
|
||||
http_client,
|
||||
default_headers,
|
||||
url,
|
||||
max_timeout,
|
||||
has_configured_headers,
|
||||
redirect_mode,
|
||||
)
|
||||
)?
|
||||
}
|
||||
};
|
||||
let mut authorization_manager =
|
||||
|
||||
Reference in new issue
Block a user