Skip to content

fix(security): reset modified build files upon confirmation and deduplicate filenames (#29687) - #29719

Closed
Sandeep332005 wants to merge 1 commit into
google-gemini:mainfrom
Sandeep332005:fix/dedup-modified-build-files-29687
Closed

Sandeep332005 wants to merge 1 commit into
google-gemini:mainfrom
Sandeep332005:fix/dedup-modified-build-files-29687

Conversation

@Sandeep332005

@Sandeep332005 Sandeep332005 commented Oct 12, 2026 •

Copy link
Copy Markdown

Summary

Fixes two issues with the sessionModifiedBuildFiles security mechanism:
1. Clears tracked modified build files once the user approves execution of the build command so the caution
warning does not prompt repeatedly on every subsequent build command.
2. Deduplicates identical build file basenames in the CLI warning message (e.g. converting (package.json, package.json) to (package.json)).

Details

- **Core Lifecycle (`packages/core/src/tools/shell.ts`):** 
  When a build configuration file was modified during a session, `hasModifiedBuildFiles` remained `true`

indefinitely. Even after approving with "Allow once", every subsequent build command triggered the caution warning
again and blocked "Allow for this session". We now invoke resetModifiedBuildFiles(this.context.config) inside
onConfirm when the user approves execution (ProceedOnce, ProceedAlways, or ProceedAlwaysAndSave).
- UI Deduplication (packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx):
Mapped basenames are now deduplicated with Array.from(new Set(...)) so repeated edits to the same file or
subpackage files sharing basenames do not produce repetitive lists.
- Tests Added:
- packages/core/src/tools/shell.test.ts: Added test verifying modifiedBuildFiles is cleared after user
confirmation.
- packages/cli/src/ui/components/messages/ToolConfirmationMessage.test.tsx: Added test verifying duplicate
build file basenames are deduplicated in the warning banner.

Related Issues

Closes #29687

How to Validate

1. Run core unit tests:
   ```bash
   npm --prefix packages/core test -- shell.test.ts
  1. Run CLI unit tests:
    npm --prefix packages/cli test -- ToolConfirmationMessage.test.tsx

  2. Typecheck validation:
    npm --prefix packages/core run typecheck
    npm --prefix packages/cli run typecheck

Pre-Merge Checklist

[✓] Added/updated tests (if needed)
[✓] Validated on required platforms/methods:
[✓] MacOS
[✓] npm run

@Sandeep332005
Sandeep332005 requested review from a team as code owners October 12, 2026 13:28
@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 addresses usability and security UX issues related to the build configuration modification tracking mechanism. By ensuring that tracked files are cleared after a user explicitly approves a build command, the system avoids repetitive caution prompts. Additionally, the CLI interface has been updated to present a cleaner list of modified files by deduplicating basenames, which prevents clutter when multiple files in different directories share the same name.

Highlights

  • Build File Tracking: Implemented automatic clearing of tracked modified build files upon user confirmation to prevent redundant security warnings.
  • UI Improvements: Added deduplication logic for build file basenames in the CLI confirmation message to improve readability when multiple files share the same name.
  • Testing: Added unit tests in both core and CLI packages to verify the reset functionality and the deduplication of file names.
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 the 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 counterproductive. 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. ↩

@github-actions github-actions Bot added the size/m A medium sized PR label Oct 12, 2026
@github-actions

Copy link
Copy Markdown

📊 PR Size: size/M

  • Lines changed: 83
  • Additions: +81
  • Deletions: -2
  • Files changed: 4

@github-actions

Copy link
Copy Markdown

🛑 Action Required: Evaluation Approval

Steering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged.

Maintainers:

  1. Go to the Workflow Run Summary.
  2. Click the yellow 'Review deployments' button.
  3. Select the 'eval-gate' environment and click 'Approve'.

Once approved, the evaluation results will be posted here automatically.

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

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.

Code Review

This pull request deduplicates identical build file basenames in the CLI's caution warning message and ensures that tracked modified build files are reset once a user confirms the execution of a build command. Corresponding unit tests have been added to verify both behaviors. There are no review comments, so I have no feedback to provide.

@Sandeep332005 Sandeep332005 changed the title fix(security): reset modified build files upon confirmation and deduplicate filenames (#29687)fix(security): reset modified build files upon confirmation and dedup… fix(security): reset modified build files upon confirmation and deduplicate filenames (#29687) Oct 12, 2026
@gemini-cli

gemini-cli Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

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 only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'.

This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding.

@gemini-cli

gemini-cli Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

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.

This branch had an error being deployed

1 failed deployment
eval-gate — c6f54a6f Deployed Oct 12, 2026 by Sandeep332005 via Evaluate Steering & Regressions #2161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant