Restrict hosted MCP credentials to local environments (#36306)

## Why

Executor-owned MCP servers must not receive hosted ChatGPT actor credentials or credentials from the host's OAuth store.

## What changed

- Provide the ChatGPT auth provider and consult stored OAuth credentials only for MCP servers in the local environment.
- Require non-local servers configured with `auth = "chatgpt"` to supply a non-empty, valid static `Authorization` header. Reject environment-backed authorization so host secrets are not resolved for an executor-owned server.
- Report unsupported authentication and fail startup before connecting when an executor-owned server has no acceptable explicit authorization.

## Testing

Add coverage for local credential forwarding, non-local credential isolation, static header validation, auth status, OAuth lookup avoidance, and startup rejection.

GitOrigin-RevId: e18f1878f260c93d9babd390a5a7eac86172299b
This commit is contained in:
jif authored and copyberry committed 2026-07-31 10:42:02 +00:00
1 parent f0c30e528a
commit bf4d3f51ea
5 files changed
+310 -2

No files matched your search

@@ -23,7 +23,9 @@ pub(super) fn chatgpt_auth_provider_for_server(
server: &EffectiveMcpServer,
chatgpt_auth_provider: Option<SharedAuthProvider>,
) -> Option<SharedAuthProvider> {
if !matches!(&server.config().auth, McpServerAuth::ChatGpt) {
if !matches!(&server.config().auth, McpServerAuth::ChatGpt)
|| !server.config().is_local_environment()
{
return None;
}
chatgpt_auth_provider