Repository navigation
fix(core): enforce MCP policy consistently at runtime - #29200
CoralGarden52 wants to merge 3 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the consistency and security of the MCP (Model Context Protocol) server management. By normalizing server name matching and ensuring that explicit empty allowlists are treated as restrictive rather than permissive, the runtime now correctly adheres to the policies defined in the CLI configuration. These changes resolve inconsistencies between configuration settings and runtime execution behavior. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
📊 PR Size: size/M
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
There was a problem hiding this comment.
Code Review
This pull request updates the configuration and client manager for Model Context Protocol (MCP) servers to properly handle and preserve an explicitly empty allowlist, and to normalize server names (by trimming and converting to lowercase) when evaluating allowlists and blocklists. Specifically, allowedMcpServers can now be undefined (meaning no allowlist is set), allowing an empty array [] to act as an explicit block-all list. Corresponding unit tests have been added to verify these behaviors. There are no review comments to address, so I have no additional feedback to provide.
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
|
This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
Summary
mcp.allowedlist as fail-closed instead of allowing every configured server.Details
McpClientManagerpreviously used exactincludes()checks and ignored empty policy arrays, so the runtime could disagree with the CLI policy path. This change normalizes server names at the runtime boundary and retainsundefinedfor an omitted allowlist while using[]when MCP is globally disabled.Related Issues
Fixes #29199
How to Validate
probeand verify thatallowed: [" PROBE "]starts it, whileexcluded: [" probe "]andallowed: []prevent it from starting.npm test --workspace @google/gemini-cli-core -- src/tools/mcp-client-manager.test.ts(41 passing).npm test --workspace @google/gemini-cli-core -- src/config/config.test.ts(237 passing).GEMINI_CLI_TRUST_WORKSPACE=true npm test --workspace @google/gemini-cli -- src/gemini.test.tsx(43 passing, 1 skipped).npm run typecheck --workspace @google/gemini-cli-core.I also ran
npm run preflight. Its formatting, build, lint, and typecheck stages passed. The core sandbox integration tests cannot run in this container because Bubblewrap is not permitted to mount/proc(Operation not permitted).Pre-Merge Checklist