Skip to content

fix(installer): bypass Gemini CLI folder-trust gate on extension install - #43

Merged
drorIvry merged 1 commit into
mainfrom
fix/gemini-folder-trust
Aug 19, 2026
Merged

fix(installer): bypass Gemini CLI folder-trust gate on extension install#43
drorIvry merged 1 commit into
mainfrom
fix/gemini-folder-trust

Conversation

@drorIvry

@drorIvry drorIvry commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Problem

A Windows user running the one-liner got:

!  Gemini extension not installed (Installation aborted: Folder "C:\Users\eblair\AppData\Local\Temp\rogue-gemini-2yb03pvm.crt\rogue-plugin-gemini" is not trusted.)

Root cause (verified against gemini-cli main source — packages/cli/src/commands/extensions/install.ts, packages/core/src/utils/trust.ts, packages/cli/src/config/trustedFolders.ts):

  • Gemini CLI's folder-trust feature defaults to enabled (security.folderTrust.enabled ?? true), so this hits every user on a recent Gemini CLI.
  • gemini extensions install <local-dir> trust-checks the extension source path — our just-extracted temp dir, which is never in ~/.gemini/trustedFolders.json — and prompts "Do you trust the files in this folder?".
  • The installer pipes all output to null, so the prompt is invisible and the non-interactive default is NoInstallation aborted: Folder "…" is not trusted.
  • --consent covers only the extension-install consent, not folder trust, and no CLI flag exists for the trust check.

Fix

Run both gemini extensions uninstall and gemini extensions install with GEMINI_CLI_TRUST_WORKSPACE=true — Gemini's documented headless bypass for the trust gate, checked first in checkPathTrust. Untrusted folders block uninstall too, hence both commands.

Properties that make this the right shape:

  • Session-scoped, no persistent trust — nothing is written to ~/.gemini/trustedFolders.json; the only thing trusted is our own release-tarball contents for the duration of the two commands.
  • Safe on old versions — gemini-cli builds without the var ignore it, and those predate default-on folder trust anyway.
  • install.sh: command-scoped prefix (VAR=… cmd). The failure hint no longer prints a recovery command referencing $src — that path lives under the $tmp the RETURN trap deletes, the same dead-recovery-command rule the antigravity block already documents.
  • install.ps1: sets $env:GEMINI_CLI_TRUST_WORKSPACE just before the two calls and captures/restores the prior value in finally, because iwr | iex runs in the user's live PowerShell session and the var must not leak into it.
  • CLAUDE.md: documents the gate so the env var doesn't get "cleaned up" later.

Testing

  • bash -n / sh -n pass on install.sh; shellcheck reports pre-existing warnings only.
  • No dash/quote lookalikes added to PS code (ASCII-only edit); install.ps1 parse is covered by validate.yml's repo-wide pwsh parse step (no pwsh on this machine).
  • No release needed: both installers are fetched fresh from main on every run, so merging fixes the one-liner immediately. Affected users just re-run it.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Gemini CLI extension installation by automatically handling workspace trust prompts.
    • Updated Windows installation to preserve and restore existing environment settings.
    • Enhanced installation failure guidance with a manual command that includes the required trust and consent options.

Gemini CLI's folder-trust feature is now default-ON, and
`gemini extensions install <local-dir>` trust-checks the extension
source path. The installer extracts the release tarball into a temp
dir that is never trusted, pipes all output to null, and the trust
prompt's non-interactive default is No — so every install on a recent
Gemini CLI aborted with:

  Installation aborted: Folder "..." is not trusted.

`--consent` does not cover folder trust (it only covers the extension
install consent) and no CLI flag exists for it. Use Gemini's documented
headless bypass instead: GEMINI_CLI_TRUST_WORKSPACE=true, checked first
in checkPathTrust. It is session-scoped, grants no persistent trust
(nothing written to ~/.gemini/trustedFolders.json), and is ignored by
older Gemini versions. Applied to both the uninstall and the install
call — untrusted folders block uninstall too.

install.sh: command-scoped env prefix; the failure hint no longer
prints a recovery command referencing $src, which lives under the $tmp
the RETURN trap deletes (same rule the antigravity block documents).

install.ps1: sets $env:GEMINI_CLI_TRUST_WORKSPACE before the two calls
and captures/restores the prior value in finally, because `iwr | iex`
runs in the user's live session and the var must not leak into it.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3a92094d-ccc4-4851-ae63-a8f3a4d19f84

📥 Commits

Reviewing files that changed from the base of the PR and between 70be710 and 65de045.

📒 Files selected for processing (3)
  • CLAUDE.md
  • install.ps1
  • install.sh

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

The installers now bypass Gemini workspace trust prompts during extension operations. PowerShell preserves and restores the previous environment value. Shell failure guidance uses a durable manual installation command.

Changes

Gemini workspace trust handling

Layer / File(s) Summary
Installer trust override and restoration
install.ps1, install.sh, CLAUDE.md
The installers set GEMINI_CLI_TRUST_WORKSPACE=true for Gemini extension operations. PowerShell restores or removes the previous value. Shell recovery instructions use the release directory and --consent.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 65de0

The installers now bypass the Gemini folder-trust prompt only for the installation commands and restore the PowerShell environment afterward; no actionable merge-blocking risk remains.

Suggested reviewers: yuval-qf

Poem

I’m a rabbit with a trusted shell,
Gemini installs now run well.
PowerShell saves the setting bright,
Then restores it just right.
No temp path trouble in sight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main installer fix for the Gemini CLI folder-trust gate.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gemini-folder-trust

Comment @coderabbitai help to get the list of available commands.

@drorIvry
drorIvry merged commit cfd9d92 into main Aug 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants