← All advisories

CVE-2026-12537criticalCode execution2026-04-24

CVE-2026-12537: Gemini CLI: Remote Code Execution via workspace trust and tool allowlisting bypasses

Gemini CLI (@google/gemini-cli) and the run-gemini-cli GitHub Action are being updated to harden workspace trust and tool allowlisting, in particular when used in untrusted environments like GitHub Actions.

01.

What it is

Gemini CLI (@google/gemini-cli) and the run-gemini-cli GitHub Action are being updated to harden workspace trust and tool allowlisting, in particular when used in untrusted environments like GitHub Actions. This update introduces a breaking change to how non-interactive (headless) environments handle folder trust, which may impact existing CI/CD workflows under specific conditions.

In previous versions, Gemini CLI running in CI environments (headless mode) automatically trusted workspace folders for the purpose of loading configuration and environment variables. This is potentially risky in situations where Gemini CLI runs on untrusted folders in headless mode (e.g. CI workflows that review user-submitted pull requests). If used with untrusted directory contents, this could lead to remote code execution via malicious environment variables in the local .gemini/ directory.

To ensure consistency and user control, the latest update aligns headless mode behavior with interactive mode, requiring folders to be explicitly trusted before configuration files (such as .env) are processed.

02.

How to check

  1. Affected: @google/gemini-cli (npm) < 0.39.1.
  2. Affected: @google/gemini-cli (npm) = 0.40.0-preview.2.
  3. Affected: google-github-actions/run-gemini-cli (actions) < 0.1.22.
  4. Compare your installed version with the range above (command below).
03.

How to fix

  1. Upgrade @google/gemini-cli to 0.39.1 or later.
  2. Upgrade @google/gemini-cli to 0.40.0-preview.3 or later.
  3. Upgrade google-github-actions/run-gemini-cli to 0.1.22 or later.
npm ls @google/gemini-cli -g   # or: gemini --version
# check google-github-actions/run-gemini-cli version
04.

Sources

More advisories for this tool
The weekly email

One email a week. Only what changed.

Every new security hole in AI coding tools, MCP servers, app builders and the stacks they generate (Next.js, Supabase, Node, PHP), each with how to check your app and the fix. No roundups of things you already read.

Free, one email a week. Read the latest issue first if you like. One-click unsubscribe in every email. We never sell or share addresses.