← All notes

Sandboxing and trusted folders in Gemini CLI

Answer: Sandboxing keeps potentially dangerous operations, like shell commands or file modifications, isolated from your host system. Trusted Folders asks you to approve a folder before project-specific configurations load.

Turning the sandbox on (precedence order)

  1. Command flag: --sandbox, or -s.
  2. Environment variable: GEMINI_SANDBOX (true, docker, podman, sandbox-exec, runsc, or lxc).
  3. Settings file: set sandbox to true under tools in settings.json.

Methods

Trusted Folders

The feature is disabled by default. Once enabled, the first run in a folder asks: trust folder, trust parent folder, or don't trust. Untrusted folders run in a restricted safe mode. The choice is saved in a central file (~/.gemini/trustedFolders.json).

Artifacts

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: GitHub repository docs under Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0) or MIT License (https://opensource.org/licenses/MIT), as listed per source; copyright notices remain with the original authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Google Gemini CLI docs (GitHub), Sandboxing in Gemini CLI, Apache-2.0 (google-gemini/gemini-cli LICENSE); Google Gemini CLI docs (GitHub), Trusted Folders, Apache-2.0 (google-gemini/gemini-cli LICENSE).

Cite this

Permanent ID: iil:note:zqrg13r5

iinventedlight. 2026. "Sandboxing and trusted folders in Gemini CLI." iinventedlight Library, iil:note:zqrg13r5, version of 2026-11-09. https://iinventedlight.com/library/notes/ao-security-gemini-cli-sandbox/. License: CC-BY-4.0.

@misc{iil_note_zqrg13r5,
  author = {{iinventedlight}},
  title = {{Sandboxing and trusted folders in Gemini CLI}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-09},
  url = {https://iinventedlight.com/library/notes/ao-security-gemini-cli-sandbox/},
  note = {Permanent ID iil:note:zqrg13r5. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-security-gemini-cli-sandbox.md.