Skip to content

fix(patch): cherry-pick 4d4e16c to release/v0.27.0-preview.0-pr-17785 to patch version v0.27.0-preview.0 and create version 0.27.0-preview.1#17823

Merged
SandyTao520 merged 1 commit into
release/v0.27.0-preview.0-pr-17785from
hotfix/v0.27.0-preview.0/0.27.0-preview.1/preview/cherry-pick-4d4e16c/pr-17785
Jan 28, 2026
Merged

fix(patch): cherry-pick 4d4e16c to release/v0.27.0-preview.0-pr-17785 to patch version v0.27.0-preview.0 and create version 0.27.0-preview.1#17823
SandyTao520 merged 1 commit into
release/v0.27.0-preview.0-pr-17785from
hotfix/v0.27.0-preview.0/0.27.0-preview.1/preview/cherry-pick-4d4e16c/pr-17785

Conversation

@gemini-cli-robot

Copy link
Copy Markdown
Collaborator

This PR automatically cherry-picks commit 4d4e16c to patch version v0.27.0-preview.0 in the preview release to create version 0.27.0-preview.1.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @gemini-cli-robot, 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 is an automated cherry-pick operation to patch a specific release. The core change involves making the workspaceDir parameter mandatory for the updateSetting function, which is crucial for managing extension settings. This ensures that the current working directory is always explicitly provided, addressing potential issues related to how extension settings are handled across different working directories, particularly within test environments.

Highlights

  • Required Workspace Directory for Settings: The updateSetting function now explicitly requires a workspaceDir argument, ensuring the current working directory is always provided when updating extension settings.
  • Test Environment Isolation: Test files (configure.test.ts, extension-manager-hydration.test.ts) have been updated to consistently pass process.cwd() or a temporary workspace directory to updateSetting calls, aligning with the new requirement and improving test reliability.
  • Temporary Workspace for Tests: A temporary workspace directory is now created using fs.mkdtempSync and used in configure.test.ts to isolate tests and mock process.cwd(), preventing side effects between test runs.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@SandyTao520 SandyTao520 enabled auto-merge (squash) January 28, 2026 22:24
@github-actions

Copy link
Copy Markdown

Size Change: +38 B (0%)

Total Size: 23.5 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23.5 MB +38 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the updateSetting function to require a workspaceDir, improving the robustness of extension setting configuration. However, this change introduces a critical vulnerability: malicious extensions can inject arbitrary environment variables into the workspace's .env file, which are then loaded into the CLI's process environment, potentially leading to Remote Code Execution. Additionally, a minor issue was identified in extension-manager-hydration.test.ts regarding the use of process.cwd() instead of a test-specific temporary directory, which could make the test brittle.

requestSetting: (setting: ExtensionSetting) => Promise<string>,
scope: ExtensionSettingScope,
workspaceDir?: string,
workspaceDir: string,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

The updateSetting function is vulnerable to environment variable injection. It does not properly escape newline characters in values or validate environment variable names (envVar) defined by extensions. By making workspaceDir mandatory and enabling the workspace scope, this PR exposes the ability for a malicious extension to inject arbitrary environment variables (e.g., NODE_OPTIONS, GEMINI_CLI_SYSTEM_SETTINGS_PATH) into the workspace's .env file. These variables are automatically loaded into the process environment via loadEnvironment, which can lead to Remote Code Execution (RCE). To remediate this, ensure that envVar names are validated against a whitelist and that values are properly escaped to prevent newline injection.

'MY_VALUE',
mockRequestSetting,
ExtensionSettingScope.USER,
process.cwd(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

For test isolation and correctness, it's better to use the tempDir created for this test suite instead of process.cwd(). The rest of the test setup uses tempDir as the workspace directory. Using process.cwd() could lead to unexpected behavior or test failures if the scope were changed to WORKSPACE, as it would reference a different directory than the one prepared for the test.

Suggested change
process.cwd(),
tempDir,

@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Jan 28, 2026
@SandyTao520 SandyTao520 merged commit 9954615 into release/v0.27.0-preview.0-pr-17785 Jan 28, 2026
26 checks passed
@SandyTao520 SandyTao520 deleted the hotfix/v0.27.0-preview.0/0.27.0-preview.1/preview/cherry-pick-4d4e16c/pr-17785 branch January 28, 2026 22:34
@sripasg sripasg added the size/s A small PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s A small PR status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants