Skip to content

fix(patch): cherry-pick 4f4431e to release/v0.33.0-preview.7-pr-21750 to patch version v0.33.0-preview.7 and create version 0.33.0-preview.8#21782

Merged
Adib234 merged 1 commit intorelease/v0.33.0-preview.7-pr-21750from
hotfix/v0.33.0-preview.7/0.33.0-preview.8/preview/cherry-pick-4f4431e/pr-21750
Mar 9, 2026
Merged

fix(patch): cherry-pick 4f4431e to release/v0.33.0-preview.7-pr-21750 to patch version v0.33.0-preview.7 and create version 0.33.0-preview.8#21782
Adib234 merged 1 commit intorelease/v0.33.0-preview.7-pr-21750from
hotfix/v0.33.0-preview.7/0.33.0-preview.8/preview/cherry-pick-4f4431e/pr-21750

Conversation

@gemini-cli-robot
Copy link
Collaborator

This PR automatically cherry-picks commit 4f4431e to patch version v0.33.0-preview.7 in the preview release to create version 0.33.0-preview.8.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 cherry-picks a critical fix to address a potential infinite recursion vulnerability in path resolution, specifically when dealing with complex or malicious symbolic link structures. The changes enhance the robustness of path handling within the core package by introducing recursion detection and refining error handling, ensuring system stability and preventing potential crashes in the preview release.

Highlights

  • Infinite Recursion Prevention: Implemented a mechanism within the robustRealpath function to detect and prevent infinite recursion when resolving symbolic links, particularly in malicious or circular symlink structures.
  • Improved Error Handling: Refined the error handling for lstatSync calls within robustRealpath to differentiate between expected ENOENT errors (which are handled gracefully) and other unexpected errors (which are now re-thrown).
  • New Test Case: Added a dedicated test case to paths.test.ts to specifically validate the infinite recursion prevention logic in resolveToRealPath.
Changelog
  • packages/core/src/utils/paths.test.ts
    • Added an afterEach hook to restore all mocks after each test in the resolveToRealPath describe block.
    • Introduced a new test case to verify that resolveToRealPath throws an error when infinite recursion is detected due to malicious symlink structures.
  • packages/core/src/utils/paths.ts
    • Modified the robustRealpath function to accept a visited set parameter, which tracks paths already processed to detect infinite recursion.
    • Added logic to robustRealpath to throw an error if a path is encountered that has already been visited, indicating infinite recursion.
    • Updated the recursive call to robustRealpath for symbolic links to pass the visited set.
    • Enhanced the error handling within robustRealpath's catch block for lstatSync to explicitly check for ENOENT errors and re-throw other types of errors.
    • Modified the recursive call to robustRealpath for parent directory resolution to pass the visited set.
Activity
  • No human activity has been recorded for this pull request yet.
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.

Copy link
Contributor

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

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 cherry-picks a fix to prevent infinite recursion when resolving file paths, particularly those involving symbolic links. The changes introduce a mechanism to track visited paths during the resolution process, effectively mitigating a potential denial-of-service vulnerability caused by circular symlinks. The error handling has also been improved to be more specific. The implementation is correct and includes relevant test cases to validate the fix. I have no further feedback.

@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Size Change: +415 B (0%)

Total Size: 25.9 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.4 MB +415 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 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-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Mar 9, 2026
@Adib234 Adib234 merged commit 302b48a into release/v0.33.0-preview.7-pr-21750 Mar 9, 2026
28 checks passed
@Adib234 Adib234 deleted the hotfix/v0.33.0-preview.7/0.33.0-preview.8/preview/cherry-pick-4f4431e/pr-21750 branch March 9, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants