# Gemini CLI needs the sandbox and folder trust switched on, because both ship off

GUIDE, read 12 Nov 2026

**The short answer.** Google's Gemini CLI documents sandboxing through Seatbelt, Docker, Podman, gVisor and a Windows native option, but tools.sandbox defaults to undefined and Trusted Folders is disabled by default. System settings, a policy engine with admin tier, MCP allowlists and OpenTelemetry export cover the rest.

## Gemini CLI ships with the main protections opt-in

Two of Gemini CLI's protective features start switched off. The configuration reference lists tools.sandbox with a default of undefined, meaning no sandbox unless the developer or an administrator sets one. The Trusted Folders documentation states that the feature is disabled by default and must be enabled in user settings with security.folderTrust.enabled.

A third default sits in telemetry, which is also disabled until enabled. The practical result is that an unconfigured laptop runs Gemini CLI with confirmation prompts, an approval mode and nothing else. The rest of this guide covers what to switch on, and where the project's own documentation says the limits are.

## Sandboxing offers several backends and a network switch

Google's sandboxing guide describes the benefit as isolating potentially dangerous operations such as shell commands and file modifications from the host. A developer enables it with the -s flag, the GEMINI_SANDBOX environment variable or the sandbox setting in settings.json. The documented backends are the macOS Seatbelt profiles through sandbox-exec, container-based sandboxing with Docker or Podman, a Windows native sandbox and gVisor (runsc) on Linux.

On macOS, the guide lists six built-in Seatbelt profiles chosen with the SEATBELT_PROFILE variable: permissive-open, permissive-proxied, restrictive-open, restrictive-proxied, strict-open and strict-proxied. The default is permissive-open, which Google describes as denying operations by default, confining writes to the project directory and allowing broad file reads and network access. The strict profiles add read restrictions, and the proxied variants send network traffic through a proxy.

For container sandboxes, Google documents a custom image through GEMINI_SANDBOX_IMAGE and a project-level .gemini/sandbox.Dockerfile, plus SANDBOX_FLAGS for extra container arguments. The configuration reference adds tools.sandboxAllowedPaths for extra accessible paths and tools.sandboxNetworkAccess, which defaults to false. A gVisor sandbox with --network=none gives the CLI no external network access at all, and Google notes it then cannot reach the Gemini API.

