security: gate workspace MCP config behind WorkspaceTrustStore (#213)#215
Open
HaoChiBao wants to merge 2 commits into
Open
security: gate workspace MCP config behind WorkspaceTrustStore (#213)#215HaoChiBao wants to merge 2 commits into
HaoChiBao wants to merge 2 commits into
Conversation
Untrusted repos must not define stdio MCP servers that spawn at session open. Skip <.coworker/mcp.json> until the workspace is trusted, matching allowed_commands consent. Fixes andrewyng#213
Extract _mcp_workspace_trusted for the three load sites, drop the unused spawn payload from the regression test, and remove a stray blank line.
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
<workspace>/.coworker/mcp.jsonunless the workspace is trusted via the existingWorkspaceTrustStore— the same consent boundary used for repositoryallowed_commands.~/.config/coworker/mcp.jsoncontinues to load regardless of trust.Fixes #213
Details
prepare_mcp_tools/connect_mcp/mcp_toolsnow passworkspace_trusted=intoload_mcp_servers. Workspace MCP is process provenance (stdiocommand/argsbecome a subprocess before any approval gate), so cloning a repo must not be enough to execute code.Test plan
pytest tests/test_mcp.py(9 passed)prepare_mcp_toolsnever callsMCPManager.ensurefor untrusted workspace servers; calls it after trust.coworker/mcp.jsonand confirm no spawn; trust the workspace and confirm it connects