Skip to content

Agent can bypass sandbox when combining --sandbox with --dangerously-skip-permissions #36

Open

Description

@danielmewes

Reproduction step:

mkdir /tmp/workspace
cd /tmp/workspace
agy --sandbox --dangerously-skip-permissions -p "Run 'echo test > /tmp/outside_workspace.txt'"
cat /tmp/outside_workspace.txt
Image

What I expect: Due to the sandbox, the agent and any terminal command it runs should be unable to write outside of its workspace.

What actually happens: The initial bash tool call fails, but with a hint to the model to pass bypassSandbox: true. The model then follows this suggestion, and successfully runs the command that writes outside the workspace.

The issue appears to be that --dangerously-skip-permissions does not only auto-approve "regular" permission requests, but also auto-approves the prompt for whether the agent is allowed to bypass the sandbox.

This is very unexpected. With Gemini CLI, it was common to combine --yolo with --sandbox to get the safety of the sandbox, without having to worry about permissions.
Other harnesses, such as Claude Code, also work as expected when combining --dangerously-skip-permissions with their respective sandboxing flags, when configured correctly.

With Antigravity CLI, --dangerously-skip-permissions appears to make --sandbox completely ineffective.

IMO this is a pretty major security issue, since it's quite unexpected and a regression from Gemini CLI (at least it was unexpected to me).

Proposed fix: Disallow bypassSandbox without explicit user confirmation, even when --dangerously-skip-permissions is enabled. In headless mode (-p), never allow bypassSandbox.

Activity

  1. IgorGanapolsky commented on May 27, 2026

    @IgorGanapolsky

    Hit this same --dangerously-skip-permissions + --sandbox interaction in production yesterday — agent ran for a while and triggered an iPhone Simulator boot loop that pushed my Mac to load avg 307 (256+ simruntime procs, hard-reboot territory). The bypass made it possible for the agent to spawn child processes that nothing reaped.

    Stopgap I'm using until this lands properly in the CLI: a runtime wrapper around agy that enforces a singleton lock, a hard timeout, and a stuck-loop watchdog (kills the agent if it stays >80% CPU for 2 min), plus a LaunchAgent that culls runaway simulators independently. MIT, no telemetry, idempotent install:

    https://github.com/IgorGanapolsky/mac-yolo-safeguards

    It does not fix the underlying sandbox bypass — that has to be addressed in the CLI per the OP's proposed fix — but it caps the blast radius (and never auto-quits foreground GUI apps, which an aggressive killer would). Sharing in case it's useful to anyone else hitting this between now and a fix.

  2. IgorGanapolsky commented on Jul 14, 2026

    @IgorGanapolsky

    Following up on agent reliability / runaway-loop cost — still an issue on your side?

    If useful, ThumbGate has a scoped diagnostic path; happy to share a live checkout link off-thread.
    Reply here or email iganapolsky@gmail.com. If not now, say so and I'll stop pinging.

    — Igor (autonomous follow-up)

  3. IgorGanapolsky commented on Jul 16, 2026

    @IgorGanapolsky

    Following up on agent reliability / runaway-loop cost — still an issue on your side?

    If useful, ThumbGate has a scoped diagnostic path; happy to share a live checkout link off-thread.
    Reply here or email iganapolsky@gmail.com. If not now, say so and I'll stop pinging.

    — Igor (autonomous follow-up)

  4. added
    bugSomething isn't working
    comp:agent capabilitiesBackground Tasks & Subagents, Permissions, Sandbox
    securityTo flag token exposure or internal instruction leaks
    on Aug 20, 2026
  5. chandrashakherkamasani commented on Sep 3, 2026

    @chandrashakherkamasani
    Collaborator

    Hi @danielmewes,
    --dangerously-skip-permissions is designed to auto-approve all permissions, including sandbox bypass prompts.
    To run automatically inside the sandbox without prompts while strictly preventing any sandbox escapes, use the proceed-in-sandbox mode instead:

    1. Add "toolPermission": "proceed-in-sandbox" to ~/.gemini/antigravity-cli/settings.json:
    {
      "toolPermission": "proceed-in-sandbox"
    }

    Run with --sandbox alone (omit --dangerously-skip-permissions)

    agy --sandbox -p "<your prompt>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingcomp:agent capabilitiesBackground Tasks & Subagents, Permissions, SandboxsecurityTo flag token exposure or internal instruction leaks

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions