Handle dirty worktrees better and warn about running scripts/review.sh on untrusted code.#21791
Handle dirty worktrees better and warn about running scripts/review.sh on untrusted code.#21791
Conversation
…h on untrusted code.
|
Hi @jacob314, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
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 enhances the robustness and security of the code review process. It improves the Highlights
Changelog
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
|
|
Hi there! Thank you for your contribution to Gemini CLI. To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md. This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding How to link an issue: Thank you for your understanding and for being a part of our community! |
|
Size Change: -4 B (0%) Total Size: 26.1 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
The pull request updates CONTRIBUTING.md with a warning about running scripts/review.sh on untrusted code and enhances scripts/review.sh by ensuring a clean worktree and checking out PRs into a dedicated branch. However, a critical security vulnerability remains as the review.sh script still proceeds to install and run code from external pull requests without an interactive warning, which could lead to Remote Code Execution (RCE) if the PR contains malicious code.
| # 4. Checkout the PR | ||
| echo "review: Checking out PR $pr..." | ||
| gh pr checkout "$pr" -f -R "$REPO" | ||
| echo "review: Cleaning worktree and checking out PR $pr..." |
There was a problem hiding this comment.
The pull request title claims to "warn about running scripts/review.sh on untrusted code," but the implementation fails to add any such warning. The script proceeds to execute npm install (line 86) and npm start (line 131) on code checked out from an external Pull Request. This allows for Remote Code Execution (RCE) if the PR contains malicious code (e.g., in package.json scripts). The absence of the promised warning significantly increases the risk of a developer compromising their machine.
| echo "review: Cleaning worktree and checking out PR $pr..." | |
| echo "WARNING: This script will install and run code from PR $pr. Only run this on trusted code." | |
| read -p "Do you want to continue? (y/N) " confirm | |
| if [[ $confirm != [yY] ]]; then exit 1; fi | |
| echo "review: Cleaning worktree and checking out PR $pr..." |
…h on untrusted code. (google-gemini#21791)
…h on untrusted code. (google-gemini#21791)
…h on untrusted code. (google-gemini#21791)
…h on untrusted code. (#21791)
…h on untrusted code. (google-gemini#21791)
Summary
Fix issue where review.sh could fail if there were local changes on the branchfor the review
Add warning about how to safely run review.sh.
Fixes #21793