Merge Commit pull of request into krsjenmt/gemini-cli from google-gemini/gemini-cli#37
Conversation
Co-authored-by: Jerop Kipruto <jerop@google.com>
…1` env variable populated. (#18832)
Summary of ChangesHello @krsjenmt, 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 updates the Gemini CLI to its latest stable and preview versions, bringing a suite of new features and stability improvements. The changes focus on enhancing user interaction through new commands and UI refinements, expanding integration capabilities with new IDE support, and strengthening the underlying security and agent functionalities. Significant effort has been made to improve the planning workflow and ensure a more reliable and efficient developer experience. Highlights
Changelog
Ignored Files
Activity
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 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 counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request appears to be a large merge from an upstream repository, introducing a wide range of features, refactorings, and documentation updates for version 0.28.0. My review has identified a critical security regression related to the handling of sensitive environment variables for MCP servers, where redaction has been effectively disabled. Additionally, I've noted a couple of high-severity issues concerning maintainability and backward compatibility that should be addressed.
| env: { | ||
| ...sanitizeEnvironment(process.env, sanitizationConfig), | ||
| ...(mcpServerConfig.env || {}), | ||
| [GEMINI_CLI_IDENTIFICATION_ENV_VAR]: | ||
| GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE, | ||
| } as Record<string, string>, |
There was a problem hiding this comment.
This refactoring introduces a critical security regression. The previous implementation explicitly enabled redaction for sensitive environment variables passed to MCP servers by setting enableEnvironmentVariableRedaction: true. The new implementation no longer does this, relying on a default configuration where redaction is disabled. This could lead to sensitive credentials, such as API keys, being leaked to MCP server processes, which is especially risky for third-party servers. The removal of related security warnings in documentation and tests is also highly concerning.
env: sanitizeEnvironment(
{
...process.env,
...(mcpServerConfig.env || {}),
[GEMINI_CLI_IDENTIFICATION_ENV_VAR]:
GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE,
},
{
...sanitizationConfig,
enableEnvironmentVariableRedaction: true,
},
) as Record<string, string>,| // Fallback: check process.argv for flags that imply headless or auto-approve mode. | ||
| return process.argv.some( | ||
| (arg) => | ||
| arg === '-p' || arg === '--prompt' || arg === '-y' || arg === '--yolo', | ||
| ); |
There was a problem hiding this comment.
The function isHeadlessMode now directly accesses the global process.argv as a fallback. This creates a hidden dependency on global state, making the function's behavior less predictable and harder to test in isolation. It's a best practice for utility functions to be pure and receive their dependencies as arguments.
| // Fallback: check process.argv for flags that imply headless or auto-approve mode. | |
| return process.argv.some( | |
| (arg) => | |
| arg === '-p' || arg === '--prompt' || arg === '-y' || arg === '--yolo', | |
| ); | |
| // Fallback: check process.argv for flags that imply headless or auto-approve mode. | |
| return (options?.argv ?? process.argv).some( | |
| (arg) => | |
| arg === '-p' || arg === '--prompt' || arg === '-y' || arg === '--yolo', | |
| ); |
| for (const definition of definitions) { | ||
| const isAllowed = | ||
| !allowedTools || allowedTools.includes(definition.name); | ||
|
|
||
| if (isAllowed) { | ||
| try { | ||
| const tool = new SubagentTool( | ||
| definition, | ||
| this, | ||
| this.getMessageBus(), | ||
| ); | ||
| registry.registerTool(tool); | ||
| } catch (e: unknown) { | ||
| debugLogger.warn( | ||
| `Failed to register tool for agent ${definition.name}: ${getErrorMessage(e)}`, | ||
| ); | ||
| } | ||
| try { | ||
| const tool = new SubagentTool(definition, this, this.getMessageBus()); | ||
| registry.registerTool(tool); | ||
| } catch (e: unknown) { | ||
| debugLogger.warn( | ||
| `Failed to register tool for agent ${definition.name}: ${getErrorMessage(e)}`, | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
The check against allowedTools has been removed when registering sub-agent tools. While allowedTools is deprecated, this change means that sub-agents will now bypass this security control, even if a user has it configured. During the transition period to the new Policy Engine, this could lead to unexpected behavior where a user's explicit tool allow-list is not respected for sub-agents, potentially allowing unintended tools to be registered.
Summary
Details
Related Issues
How to Validate
Pre-Merge Checklist