Can Gemini CLI limit what the agent runs and writes? Partly, and only with configuration
An approver deciding what a staff member's Gemini CLI session may execute or modify should know that Gemini CLI includes per-tool allow, deny and ask rules, approval modes and optional sandboxes, but the organization must configure and verify each of them. The vendor's enterprise configuration page says its admin patterns should not be considered a foolproof security boundary, because a user with local privileges may still circumvent them. Treat these controls as risk reduction on managed endpoints, not as a guarantee. Since June 18, 2026, free individual access and Google AI Pro and Ultra have moved to Antigravity CLI, so confirm which product and licence your staff will actually run before you approve it. Licensing, sign-in and admin enforcement are covered on sibling pages and are not repeated here.
Three layers decide what happens to a tool call. The first is the policy engine, where TOML rules set whether each tool call is allowed, denied or sent to the user for confirmation (ask_user). The second is the approval mode: default, autoEdit, plan (read-only) and yolo, in which all tools are auto-approved. The third is the sandbox, which isolates shell commands and file writes and is turned on with the --sandbox flag, the GEMINI_SANDBOX environment variable or tools.sandbox in settings.json. The sandbox page says it reduces but does not eliminate risk. Ask your engineering team to write down the rule set, the approval mode you will permit and the sandbox type for each operating system before approval, then test that yolo is blocked where you have banned it.
The sandbox choice matters because the default macOS profile, permissive-open, confines writes to the project directory but still allows broad file reads and network access. Docker or Podman containers, the Windows native sandbox, gVisor (runsc) on Linux, which the vendor describes as the strongest isolation, and experimental LXC/LXD are the other options listed. Confirm with your platform team which of these your fleet can run, whether the chosen backend is supported on your OS versions, and how a user would notice that the sandbox failed to start. Because ask_user is treated as a denial in non-interactive mode, scripted or CI runs need rules that resolve every call in advance.
Which permission and sandbox controls are built in, paid or outside components
This table sorts each Gemini CLI permission and isolation control by where it lives: inside the open-source client, in a runtime the organization must operate, or in an area the supplied sources leave open. Read the middle column first to see what the client enforces on its own, then confirm the final column with Google before approving a rollout. The main takeaway is that the policy engine and approval modes come with the client, while container and gVisor isolation depend on infrastructure your team runs.
| Control | Where it comes from | What to confirm before approval |
|---|---|---|
| Policy engine TOML rules (allow, deny, ask_user) | Built into the open-source client | Whether managed rules can be forced on every install and how a user with local privileges could edit them |
| Approval modes default, autoEdit and plan (read-only) | Built into the open-source client | Which mode is the default for staff accounts and whether the setting can be locked by an administrator |
| Approval mode yolo (all tools auto-approved) | Built into the open-source client | Whether administrators can disable yolo across all installs and how it is detected in logs |
| ask_user treated as a denial in non-interactive mode | Built into the open-source client | How scheduled or scripted runs are governed so that unattended jobs fail closed as intended |
| Sandbox switched on by --sandbox, GEMINI_SANDBOX or tools.sandbox | Built into the open-source client | Whether administrators can force sandboxing so users cannot switch it off |
| macOS Seatbelt permissive-open profile (default) | Built into the open-source client, runs on the host OS | That writes are confined to the project directory and what broad reads and network access still allow |
| Docker or Podman container sandbox | Requires a container runtime your organization operates | Image provenance, who maintains the sandbox image and which network and mount settings are enforced |
| Windows native sandbox | Built into the open-source client, runs on the host OS | Isolation strength compared with the other options and which file and network paths remain reachable |
| gVisor (runsc) on Linux, described as strongest isolation | Requires gVisor installed on hosts your organization operates | Supported Linux distributions, performance impact on builds and who patches the runtime |
| Experimental LXC/LXD sandbox | Requires an LXC or LXD host your organization operates, experimental | Whether it is supported for production use and whether it should be excluded from approved configurations |
How the policy engine decides whether a tool call runs, asks or is blocked
Every tool call Gemini CLI wants to make passes through the policy engine before anything runs. The engine evaluates the call against TOML rules, and each matching rule returns one of three outcomes: allow, deny or ask_user. An allow runs the call, a deny blocks it, and ask_user pauses for a person to approve or refuse. The rules are the first control a reviewer should read, because they decide what the agent can do without anyone looking. Ask the vendor or your platform team to show the rule files that will apply to your installs, and confirm where those files are read from on each managed machine.
The rules interact with the approval mode, which sets the default posture for tool calls. The documented modes are default, autoEdit, plan and yolo. Plan mode is read-only, so it suits review or exploration work where no writes should happen. The mode that matters most for risk is yolo, in which all tools are auto-approved. In that mode the human check disappears for every call the rules do not deny outright, so a reviewer should decide whether yolo is permitted at all and, if it is, on which machines. A related point is that ask_user is treated as a denial in non-interactive mode. Scripted or headless runs therefore fail closed on anything that would prompt, which is a useful property, but teams should test that their automation fails as expected rather than assuming it will.
The sandbox is a separate layer. It confines shell commands and file writes, and it is enabled with the --sandbox flag, the GEMINI_SANDBOX environment variable or tools.sandbox in settings.json. The default macOS Seatbelt profile, permissive-open, confines writes to the project directory while allowing broad file reads and network access. That means a command can still read a wide range of files and reach the network, so the sandbox does not replace the policy rules. Gemini CLI's own documentation says sandboxing reduces but does not eliminate all risks. Before approving a rollout, confirm which profile each platform uses, what it permits for network egress and whether the enterprise settings can force sandboxing on every install. The Gemini CLI sandboxing documentation sets out the available backends.
Decision path for a single Gemini CLI tool call
The diagram starts when Gemini CLI requests a tool call and sends it to the policy engine, which applies TOML rules that return allow, deny or ask_user. An ask_user result goes to an interactive approval prompt in a session, or is treated as a denial when no one is present to answer. Approved calls then pass to the sandbox if sandboxing is enabled, where the default macOS profile confines writes to the project directory. Check which rules and approval mode are in force, and confirm the sandbox is enabled for every install, not only by default.
How one tool call is allowed, asked about, blocked or sandboxed.
Where the permission model leaves gaps an approver must close
The Gemini CLI permission model combines a policy engine, approval modes and an optional sandbox, and each layer has limits that the vendor documents. The cards below cover the gaps a reviewer should close with enforced settings, managed endpoints, container isolation, network controls and reviewed policy files before staff run the agent against company code.
Yolo mode can be set by any user
The yolo approval mode auto-approves every tool call, so the agent can run shell commands and edit files without a prompt. Unless an administrator disables it through the system-wide settings file, any user can select it. Check that the enforced configuration turns yolo off on every install and that users cannot override it from their own settings.
Enterprise configurationAdmin patterns are not a hard boundary
The vendor's enterprise configuration guidance says admin patterns should not be treated as a foolproof security boundary, because a user with local privileges may still circumvent them. Close this gap by running Gemini CLI on managed endpoints where staff do not hold local administrator or root rights, and by treating system-wide settings as a control that depends on the endpoint.
Sandbox reduces risk, it does not remove it
The sandbox documentation says sandboxing reduces but does not eliminate all risks. Reviewers should not record sandboxing as a complete control in the approval. Pair it with network egress controls, limited credentials in the environment and monitoring of the commands the agent runs, and state in the approval what residual risk the organization accepts.
Sandbox docsPermissive macOS profile allows broad reads
The default macOS Seatbelt profile, permissive-open, confines writes to the project directory but allows broad file reads and network access. An agent under this profile can read files outside the project and reach the network. Where macOS endpoints handle sensitive data, confirm whether a stricter profile is available for your use, or require a container or egress policy instead.
No sandbox unless enforced
Sandboxing is switched on with the --sandbox flag, the GEMINI_SANDBOX environment variable or tools.sandbox in settings.json, so a user can run the agent unsandboxed by omitting them. Make sandboxing a forced setting in the system-wide configuration, and check that the setting cannot be overridden by a project or user file. Confirm the chosen backend starts correctly on each endpoint type.
Experimental backends and policy scope limits
LXC and LXD sandboxing is listed as experimental, so it should not be the basis of a production approval. Policy rules also decide per tool call, allow, deny or ask, and do not judge the content of a command. A permitted shell tool can still run harmful commands, so review the policy TOML files as code and prefer gVisor or container isolation for high-risk work.
How the sandbox choice changes by operating system and environment
On macOS, the default sandbox uses a Seatbelt profile named permissive-open. According to the Gemini CLI sandbox documentation, this profile confines writes to the project directory while allowing broad file reads and network access. That means the agent can write only inside the project folder, but it can still read a wide range of files on the machine and reach the network.
- Write confinement: Writes are limited to the project directory, which limits damage from a misdirected shell command.
- Broad reads: Reads are not confined in the default profile, so secrets stored elsewhere on the laptop may be visible to the agent.
- Network access: Outbound network traffic is permitted, so the sandbox does not prevent data from leaving the machine.
- Profile selection: Confirm which Seatbelt profile your settings select, since stricter profiles are a separate choice.
- Enforcement: Users with local privileges may change the configuration, so test the setting on managed devices rather than assume it holds.
Before approving macOS use, ask the platform team which profile is enforced on managed Macs and run a test that attempts a write outside the project and a read of a credential file.
On Linux, the documentation lists gVisor (runsc) as the strongest isolation option, and Docker or Podman containers as alternatives. LXC and LXD are listed as experimental. Enabling the sandbox uses the --sandbox flag, the GEMINI_SANDBOX environment variable, or tools.sandbox in settings.json. The documentation states that sandboxing reduces but does not eliminate all risks.
- gVisor (runsc): Described as the strongest isolation on Linux, so it is the first option to evaluate for sensitive repositories.
- Docker or Podman: Common alternatives that depend on the container runtime and its host configuration.
- LXC/LXD: Experimental, so treat it as unsuitable for production approval unless the vendor confirms support.
- Host exposure: Mounted host paths, Docker socket access or privileged flags can weaken any container boundary.
- Testing: Each runtime needs its own test of file writes, network egress and access to host credentials.
Confirm with the platform team which runtime is standard on your Linux fleet and whether gVisor is installed and supported on those hosts.
The sandbox documentation lists a Windows native sandbox as one option. It is a separate mechanism from the macOS Seatbelt profile and from Linux containers, so its isolation properties must be assessed on their own. Do not assume that a control proven on Linux or macOS carries over to Windows.
- Scope: Confirm with Google exactly which file paths, registry keys, network destinations and child processes the native sandbox restricts.
- Shell behavior: Test PowerShell and cmd invocations separately, because the restrictions may differ by shell.
- Mixed fleets: Workstations that run WSL may behave differently from native Windows sessions, so test both.
- Administrative enforcement: Verify that users cannot switch the sandbox off through a local settings file.
- Documentation status: Ask whether the native sandbox is marked experimental or production-ready for your release.
Before approving Windows, obtain written scope from the vendor and run the same write, read and network tests used on the other platforms.
In containers or CI runners, the container becomes the main isolation boundary, not a sandbox layered on a developer laptop. The sandbox page lists Docker and Podman as supported container options. The runner itself must be configured so the agent cannot reach what the container should hide.
- Credentials: Do not inject cloud keys, API tokens or deployment secrets into the runner beyond what the task requires.
- Host mounts: Avoid mounting the host home directory, SSH keys or the Docker socket into the container.
- Network policy: Restrict egress to the model endpoints and approved package sources where the platform allows it.
- Ephemeral workspaces: Use disposable workspaces so that files written by the agent do not persist between jobs.
- Approval mode: Pair the container with a restrictive policy, since a runner with no human present cannot answer an ask_user prompt.
Ask the platform team to document the runner image, its mounts and its egress rules, and to show that a test job cannot read host secrets.
Order of work to put permission controls in production
This sequence moves Gemini CLI from ad hoc use to a controlled setup where approval modes, sandboxing and policy rules are chosen deliberately, enforced centrally and re-tested as the tool changes. Each step ends with a check the reviewer can repeat.
Inventory current approval modes and sandboxes
Ask engineering leads and platform owners which approval modes staff use today (default, autoEdit, plan or yolo) and whether any install runs with a sandbox turned on. Use the installed version and any local settings.json files as the source, not memory. Done means you have a list of users or teams, their mode, their sandbox setting and the shell or file access each group actually relies on.
Set a standard policy with yolo disabled
Define one baseline policy for the organization: yolo mode off, plan mode (read-only) used for review and analysis tasks, and autoEdit or default for ordinary development. Write the rules as TOML allow, deny and ask_user entries so each tool call has a documented outcome. Security and engineering leads should approve the baseline in writing before rollout. Done means a signed policy document that names each approval mode and when it applies.
Choose and test a sandbox for each operating system
Pick a sandbox option for each OS in use: the default macOS Seatbelt profile, Docker or Podman, the Windows native sandbox, or gVisor (runsc) on Linux where the strongest isolation is needed. Note that LXC/LXD is experimental. In a test project, attempt a write outside the project directory and an outbound network call to a host outside the approved list. Done means a recorded result for each OS showing what was blocked and what was not, with the sandbox's own limits documented. The sandbox page states it reduces but does not eliminate risk.
Decide which workflows run headless
List any scripts, CI jobs or scheduled tasks that run Gemini CLI without a person present. In non-interactive mode, ask_user is treated as a denial, so confirm each headless job still completes with the tools it needs and fails safely when a call is denied. Where a job needs a tool that is currently ask_user, add an explicit allow rule only after review. Done means a headless job list with a tested outcome for every denied call.
Enforce settings centrally and test overrides
Deploy the approved settings and policy files through your managed configuration route so they apply to every install. Then test, as a standard user on a managed device, whether you can change the approval mode, disable the sandbox or add a rule that loosens the policy. Vendor documentation says admin patterns are not a foolproof boundary because a local user with privileges may circumvent them, so the test should be run with the privilege level your staff actually have. Done means a dated test record and a list of gaps that need compensating controls such as endpoint management or egress filtering.
Keep policy files under version control
Store the policy TOML files, settings.json templates and sandbox configuration in a version control repository with named owners and required review for changes. Require a pull request approval for any rule that allows a shell command, a network host or a file path outside the project. Done means a repository history where every policy change has a reviewer, a reason and a date, and a rollback path that has been used at least once in a test.
Re-test after each weekly stable release
Gemini CLI stable releases ship weekly on Tuesdays, and nightly builds ship daily, so the behavior of policy and sandbox settings can change between reviews. After each stable release, rerun the write, network and headless tests from the earlier steps on one machine per OS, and check the release notes for changes to approval modes or sandbox handling. Done means a short dated checklist signed by the security owner, and a decision on whether to pin a version or move the policy forward. Confirm current plan and product status with Google before rollout, since the Gemini CLI documentation says it was replaced by Antigravity CLI on June 18, 2026.
What a security reviewer asks to see for tool permissions and sandboxing
This table lists the artifacts a reviewer should request before approving Gemini CLI for staff use, with the source page for each and what to confirm in the organization's own environment. Read each row as a question to answer with a file, a test result or a settings export, not as a claim the vendor makes on the reviewer's behalf.
| Evidence item | What it shows | Source to check | What to confirm locally |
|---|---|---|---|
| Policy rule set in version control | The TOML rules that set allow, deny or ask_user for each tool call, and who approved changes to them | Gemini CLI policy engine page | Rules are stored in the organization's repository, changes go through review, and the file matches what runs on endpoints |
| Approval mode settings | Which of default, autoEdit, plan (read-only) and yolo each user or group can reach, where yolo appears in the rules | Gemini CLI policy engine page and enterprise configuration page | yolo is disabled through enforced system settings, not only through a user-editable file |
| Enforced system settings export | The effective settings on a sample of managed installs, including sandbox state | Gemini CLI enterprise configuration page | A local user cannot override the admin settings, and the reviewer can reproduce the export on a test device |
| Sandbox configuration proof | Whether sandboxing is turned on through the --sandbox flag, GEMINI_SANDBOX or tools.sandbox in settings.json, and which setting wins | Gemini CLI sandboxing page | Sandboxing is forced at the system level and the chosen backend is recorded for each operating system |
| Sandbox test results per OS | For macOS Seatbelt, Linux, Windows and container backends: whether writes stay in the project directory and what network access is allowed | Gemini CLI sandboxing page | Tests run on the same OS images used in production, with write attempts outside the project and outbound connections recorded |
| Allowed and denied tool call list | The tool calls that run without a prompt, those that ask, and those that are blocked | Gemini CLI policy engine page | ask_user is treated as a denial in non-interactive mode, so confirm that scheduled or scripted runs fail closed as intended |
| Known limits statement | The vendor's position that admin patterns are not a foolproof boundary when a user has local privileges | Gemini CLI enterprise configuration page | Endpoint controls prevent local admin rights that could bypass managed settings |
| Change log for weekly releases | Which Gemini CLI version each install runs and what changed in policy or sandbox behavior between releases | Gemini CLI GitHub repository | Stable releases ship weekly on Tuesdays and nightly builds daily, so pin a version, test each update and record the rollout date |
Questions approvers ask before allowing Gemini CLI to run commands
Is yolo mode off by default, and can staff turn it on?
Yes, yolo is not the default. The policy engine lists four approval modes: default, autoEdit, plan (read-only) and yolo, and in yolo mode all tools are auto-approved. Staff can switch modes during a session, so the control that matters is whether your administrators enforce a rule that disables yolo on every install. Confirm that the system settings file and admin policy folder described in the admin controls topic can block it on each machine, and test that a user who edits their own settings cannot re-enable it. Ask Google how the mode is recorded in logs before you approve broad use.
Does the sandbox run automatically when Gemini CLI starts?
No. Sandboxing is off unless it is turned on with the --sandbox flag, the GEMINI_SANDBOX environment variable, or tools.sandbox in settings.json. The sandbox page also says it reduces but does not eliminate risk. The default macOS Seatbelt profile, permissive-open, limits writes to the project directory but allows broad file reads and network access, so it is not a full isolation layer. The Windows native sandbox, Docker or Podman containers, and gVisor (runsc) on Linux, which the page describes as the strongest option, each need separate testing on your OS mix. Make forced sandboxing a managed setting, not a user preference.
Can a user with local admin rights get around the policies?
Yes, and Google says so. The enterprise configuration page states that its admin patterns should not be considered a foolproof security boundary, because a user with local privileges may still circumvent them. Treat managed settings as a strong default for standard users, not as a control against a determined local administrator. Where that gap is unacceptable, limit local admin rights on developer machines, run Gemini CLI in a container or managed remote environment, and log tool activity outside the client. Document this residual risk in your approval record so the decision is explicit.
What happens to a headless job when a rule says ask_user?
The action is denied. The policy engine treats ask_user as a denial in non-interactive mode, so a scripted or CI run cannot pause for approval and will not proceed past that tool call. Engineers often discover this when a pipeline fails silently after a policy change. Before you rely on headless runs, write explicit allow rules for the specific commands the job needs, keep them narrow, and test each job against the policy file in a staging environment. Review any allow rule that touches shell execution or file writes, since that is where a headless agent can do the most damage without a person watching.
What drives the cost and timeline of a Gemini CLI rollout?
DeployOpen does not publish prices. Fixed-scope quotes follow a written scope agreed before work starts, so the main inputs are what you need to cover. The drivers are fleet size, the OS mix across macOS, Linux and Windows (each sandbox behaves differently), the container runtime you already run, whether headless jobs and CI use the tool, how many policy rules and MCP servers you need to approve, and how much evidence your compliance team wants. Costs are one-time for design, policy authoring and testing, with recurring effort for policy review as Gemini CLI releases ship weekly on Tuesdays and nightly builds ship daily. Ask any provider for a quote that lists each of these items separately.
Can our own team do this without outside help?
Often yes, if you have engineers who can write TOML policy rules, test sandbox profiles on each OS, and maintain managed settings. The work is mainly in testing: confirming that sandboxing, yolo restrictions and ask_user denials behave as written on every platform you support. DeployOpen plans, implements, hardens and documents self-hosted open-source platforms inside a client's own infrastructure, and runs security testing, including AI agent security and red teaming. It also offers retainers for ongoing support and continuous testing. Ask us to scope the parts you cannot staff, and keep ownership of the approval decision inside your security team.
Official pages to check each permission and sandbox claim against
Check every permission and sandbox claim in this section against the official pages before you approve a rollout, starting with the Gemini CLI sandboxing page. It covers how sandboxing is switched on through the --sandbox flag, the GEMINI_SANDBOX environment variable or tools.sandbox in settings.json, and it states that sandboxing reduces risk without eliminating it. Read it alongside the per-platform sections (macOS Seatbelt, Windows native, Docker or Podman, gVisor on Linux and the experimental LXC/LXD option) and confirm which of these your engineers can actually run on their hardware. Gemini CLI sandboxing is the natural first read.
Next, use the Gemini CLI policy engine reference to verify how TOML rules resolve to allow, deny or ask_user, how ask_user behaves in non-interactive runs, and which approval modes exist, including whether yolo auto-approves every tool. Then read the Gemini CLI enterprise configuration page, which states that its admin patterns are not a foolproof security boundary because a user with local privileges may circumvent them. Treat that warning as a design input: any control you rely on must also be enforced at the endpoint or network layer.
Finally, review the google-gemini/gemini-cli repository on GitHub. Stable releases ship weekly on Tuesdays and nightly builds ship daily, so sandbox and policy behavior can change between versions. Record the exact release each developer machine runs, re-test the sandbox and approval settings after every version bump you approve, and confirm with Google any behavior the documentation does not state clearly for that release.
How DeployOpen tests and hardens Gemini CLI permissions before rollout
DeployOpen plans, implements, hardens and documents self-hosted open-source platforms inside the client's own infrastructure, and runs security testing that includes AI agents. For Gemini CLI, that means checking what the agent may run and read against the policy engine, approval modes and sandbox settings your organization actually chooses, before staff use it.
How we scope
- Scope is agreed in writing before work starts, listing the workstations, approval modes and sandbox options under review.
- We record which tool calls must run, ask for approval or be blocked, and which approval modes are permitted.
- The written scope states which sandbox backends are in use per operating system, including macOS, Linux, Windows and containers.
- Scope also names the systems, repositories and credentials the agent could reach, so the test boundary is explicit.
How we build
- We draft the policy engine rules in TOML so allow, deny and ask_user decisions match your agreed scope.
- We configure sandboxing through the documented flag, environment variable or settings file, and verify it is active.
- We test whether yolo mode, file writes outside the project directory and shell commands are blocked as the policy intends.
- We test prompt injection and command escalation attempts against the configured rules and record every failed control.
How we hand over
- You receive the rule files, sandbox configuration and test results, with each finding tied to a specific rule or setting.
- Documentation explains where admin settings can be overridden by a user with local privileges, so reviewers see the real boundary.
- We walk your engineering and security staff through the findings and the residual risks that the sandbox does not remove.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer, useful as Gemini CLI releases change often.
- Retesting after a rule change, a new approval mode or a Gemini CLI upgrade can be added to the retainer scope.
- Before any change, confirm with your team and DeployOpen the written scope that governs retesting and remediation.

