Skip to content

fix(patch): cherry-pick 4e5dfd0 to release/v0.35.0-preview.1-pr-23074 to patch version v0.35.0-preview.1 and create version 0.35.0-preview.2#23134

Merged
SandyTao520 merged 1 commit intorelease/v0.35.0-preview.1-pr-23074from
hotfix/v0.35.0-preview.1/0.35.0-preview.2/preview/cherry-pick-4e5dfd0/pr-23074
Mar 19, 2026
Merged

fix(patch): cherry-pick 4e5dfd0 to release/v0.35.0-preview.1-pr-23074 to patch version v0.35.0-preview.1 and create version 0.35.0-preview.2#23134
SandyTao520 merged 1 commit intorelease/v0.35.0-preview.1-pr-23074from
hotfix/v0.35.0-preview.1/0.35.0-preview.2/preview/cherry-pick-4e5dfd0/pr-23074

Conversation

@gemini-cli-robot
Copy link
Copy Markdown
Collaborator

This PR automatically cherry-picks commit 4e5dfd0 to patch version v0.35.0-preview.1 in the preview release to create version 0.35.0-preview.2.

@gemini-code-assist
Copy link
Copy Markdown
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 refines the memory discovery mechanism within the core package to improve how relevant memory files are identified. It extends the upward traversal logic to correctly reach the Git repository root, accommodating various project structures including Git submodules and worktrees where the .git indicator might be a file. This enhancement ensures more accurate context loading by broadening the scope of memory file discovery.

Highlights

  • Enhanced Git Root Detection: The system now correctly identifies Git repository roots, including cases where .git is a file (as seen in submodules or worktrees) rather than strictly a directory.
  • Improved Memory File Traversal: Upward traversal for discovering memory files (GEMINI.md) now extends to the detected Git root of a project. Previously, this traversal was limited to the initial trusted root.
  • Trusted Root Fallback: If no Git root is found during memory discovery, the traversal ceiling gracefully falls back to the trusted root, ensuring that relevant memory files within the trusted scope are still included.
  • Updated Test Coverage: The test suite has been expanded and modified to validate the new traversal logic, covering scenarios with .git files and the absence of a .git repository, ensuring robustness.
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.

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) March 19, 2026 18:13
Copy link
Copy Markdown
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

The pull request modifies the memory discovery logic to traverse upward from a trusted root to the git repository root (if one exists) when searching for GEMINI.md files, instead of stopping at the trusted root. This change allows for better context discovery in git repositories, including those using submodules or worktrees where .git is a file. However, a security vulnerability was introduced in loadJitSubdirectoryMemory where this upward traversal to an untrusted git root from a trusted root could lead to prompt injection by loading malicious GEMINI.md files if an attacker controls a parent directory that is a git root.

Comment on lines +771 to +772
const gitRoot = await findProjectRoot(bestRoot);
const resolvedCeiling = gitRoot ? normalizePath(gitRoot) : bestRoot;
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

Similar to the issue in getEnvironmentMemoryPaths, the introduction of gitRoot and resolvedCeiling in loadJitSubdirectoryMemory for JIT memory loading, while aiming for consistent behavior, creates a security vulnerability. This allows the function to traverse upward to an untrusted git root from a trusted root, potentially loading malicious GEMINI.md files and enabling prompt injection if an attacker controls a parent directory that is a git root.

  // Find the git root to use as the traversal ceiling.
  // If no git root exists, fall back to the trusted root as the ceiling.
  const gitRoot = await findProjectRoot(bestRoot);
  const resolvedCeiling = gitRoot ? normalizePath(gitRoot) : bestRoot;

@github-actions
Copy link
Copy Markdown

Size Change: +340 B (0%)

Total Size: 26.2 MB

Filename Size Change
./bundle/chunk-FIQWQZVG.js 0 B -1.95 MB (removed) 🏆
./bundle/chunk-QN2ROOCH.js 0 B -13.5 MB (removed) 🏆
./bundle/chunk-QUOXP2BF.js 0 B -3.62 MB (removed) 🏆
./bundle/core-5SCNI676.js 0 B -41.1 kB (removed) 🏆
./bundle/devtoolsService-PA3A4JPS.js 0 B -27.7 kB (removed) 🏆
./bundle/interactiveCli-HDD742EO.js 0 B -1.6 MB (removed) 🏆
./bundle/oauth2-provider-HVD2PKCV.js 0 B -9.19 kB (removed) 🏆
./bundle/chunk-7ZPTBZCW.js 13.5 MB +13.5 MB (new file) 🆕
./bundle/chunk-A2NHY3IE.js 3.62 MB +3.62 MB (new file) 🆕
./bundle/chunk-QO53VEHI.js 1.95 MB +1.95 MB (new file) 🆕
./bundle/core-XDDEZP36.js 41.1 kB +41.1 kB (new file) 🆕
./bundle/devtoolsService-XDWUTMOM.js 27.7 kB +27.7 kB (new file) 🆕
./bundle/interactiveCli-H5JZV6S5.js 1.6 MB +1.6 MB (new file) 🆕
./bundle/oauth2-provider-7J4YMKNE.js 9.19 kB +9.19 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./bundle/chunk-34MYV7JD.js 2.45 kB 0 B
./bundle/chunk-37ZTTFQF.js 966 kB 0 B
./bundle/chunk-5AUYMPVF.js 858 B 0 B
./bundle/chunk-664ZODQF.js 124 kB 0 B
./bundle/chunk-DAHVX5MI.js 206 kB 0 B
./bundle/chunk-IUUIT4SU.js 56.5 kB 0 B
./bundle/chunk-RJTRUG2J.js 39.8 kB 0 B
./bundle/devtools-36NN55EP.js 696 kB 0 B
./bundle/dist-T73EYRDX.js 356 B 0 B
./bundle/gemini.js 695 kB 0 B
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB 0 B
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB 0 B
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB 0 B
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB 0 B
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB 0 B
./bundle/memoryDiscovery-P6SEGMWA.js 0 B -922 B (removed) 🏆
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB 0 B
./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
./bundle/src-QVCVGIUX.js 47 kB 0 B
./bundle/tree-sitter-7U6MW5PS.js 274 kB 0 B
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB 0 B
./bundle/undici-4X2YZID5.js 360 B 0 B
./bundle/memoryDiscovery-RRX6QF4Y.js 922 B +922 B (new file) 🆕

compressed-size-action

@SandyTao520 SandyTao520 merged commit dd95008 into release/v0.35.0-preview.1-pr-23074 Mar 19, 2026
28 checks passed
@SandyTao520 SandyTao520 deleted the hotfix/v0.35.0-preview.1/0.35.0-preview.2/preview/cherry-pick-4e5dfd0/pr-23074 branch March 19, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants