Conversation
Gemini CLI tends to use double quotes in bash commands which play bad with markdown which is often backtick-intensive. ```bash $ git commit -m "My very very long message containin `backticks` along the way" ``` So adding a suggestion to use single quotes should help
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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 refines the internal guidance for Git operations by introducing a specific instruction within the core prompts. The change aims to enhance the reliability of Highlights
Changelog
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
|
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request attempts to improve git commit message handling by instructing the LLM to use single quotes, aiming to prevent shell expansion issues. However, this approach is insufficient and introduces new problems: the underlying ShellTool remains vulnerable to command injection due to inadequate validation of backticks, background operators (&), and other shell substitutions in its isCommandAllowed function. Additionally, using single quotes for commit messages can cause shell errors if the message itself contains single quotes. A more robust solution requires fixing the ShellTool's validation logic and using git commit -F <file> to avoid shell quoting issues.
| - After each commit, confirm that it was successful by running \`git status\`. | ||
| - If a commit fails, never attempt to work around the issues without being asked to do so. | ||
| - Never push changes to a remote repository without being asked explicitly by the user. | ||
| - When issuing \`git commit -m 'My Message'\` use single quotes rather than double quotes, as double quotes interact poorly with backticks. |
There was a problem hiding this comment.
The prompt instruction to use single quotes for git commit -m is an insufficient security measure against command injection, as it relies on LLM adherence for safety. The underlying ShellTool in packages/core/src/tools/shell.ts is highly vulnerable because its isCommandAllowed function fails to validate backticks, other shell substitutions like <( ), or the & operator and newlines, allowing command chaining. Additionally, this single-quote recommendation introduces a new problem where commit messages containing single quotes will cause shell errors. A more robust solution involves fixing the ShellTool's validation logic and instructing the agent to use git commit -F <file> with a temporary file to avoid all shell quoting issues.
References
- To prevent prompt injection, avoid including user-provided input in content passed to the LLM (
llmContent). If the input is needed for display purposes, usereturnDisplayinstead. This comment highlights a command injection risk where user-provided input (e.g., commit message) could be embedded into an LLM-generated shell command, leading to vulnerabilities if not properly handled.
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
Summary
Details
Related Issues
How to Validate
Pre-Merge Checklist