fix: prevent credential_process hang on Windows in stdio transport mode#293
Open
rshevchuk-git wants to merge 1 commit into
Open
fix: prevent credential_process hang on Windows in stdio transport mode#293rshevchuk-git wants to merge 1 commit into
rshevchuk-git wants to merge 1 commit into
Conversation
Monkey-patch botocore's ProcessProvider to pass stdin=subprocess.DEVNULL when spawning credential_process subprocesses. Without this, the child inherits the MCP JSON-RPC pipe as stdin, causing Popen.communicate() to hang indefinitely on Windows (IOCP) due to the open pipe handle. Fixes D454977820
| import httpx | ||
| import json | ||
| import logging | ||
| import subprocess |
Collaborator
Author
There was a problem hiding this comment.
False positive. We dont pass user-controlled input to subprocess, and we use compat_shell_split() (no shell=True). Literally replicating what botocore itself already does, just adding stdin=subprocess.DEVNULL
anasstahr
approved these changes
May 27, 2026
arnewouters
reviewed
May 27, 2026
|
|
||
| def _retrieve_credentials_using(self, credential_process): | ||
| process_list = compat_shell_split(credential_process) | ||
| p = self._popen( |
Contributor
There was a problem hiding this comment.
Would the patch be simpler if we just override self._popen with a patched popen that has stdin=subprocess.DEVNULL by default?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ProcessProvider._retrieve_credentials_usingto passstdin=subprocess.DEVNULLwhen spawningcredential_processsubprocessesPopen.communicate()to hang indefinitely on Windows (IOCP)Problem
When
mcp-proxy-for-awsruns in stdio transport mode, its stdin is the MCP JSON-RPC pipe. Botocore'sProcessProviderspawnscredential_processsubprocesses without specifyingstdin, so the child inherits the pipe. On Windows this causes the subprocess to hang indefinitely because it holds an open handle to the pipe, blockingPopen.communicate()from completing.This affects any user with
credential_processin their AWS profile (e.g.,isengardcli credentials) when using the MCP proxy on Windows through IDE integrations (Kiro, Cline, Claude Code).Fixes D454977820
Test plan