Use consolidated MCP server lists in the ACP and policy-engine paths - #27605
Use consolidated MCP server lists in the ACP and policy-engine paths#27605adilburaksen wants to merge 1 commit into
Conversation
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 addresses a security vulnerability where workspace-specific settings could inadvertently bypass user or system-level MCP server blocks. By ensuring that both the ACP session manager and the policy engine utilize consolidated MCP server lists, the changes enforce consistent security policies across all execution paths. 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
|
There was a problem hiding this comment.
Code Review
This pull request updates the configuration loading mechanism in the CLI to ensure that consolidated MCP server lists (allowed and excluded) are correctly used across all settings scopes. Specifically, AcpSessionManager now passes loadedSettings to loadCliConfig, which in turn utilizes getConsolidatedAllowedMcpServers() and getConsolidatedExcludedMcpServers() to prevent workspace-scoped settings from overriding user-level configurations. No review comments were provided for this pull request.
|
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
#27377 fixed an MCP allow/block list bypass by adding
getConsolidatedExcludedMcpServers()/getConsolidatedAllowedMcpServers()(which unionmcp.excludedand intersectmcp.allowedacross all settings scopes, so a workspace-scoped setting cannot drop a user/system entry via the default REPLACE merge). Those were wired into the interactiveloadCliConfigpath andmcp list.Two call paths still read the raw, workspace-overridable
mcp.excluded/mcp.allowed:acpSessionManagercalledloadCliConfig(..., { cwd })withoutloadedSettings, soloadCliConfigfell back tosettings.mcp?.excluded/settings.mcp?.allowed(raw merged, REPLACE). A workspace.gemini/settings.jsonwithmcp.excluded: []therefore dropped a user-level block when running under ACP (e.g. in an editor), allowing an MCP server the user had blocked to connect.effectiveSettings.mcp(passed tocreatePolicyEngineConfig) used rawsettings.mcp?.allowedand inherited rawsettings.mcp?.excluded, so the generated DENY/ALLOW policy rules were also workspace-overridable.Change
acpSessionManagernow passesloadedSettings: currentSettingstoloadCliConfig, matching the interactive path, soblockedMcpServers/allowedMcpServersuse the consolidated lists.effectiveSettings.mcpnow usesgetConsolidatedAllowedMcpServers()/getConsolidatedExcludedMcpServers()whenloadedSettingsis available, so the policy engine's MCP rules use the consolidated lists too.This makes system- and user-scoped MCP blocks consistent across the interactive, ACP, and policy-engine paths.