Skip to content

fix(lint): secure and OS-agnostic lint scripts and Windows formatting fixes#25368

Open
r-siddiq wants to merge 2 commits intogoogle-gemini:mainfrom
r-siddiq:dev_r-siddiq
Open

fix(lint): secure and OS-agnostic lint scripts and Windows formatting fixes#25368
r-siddiq wants to merge 2 commits intogoogle-gemini:mainfrom
r-siddiq:dev_r-siddiq

Conversation

@r-siddiq
Copy link
Copy Markdown

@r-siddiq r-siddiq commented Apr 14, 2026

Summary

This PR addresses the Windows environment linting failures by making the linter execution OS-agnostic, while simultaneously fixing a critical command injection vulnerability identified in PR #22177. It also includes minor workspace formatting fixes to improve the contributor experience on Windows.

Details

Here is the breakdown of each file change and why it was needed:

  • scripts/lint.js: Refactored runCommand and the individual linting functions (runShellcheck, runYamllint, runActionlint, runESLint, runPrettier). Replaced unsafe string concatenation and shell: true with spawnSync using an array of arguments and shell: false. This ensures filenames containing shell metacharacters are treated as literals, completely mitigating the command injection vulnerability. We conditionally allow shell: true only for npm.cmd and npx.cmd on Windows to enable path resolution.
  • .prettierignore: Added CONTRIBUTING.md to the ignore list. Prettier was adding newlines to the file, which caused annoying formatting issues and Git diff noise for Windows contributors.
  • .gitignore: Added packages/core/src/sandbox/windows/*.exe to ignore the Windows sandbox helper binaries generated during the npm run preflight build step. Without this, the generated binary showed up as an untracked file change in Git.

Related Issues

Fixes #22149
Fixes #25365

How to Validate

  1. Check out the branch on a Windows machine.
  2. Run npm run preflight.
  3. Verify that all linters (ESLint, Actionlint, Shellcheck, Yamllint, Prettier) execute successfully.
  4. Verify that no .exe binaries are shown as untracked in git status after the build.
  5. Review scripts/lint.js to confirm spawnSync is used safely with argument arrays.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
    • Windows
      • npm run
    • Linux

@r-siddiq r-siddiq requested a review from a team as a code owner April 14, 2026 09:46
@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 improves the reliability and security of the project's linting infrastructure. By transitioning from shell-based command execution to safer Node.js process spawning, the changes resolve critical security concerns while simultaneously enabling seamless operation for contributors working on Windows environments. Additionally, minor configuration adjustments were made to clean up the development experience.

Highlights

  • Security Hardening: Refactored linting scripts to use spawnSync with argument arrays instead of shell command strings, effectively mitigating command injection vulnerabilities.
  • Windows Compatibility: Implemented OS-agnostic logic for linting tools, ensuring reliable execution on Windows by handling path resolution and shell-specific command invocation.
  • Workspace Maintenance: Updated configuration files to ignore Windows-specific build artifacts and prevent unnecessary formatting noise in documentation.
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.

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

This pull request enhances the cross-platform compatibility of the project's linting scripts, with a focus on supporting Windows. It introduces a more robust runCommand function using spawnSync, adds a getGitFiles utility to avoid shell pipe issues, and refactors the execution logic for ESLint, Actionlint, Shellcheck, Yamllint, and Prettier to handle platform-specific differences. The .gitignore and .prettierignore files were also updated to include relevant exclusions. I have no feedback to provide.

@gemini-cli gemini-cli bot added the area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt

Projects

None yet

1 participant