fix(patch): cherry-pick 14b2f35 to release/v0.38.1-pr-24974 to patch version v0.38.1 and create version 0.38.2#25585
Conversation
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 introduces improvements to the tool confirmation UI by ensuring that tool descriptions, specifically those containing file information, are properly displayed. These changes enhance the clarity of the user interface during edit operations and include updated tests and snapshots to maintain consistency. Highlights
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. Footnotes
|
|
Size Change: -26 B (0%) Total Size: 34 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request enables the display of tool descriptions for edit operations within the ToolConfirmationQueue component, which were previously suppressed. It includes updated UI snapshots and new test cases to ensure that filenames and descriptions are correctly rendered in the terminal. A security concern was identified regarding the direct rendering of LLM-generated tool descriptions, which could lead to terminal injection; a suggestion was provided to sanitize this input using existing utility functions.
| {!!tool.description && ' '} | ||
| </Text> | ||
| {!isEdit && !!tool.description && ( | ||
| {!!tool.description && ( |
There was a problem hiding this comment.
The tool.description field, which originates from LLM-generated tool calls, is rendered directly to the terminal without proper sanitization. This introduces a terminal injection vulnerability. An attacker could craft a malicious tool.description containing ANSI escape sequences to manipulate the terminal output, potentially leading to UI spoofing (e.g., obscuring the actual command or diff being confirmed), clipboard manipulation (via OSC 52), or even opening malicious URLs (via OSC 8).
Given that this component is responsible for confirming sensitive actions (like file edits or shell command execution), UI spoofing poses a significant risk, as it could trick users into approving unintended or harmful operations. The changes in this pull request specifically extend this behavior to 'edit' tools, thereby expanding the attack surface.
Remediation: Sanitize the tool.description string before rendering it. It is recommended to use existing utility functions like stripUnsafeCharacters or sanitizeForDisplay (which are already utilized for other sensitive fields within ToolConfirmationMessage.tsx) to effectively remove or escape terminal control characters and ANSI escape sequences.
| {!!tool.description && ' '} | |
| </Text> | |
| {!isEdit && !!tool.description && ( | |
| {!!tool.description && ( | |
| {!!tool.description && ' '} | |
| </Text> | |
| {!!tool.description && ( | |
| <Box flexShrink={1} overflow="hidden"> | |
| <Text color={theme.text.primary} wrap="truncate-end"> | |
| {sanitizeForDisplay(tool.description)} | |
| </Text> |
References
- Always treat user-provided data as untrusted and apply proper validation and sanitization at the point of use, even if it is believed to have been filtered or sanitized upstream. This follows the principle of defense-in-depth.

This PR automatically cherry-picks commit 14b2f35 to patch version v0.38.1 in the stable release to create version 0.38.2.