Restrict MCP user verification and add workspace-scoped identity (#43524)

## Why

Configured MCP servers must not be able to request user verification, even when they reuse the hosted apps server name. Local verification identity selection also needs to distinguish a user's workspace memberships.

## What changed

- Advertise `userVerification` only to the host-owned apps MCP server and cancel verification requests from other servers before prompting the client.
- Add `CodexAuth::get_chatgpt_account_user_id()` to read the access token's opaque `chatgpt_account_user_id` only when its workspace matches the selected account. Missing or malformed claims return no identity, without falling back to another user ID or breaking ordinary authentication.

## Testing

Add coverage for capability filtering, rejection of configured servers including those using the hosted apps name, and account-user identity selection with malformed or mismatched claims. Add an MCP round-trip test showing that verification waits for a client response even in full access mode, returns the supplied proof, and discards response metadata.

GitOrigin-RevId: 156e83d5a0302c013b85e564b46b4bfe858cbdb0
This commit is contained in:
riley-oai authored and copyberry committed 2026-09-07 17:26:10 +00:00
1 parent adee0b04fa
commit f326857cf4
11 files changed
+587 -68

No files matched your search

@@ -288,6 +288,11 @@ impl McpConnectionSet {
.filter(|(_, server)| server.enabled())
{
let registration = config.mcp_server_catalog.server(&server_name);
let client_mcp_extensions = crate::client_capabilities::server_mcp_extensions(
&client_mcp_extensions,
&server_name,
registration,
);
let is_host_owned_codex_apps = registration.is_some_and(|server| {
server
.source()