gemini-cli - ✅(Solved) Fix [Security] IDE RCE via malicious .env files in untrusted workspaces [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25021Fetched 2026-04-10 03:45:19
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #25022: Fix: Disallow overriding IDE stdio via workspace .env (RCE)

Description (problem / solution / changelog)

This pull request addresses the vulnerability where an untrusted workspace's .env file can hijack the IDE companion connection variables and lead to local command execution when IDE mode is enabled. We exclude these variables by default in the .env parser.

Closes #25021 Closes #24799

Changed files

  • packages/cli/src/config/settings.ts (modified, +1/-1)
RAW_BUFFERClick to expand / collapse

The local .env loading process evaluates GEMINI_CLI_IDE_SERVER_STDIO_COMMAND and GEMINI_CLI_IDE_SERVER_STDIO_ARGS parameters from an untrusted workspace. If IDE mode is enabled globally, an attacker can create a malicious repository with a .env that executes arbitrary shell code upon simply opening or interacting with the repository. It is requested to filter these stdio configuration vars from the workspace env by default.

extent analysis

TL;DR

Filtering GEMINI_CLI_IDE_SERVER_STDIO_COMMAND and GEMINI_CLI_IDE_SERVER_STDIO_ARGS from the workspace environment by default is likely to prevent arbitrary shell code execution.

Guidance

  • Identify the source of the .env loading process and modify it to exclude GEMINI_CLI_IDE_SERVER_STDIO_COMMAND and GEMINI_CLI_IDE_SERVER_STDIO_ARGS from the workspace environment.
  • Verify that the IDE mode is not enabled globally or restrict access to trusted repositories to mitigate the vulnerability.
  • Consider implementing input validation and sanitization for .env files to prevent malicious repository creation.
  • Review the current security measures in place for handling untrusted workspaces and consider enhancing them to prevent similar vulnerabilities.

Notes

The provided information does not specify the exact implementation details of the .env loading process, so the guidance is focused on the general approach to addressing the vulnerability.

Recommendation

Apply workaround: Filter the specified stdio configuration variables from the workspace environment by default to prevent potential arbitrary shell code execution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING