Permissions Engine, OS Terminal Sandbox & Enterprise Policy Governance
In Part 5, we covered AGENTS.md and .agents/rules/, and in Part 7, we wired up PreToolUse hooks to run custom interception scripts. After those two posts went live, a reader asked a very practical question: if your Rules already state “never delete files, never read secrets” and you add a Hook script on top, isn’t that safe enough?
My answer from hands-on use is direct: no—and never bet security on prompts.
Rules are soft constraints written for the model. Once context stretches out, multi-step reasoning drifts, or an external web page slips in a prompt injection, the model can still ignore them. Hooks do enforce deterministic blocking, but they are only as solid as the regexes and checks you write—and they cannot stop an otherwise legitimate build command from quietly reading credentials in your home directory or sending outbound traffic in the background.
What actually prevents accidental deletions, credential leaks, and unauthorized network calls at the last line of defense is Google Antigravity’s built-in three-layer hard isolation stack: the permissions engine, the OS-level terminal sandbox, and enterprise policy ceilings. This post breaks down the rule hierarchy across those three layers, five real-world Linux sandbox pitfalls I hit locally, and how organizations enforce baselines via MDM-deployed admin_settings.json.
1. How the Three Layers of Defense Work Together
Start by separating what each layer owns, so you stop stuffing security policies into AGENTS.md—or turning off the entire sandbox the first time it blocks a command:
| Defense Layer | Mechanism | What It Governs | Bypass Resistance |
|---|---|---|---|
| Rules & Prompts | Soft constraints (context instructions) | Code style, directory conventions, collaboration workflow | Breaks down on model drift or context truncation |
PreToolUse Hooks |
Deterministic script interception | Custom business validation, dirty-commit checks, sensitive pattern filtering | Limited by script coverage; cannot restrict child-process network calls |
| Permissions Engine + OS Sandbox + Enterprise Baseline | Runtime + kernel-level hard isolation | Resource-level authorization, filesystem/network isolation, org-wide ceilings | Enforced by permission precedence and OS isolation; local settings cannot exceed enterprise ceilings |
In daily work, these layers do not replace each other—they execute in series. The flowchart below traces the full decision chain for a single tool call from invocation to execution:
flowchart TD
A["Agent initiates tool call"] --> B{"Enterprise admin_settings.json baseline check"}
B -->|"Exceeds enterprise ceiling"| X1["Blocked immediately (cannot be overridden locally)"]
B -->|"Within enterprise baseline"| C{"PreToolUse Hook check"}
C -->|"Hook returns deny"| X2["Blocked by script rule"]
C -->|"Hook allows / force_ask / overwrite args"| D{"Permissions Engine (Deny > Ask > Allow)"}
D -->|"Matches Deny at any layer"| X3["Hard deny immediately (overrides Ask/Allow)"]
D -->|"Requires approval or Hook triggers force_ask"| F{"User approves?"}
F -->|"Denied"| X4["Execution canceled"]
F -->|"Approved / Matches Always Allow"| G["Execute inside OS terminal sandbox"]
D -->|"Matches Allow or auto-allowed in sandbox"| G
G -->|"Succeeds in sandbox"| OK["Return execution result"]
G -->|"Blocked by offline policy or out-of-workspace path"| H["Try a pure-sandbox command first; if host access is required, split the chain and approve individually"]
2. Unified Permissions Engine: Rule Tree & Four Execution Presets
Antigravity does not govern terminal commands alone. It maps every capability an agent can invoke into six controlled resource targets:
command(<prefix>): terminal commands and subcommand prefixes, such ascommand(git status)orcommand(rm -rf)read_file(<path>): file read pathswrite_file(<path>): file creation, modification, or write pathsmcp(<server>/<tool>): MCP servers and individual tools, such asmcp(jira-internal/jira_get_issue)read_url(<domain>): read-only fetches from a specific domainexecute_url(<domain>): interactive or write actions on a target domain (such as browser automation)
The Ironclad Precedence Rule: Deny > Ask > Allow
The entire permissions engine follows one precedence rule you must keep in mind: Deny always beats Ask, and Ask always beats Allow.
If a Deny rule (or an entry in the Command Denylist) exists at any layer—global settings, project settings, or the enterprise baseline—the system hard-blocks the call immediately. It does not matter if another layer configures Allow, or if you switched to a more permissive execution preset.
Sensitive paths such as ~/.ssh and .env are protected by default. In the Antigravity 2.0 desktop app’s Settings, you can also configure Non-Workspace File Access and Internet Access Policy independently as allow, ask, or deny, maintain dedicated Command Allowlists/Denylists and Browser Allowlists, and apply fine-grained overrides per repository via Project-Level Settings.
Comparing the Four Official Execution Presets
When choosing an execution policy in Settings or via CLI flags, the UI presets map directly to four underlying modes. Here is how they compare by risk profile and use case:
| UI Preset | Policy Value / CLI Flag | Default Behavior | Best For |
|---|---|---|---|
| Default | proceed-in-sandbox |
Auto-allows safe operations inside the sandbox; prompts immediately when leaving the sandbox (network calls, out-of-workspace writes, high-risk commands) | Recommended default for everyday local development |
| Auto | auto |
Evaluates safe, reversible commands outside the sandbox and allows them automatically; still blocks high-risk actions | Trusted local repos requiring frequent cross-tool integration |
| Request Review | request-review / strict |
Disables sandbox auto-allow or prompts for human confirmation on every action for full auditability | High-sensitivity production repos, core configs, or compliance-audited projects |
| Turbo | always-proceed / --dangerously-skip-permissions |
Skips human confirmation and executes directly | Ephemeral isolated containers or CI batch runs only; never leave enabled on a host workstation |
Never treat Turbo mode or --dangerously-skip-permissions as a daily productivity toggle. Once enabled, accidental deletions, home-directory edits, or commands triggered by prompt injection land directly on your host machine. Default (proceed-in-sandbox) already runs smoothly for everyday work: reading code, running unit tests, and building inside the sandbox happen with zero interruptions, prompting you only when a command genuinely crosses the boundary.
Why Always Allow Sometimes Doesn’t Stick
Anyone who uses Antigravity for more than a few days hits this question: “I clicked Always Allow last time—why is it prompting me again for a nearly identical command?”
The reason is how approval generalization works. When you approve a command with Always Allow, the engine generalizes by binary name + subcommand prefix. Approve git status, and future calls like git status -sb or git status source/ pass automatically; approve blaze build, and subsequent builds sharing that prefix stop prompting.
To prevent shell-injection bypasses, however, prefix matching is immediately disabled—falling back to exact full-string matching—whenever a command contains any of these five shell constructs:
- Command substitution: such as
$(date +%F)or backticks - Variable expansion: such as
$HOMEor${BRANCH} - Wrapper or eval binaries:
env,sudo,timeout,xargs,eval - Shell backgrounding
&(use the tool’s native background task runner instead of trailing&) - Brace expansion
{a,b}and unnecessary quoting or escaping
This explains why I explicitly require plain, literal commands in project AGENTS.md files and custom Skills: invoke the target binary directly, write out literal paths and flags, and avoid nested xargs or $(...) chains. It is safer—and saves you from clicking an approval dialog every two minutes.

3. OS-Level Terminal Sandbox: Cross-Platform Internals & Linux Pitfalls
The permissions engine decides whether a command is allowed to run; the OS-level terminal sandbox enforces what the process can touch once it starts. Even if a build script or third-party npm package tries to do something shady mid-run, the OS kernel keeps it pinned inside the boundary.
Cross-Platform Isolation Primitives
| OS | Underlying Isolation Primitive | Default Boundary & Behavior |
|---|---|---|
| Linux | Kernel Namespaces (mount / network / PID isolation) | Read/write access to the active workspace, artifact/scratch directories, and /tmp; read-only access to standard system binaries; outbound network blocked by default |
| macOS | sandbox-exec (Seatbelt profiles) |
Enforces strict filesystem path and network restrictions via Seatbelt profiles |
| Windows | Isolated process environment & restricted tokens | Restricts child-process filesystem writes and privileged actions via restricted tokens and process isolation |
Across all three operating systems, the default sandbox boundary follows the same model: allow the current workspace, artifact/scratch directories, standard system binaries, and /tmp; block all outbound network traffic and any file reads or writes outside the workspace.
From the CLI, two flags are especially handy for enforcing or testing sandbox configurations:
1 | # Force-enable the terminal sandbox when launching the CLI |
Five High-Frequency Linux Sandbox Pitfalls Observed Locally
While writing this Antigravity series, I ran builds, diagram rendering, and Git commits inside the Linux sandbox the entire time, hitting five common blocks firsthand. Once you inspect the actual errors and fixes, you will see that more than half of them require zero sandbox bypasses.
Pitfall 1: git commit Fails with “Read-only file system” and git push Fails DNS Resolution
Running git add or git commit inside the sandbox often produces:
1 | fatal: Unable to create '.git/index.lock': Read-only file system |
And running git push fails immediately with a network error:
1 | ssh: Could not resolve hostname github.com: Temporary failure in name resolution |
Git is not broken—the sandbox mount policy marks .git lock creation read-only and cuts off outbound networking. The right response is not moving your entire workflow outside the sandbox. Keep all code edits, checks, and static builds inside the sandbox, and approve only the final Git commit/push commands individually.
Pitfall 2: yarn build Hits EACCES Reading ~/.yarnrc—No Sandbox Bypass Needed
Running yarn build inside the blog repository immediately throws:
1 | error An unexpected error occurred: "EACCES: permission denied, open '/home/user/.yarnrc'". |
On startup, yarn tries to read ~/.yarnrc outside the workspace. Many developers instinctively bypass the sandbox for the whole command here, when there is no reason to—under the hood, the script just invokes Hexo. Call the local binary directly instead:
1 | ./node_modules/.bin/hexo generate |
It never touches the home directory, never needs the network, and finishes inside the sandbox in milliseconds.
Pitfall 3: Puppeteer 2x PNG Rendering Fails with crashpad Missing --database
When rendering dark-mode 2x PNG diagrams via Puppeteer and headless Chromium, the process crashed inside the sandbox:
1 | chrome_crashpad_handler: --database is required |
Same root cause: Chromium’s crashpad handler and config layer try to write under ~/.config in the home directory, which the sandbox blocks. Again, you do not need to disable the sandbox—point the writable config directory at /tmp (which the sandbox allows) and pass the cache path explicitly:
1 | PUPPETEER_CACHE_DIR=/home/user/.cache/puppeteer \ |
With those environment variables set, headless browser rendering completes cleanly inside the sandbox without touching a single file in your home directory.
Pitfall 4: gh CLI and agy Subcommands Fail to Access Host Credentials
Two categories of commands genuinely require host state or network access:
- Running
gh run listorgh pr viewfails to read~/.config/gh/hosts.ymland asks you to rungh auth login. - Running
agy modelsoragy agentattempts to update~/.gemini/antigravity-cli/installation_idand hitsread-only file system.
When a command truly needs host credentials or network access, stick to the split-chain minimal elevation principle:
1 | # Anti-pattern: chaining with && bypasses the sandbox for the entire build script too |
Do not skip splitting the chain out of convenience. Bundling “prepare + build + push” into a single unsandboxed command hands full host access to third-party build scripts and postinstall hooks. Split them apart, and 95% of your workflow runs automatically inside the sandbox while you approve only one short, literal command at the end.
Pitfall 5: Using /** Globs in permissions.deny read_file(...) Breaks Sandbox Startup
If you enable enableTerminalSandbox: true and carry over Claude Code or glob habits into ~/.gemini/antigravity-cli/settings.json to block a sensitive directory:
1 | { |
Sandbox initialization does not support globs when translating deny paths into kernel mount/access policies. It throws sandbox configuration error: deny ...: globs not supported. and prevents every sandboxed command from starting. Pass the exact directory path without the trailing /**:
1 | { |
I also flagged this trap in Part 2 on daily CLI workflows and Engineering in Practice #1—check for it first whenever you configure a new sandbox profile.

4. Enterprise Governance: Gemini Enterprise & MDM-Deployed admin_settings.json
An individual developer can rely on the Default preset and a local sandbox. Across an engineering org of dozens or thousands of developers, however, verbal reminders to “keep the sandbox on and don’t install random plugins” will not prevent mistakes.
For enterprise compliance, administrators can push a root-owned, system-level admin_settings.json file to managed workstations using the Gemini Enterprise Admin Console or standard MDM tools (such as Jamf, Intune, or Fleet).
System Deployment Paths Across Platforms
| OS | System Path for admin_settings.json |
Required Permissions |
|---|---|---|
| macOS | /Library/Application Support/Antigravity/admin_settings.json |
Owned by root, read-only for standard users |
| Linux | /etc/antigravity/admin_settings.json |
Owned by root, read-only for standard users |
| Windows | %ProgramData%\Antigravity\admin_settings.json |
Administrator write access, read-only for standard users |
Three-Tier Policy Precedence Chain
Once deployed, the Antigravity runtime merges configuration strictly in this order of precedence:
admin_settings.json(root-owned enterprise baseline, highest priority)- Project-Level Settings (per-repository overrides)
- User Global Settings (desktop global settings or
~/.gemini/antigravity-cli/settings.json)
Any hard limit set by administrators in admin_settings.json holds regardless of what a user edits locally, toggles in the desktop UI, or passes via CLI override flags.
Five Core Controls Enterprises Can Enforce
To meet common security and audit requirements, organizations typically lock down five boundaries:
- Cap execution modes and permissions: Set the highest permitted auto-execution level and disable Turbo mode and
--dangerously-skip-permissionsoutright, preventing developers from running production workstations without guardrails. - Mandate Terminal Sandbox and lock out-of-workspace access: Prevent users from disabling the sandbox and lock Non-Workspace File Access to
denyorask, blocking agents from scanning across repositories or reading local secrets. - Disable Remote Control tunnels: For financial, government, or restricted intranet environments, shut off remote control relays completely to enforce data-residency boundaries.
- Restrict approved models and enforce a private API gateway: Limit usage to security-reviewed Gemini model versions and route all traffic through a centralized enterprise gateway for auditing and redaction.
- Govern Marketplace and third-party plugin allowlists: Control where plugins and MCP servers can be installed from, blocking unaudited external plugins or third-party MCP endpoints to close supply-chain attack vectors.
If your team has not rolled out full Gemini Enterprise yet, bridge the gap with repository-level rules, shared team baseline configs, and CI checks: maintain a shared Command Denylist for destructive commands, lock down sensitive directory reads, and transition to MDM-managed admin_settings.json once your fleet grows.
5. Five Most Common Permissions & Sandbox Pitfalls
Before rolling this out across a team, run through these five common mistakes:
- Disabling the sandbox globally or turning on
--dangerously-skip-permissionsat the first error. Issues likeyarnreading~/.yarnrcor Puppeteer failing on crashpad’s--databaseflag are fixed cleanly inside the sandbox by calling local binaries directly or pointingXDG_CONFIG_HOMEto/tmp—no need to tear down the walls. - Chaining build commands and
git pushwith&&and elevating the whole line. Approving that chain grants full host privileges to the entire build script beforegit pusheven runs, defeating the purpose of the sandbox. - Forgetting
Deny > Ask > Allow. Adding an Allowlist entry and wondering why the command is still rejected wastes time. Debug from the top down instead: check enterpriseadmin_settings.jsonfirst, then project-level and global Deny rules / Denylists. - Writing clever one-liners full of
$(...),$VAR,env, orxargs. Those constructs intentionally disable prefix matching to block injection, forcing repeated approval prompts and making Always Allow look broken. - Skipping team-wide policy baselines. Without a shared baseline, a new teammate can commit plugins containing plaintext credentials or overly permissive network settings. Lock default permission presets, plugin allowlists, and outbound policies into project settings or
admin_settings.jsonfor core repositories.





















