Skip to main content

Trusting a parent can grant configuration trust to repositories added later

PhaseSetup & CollaborationRolesEngineer ยท DevOps EngineerSeverityHighApplies toGemini CLI onlyEvidenceSecurity advisory

In one sentence: when Gemini CLI Trusted Folders is enabled, trusting a parent also trusts its children, including repositories added later. Grant trust at project scope and distinguish configuration loading from tool permissions.

Symptomโ€‹

I often see this shortcut: you open Gemini CLI under ~/projects, and after enabling Trusted Folders, the first time it asks "trust this folder?", you pick "trust parent folder" so you won't be asked again for every subproject.

A few days later you clone an unfamiliar open-source repo into ~/projects/some-cloned-repo and ask me to "take a look." You assume something freshly cloned is isolated by default and would be asked about again โ€” but it isn't. It sits under a parent you trusted earlier, so it's treated as trusted: its .gemini/settings.json takes effect, its .env gets read, while tool approval still depends on permission policy. The door you opened for unfamiliar code is one you opened days ago, for something else.

Why this happensโ€‹

The current official documentation says Trusted Folders is disabled by default and enabled through security.folderTrust.enabled: true. When enabled, parent trust extends to children and is recorded in ~/.gemini/trustedFolders.json.

This is a configuration-loading trust boundary, not OS isolation or automatic approval of every dangerous tool. Untrusted directories restrict project settings and environment loading; check the exact version's behavior.

Issue #13125 reported parent trust overriding a child's DO_NOT_TRUST. The issue is now closed; closure alone establishes neither a fix in every version nor a current vulnerability. Test whether a specific denial is effective in the installed version.

Other tools also have workspace trust. Claiming Claude Code has no trust store does not establish that this class of risk is unique to Gemini.

Consequencesโ€‹

  • Configuration authorization expands unexpectedly. A new repository under a trusted parent can have project settings and environment files loaded.
  • CI configuration-trust risk. GHSA-wpqr-6v78-jr5g documents conditions and fixes for historical headless configuration trust leading to command execution, not every current headless session.
  • Location is mistaken for isolation. Moving a repository helps only when trust checking is enabled and effective and no other authorization path overrides it.

What to do insteadโ€‹

Grant trust at the narrowest scope, and keep "untrusted things" physically outside any trusted parent.

  1. Don't "trust parent folder" on a directory that holds unfamiliar children. Any directory you clone or download third-party code into (~/projects, ~/Downloads) shouldn't be trusted wholesale; trust the specific project directory that's actually yours.
  2. Open unfamiliar / cloned repos from an isolated path. Give them a "quarantine" location outside any trusted parent, so Gemini asks you about trust on first open and keeps the call in your hands.
  3. Inspect CI inputs before granting trust. GEMINI_TRUST_WORKSPACE=true and skipping trust checks are not defenses for untrusted repositories. Upgrade affected components and inspect configuration provenance; explicitly trust approved tasks while retaining isolation and minimal credentials.
  4. Review ~/.gemini/trustedFolders.json periodically. Prune over-broad, stale entries โ€” trust expires, but the file won't clean itself.

Exampleโ€‹

Before:

~/.gemini/trustedFolders.json
"~/projects": "TRUST_FOLDER" # "trust parent folder," picked earlier to save clicks

# later
$ git clone https://github.com/somebody/unknown ~/projects/unknown
$ cd ~/projects/unknown && gemini "take a look at this"
settings.json and environment files can load; check tool permissions separately
โ†’ an injection hidden in the README now has a trusted context to land in

After:

# Prerequisite: security.folderTrust.enabled is enabled and effective.
# Clone outside any trusted parent directory.
$ git clone https://github.com/somebody/unknown ~/quarantine/unknown
$ cd ~/quarantine/unknown && gemini "take a look at this"
โ†’ Gemini asks: trust this folder? [No]
โ†’ Untrusted mode restricts project settings and environment loading; controlled tool permissions and isolation remain necessary.

The difference isn't that I got more vigilant โ€” it's that the "trust or not" switch was granted at the right, narrowest scope, instead of flipped wide open days ago for something unrelated.

When the exception appliesโ€‹

If it's a monorepo that's all your own code, where every subdirectory is yours and should be trusted, trusting the parent is reasonable and saves repeated prompts. This entry is about mixed trees โ€” your code sitting alongside untrusted clones and third-party directories under one parent. The test is simple: will this parent folder ever come to hold code "you didn't write and haven't read"? If yes, don't trust it wholesale.

Version notesโ€‹

Versions

Checked current Trusted Folders documentation, issue #13125, and Google's advisory on 2026-10-29. The advisory lists stable CLI fix 0.39.1, preview fix 0.40.0-preview.3, and Action fix 0.1.22; check branches and components separately. Historical issues are not generalized to every current version.

Further reading and sourcesโ€‹