- **Choose a strict profile on macOS** when the machine holds credentials, since the default profile allows broad reads.
- **Use sandbox expansion deliberately.** When a sandboxed command fails on permissions, or is flagged as needing more (npm install is Google's example), the CLI shows a Sandbox Expansion Request. Approval extends permissions for that run only.
- **Review SANDBOX_FLAGS in shell profiles.** Extra container flags change the isolation the sandbox provides.

## Trusted Folders stops a cloned project from changing the CLI's behavior

With security.folderTrust.enabled set, Gemini CLI asks the first time it runs in a folder: trust the folder, trust the parent folder, or do not trust. Before the choice, a discovery phase lists commands, MCP servers, hooks, skills and setting overrides found in the project, and the dialog flags dangerous settings such as auto-approval or a disabled sandbox. Decisions are saved in ~/.gemini/trustedFolders.json.

An untrusted folder runs in a restricted safe mode. Per the documentation, workspace settings are ignored, project .env files are not loaded, extension management is restricted, tool auto-acceptance is disabled, automatic memory loading is disabled, MCP servers do not connect and custom commands are not loaded. This is the direct control against a repository that ships its own configuration, hooks or MCP definitions.

Headless runs cannot show the dialog. If the folder is untrusted and the feature is enabled, the CLI exits with FatalUntrustedWorkspaceError. The documented ways around this are the --skip-trust flag and the GEMINI_CLI_TRUST_WORKSPACE=true variable, which trust the workspace for the session. Search CI definitions and wrapper scripts for both, because they turn the control off for whatever the pipeline checks out. Google links separate trust guidance for GitHub Actions.

## Approval modes, YOLO and the policy engine decide what runs unprompted

The configuration reference defines the default approval mode as default, which prompts for approval, with auto_edit auto-approving edit tools and plan as read-only. YOLO mode, which auto-approves all tool calls, can only be enabled from the command line with --yolo or --approval-mode=yolo. Two settings let an administrator remove it: security.disableYoloMode disables YOLO even when a flag requests it, and admin.secureModeEnabled disallows YOLO and the Always allow options. Both default to false, so they have to be set.

Gemini CLI also has a policy engine. Its rules are TOML, each with a decision of allow, deny or ask_user, and ask_user is treated as deny in non-interactive mode. Policies sit in tiers: Default, Workspace, User and Admin, where Admin rules override the others. The Admin tier reads from a system directory, /etc/gemini-cli/policies on Linux, and an adminPolicyPaths setting can add paths. Google's documentation calls deny the recommended way to exclude tools. It also warns that the Workspace tier is currently limited, so use User or Admin policies for rules you depend on.

The tool allowlist tools.core restricts the built-in tools to a named set. Google's enterprise guide calls explicit allowlisting the most secure approach because any tool not listed cannot be used.

## System settings give administrators the final word, with a documented caveat

Google's enterprise guide describes a system defaults file and a system overrides file, merged with user and workspace settings. The overrides file has the final say. Locations are /etc/gemini-cli/settings.json on Linux, C:\ProgramData\gemini-cli\settings.json on Windows and /Library/Application Support/GeminiCli/settings.json on macOS, and the GEMINI_CLI_SYSTEM_SETTINGS_PATH variable changes the path. For MCP server definitions, precedence is System, then Workspace, then User, so a user cannot override a server already defined at system level, but can add servers with new names.

Because the path can be redirected by an environment variable, the guide suggests a wrapper script on PATH that sets the variable to the corporate file before it runs the real binary. The guide's own warning is the most important sentence in it: these patterns should not be considered a foolproof security boundary, and they are designed to prevent accidental misuse and enforce policy, not to defend against a malicious actor with local administrative rights. Plan any laptop deployment with that scope in mind and file permissions on the settings file set accordingly.

## MCP servers get allowlists, a trust flag to avoid, and environment redaction

Gemini CLI's MCP guide documents mcp.allowed and mcp.excluded lists of server names. Each server entry can set includeTools and excludeTools, and excludeTools takes precedence when a tool is in both. The setting that deserves an audit is trust: when true, it bypasses all tool call confirmations for that server. Search user and project settings for it.

The guide also documents environment sanitization. By default, the CLI redacts sensitive environment variables from the base environment before launching a server, including variables matching patterns such as *TOKEN*, *SECRET* and *PASSWORD*, so AWS keys or GitHub tokens in the shell do not leak to a server by accident. A variable placed explicitly in the server's env block is trusted and not redacted, and Google advises using variable expansion rather than hard-coded secrets. Remote servers over SSE or streamable HTTP can use OAuth 2.0.

## OpenTelemetry export is opt-in, and prompt text is included unless you turn it off

Google's telemetry guide lists telemetry.enabled as false by default, with a target of local or gcp, an OTLP endpoint and protocol, an outfile option and a useCollector option. The logPrompts setting defaults to true, so once telemetry is enabled, prompts are included unless it is set to false. Decide that before turning export on for a fleet.

The gemini_cli.tool_call event records the function name and arguments, duration, success, the decision (accept, reject, auto_accept or modify), whether the tool was native or MCP, and the MCP server name. That is enough to answer which tools ran unprompted and through which server, provided the export is delivered to a store the developer cannot edit. The configuration reference separately lists a privacy.usageStatisticsEnabled setting for usage statistics.

## An endpoint control fills the gap where Gemini CLI has no enforced layer

Gemini CLI has an admin policy tier and system settings, which is more than some tools, but Google states that these are not a boundary against a user with local administrative rights, and the sandbox and trust features are off until someone enables them. An endpoint control can verify that those switches are actually set on each machine and record tool calls apart from the CLI's own telemetry.

Vendor coverage of Gemini CLI is thinner than for Claude Code or Cursor in the evidence read for this site. Microsoft's Defender support matrix lists Gemini CLI among assistants discovered with MCP discovery on Windows. Pillar says Gemini CLI is scanned for configuration but runtime blocking was not listed for it as of October 2026. Bay says its cloud workspace product names Gemini CLI among agents it finds across virtual machines, Kubernetes and hosted sessions. All three are vendor claims, read on 12 Nov 2026. If Gemini CLI is in your fleet, ask each vendor whether it observes tool calls or only the install.

## Where this sits in the index

- [Agent Surface Map](/agent-surface-map/): Which of six agent surfaces each of 16 tools sees
- [Action Control Matrix](/action-control-matrix/): Which of six agent actions each tool can stop
- [The ranked index](/ranking/): 16 tools on seven published criteria

## Related guides

- [What coding agents can touch on a developer laptop, and which controls ship with each](/guides/coding-agents-on-developer-laptops/)
- [What agentless means on an endpoint](/guides/what-agentless-means-on-an-endpoint/)
- [Securing OpenAI Codex CLI on developer laptops](/guides/codex-cli-security/)

## Sources

- Google: github.com/google-gemini/gemini-cli docs/cli/sandbox.md: https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/cli/sandbox.md (read 12 Nov 2026)
- Google: github.com/google-gemini/gemini-cli docs/cli/trusted-folders.md: https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/cli/trusted-folders.md (read 12 Nov 2026)
- Google: github.com/google-gemini/gemini-cli docs/tools/mcp-server.md: https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md (read 12 Nov 2026)
- Google: github.com/google-gemini/gemini-cli docs/cli/enterprise.md: https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/cli/enterprise.md (read 12 Nov 2026)
- Google: github.com/google-gemini/gemini-cli docs/cli/telemetry.md: https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/cli/telemetry.md (read 12 Nov 2026)
- Google: github.com/google-gemini/gemini-cli docs/reference/policy-engine.md: https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/reference/policy-engine.md (read 12 Nov 2026)
- Google: github.com/google-gemini/gemini-cli docs/reference/configuration.md: https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/reference/configuration.md (read 12 Nov 2026)
- Microsoft: Defender AI agent support matrix: https://learn.microsoft.com/en-us/defender-endpoint/ai-agent-support-matrix (read 12 Nov 2026)
- Pillar Security: Agentic Endpoint platform page: https://www.pillar.security/platform/agentic-endpoint (read 12 Nov 2026)
- Bay: cloud workspaces platform page: https://www.bay.io/platform/cloud-workspaces (read 12 Nov 2026)

Last reviewed 12 Nov 2026. Canonical: https://aiendpointsecurityranked.com/guides/gemini-cli-security/
