Antigravity and Codex security: stopping secret leaks with hooks and sandboxes A ReclaimLLM analysis compares how Google Antigravity and OpenAI Codex handle secret exfiltration, finding that neither stack protects secrets by default: post-tool hooks cannot redact output that has already run, and Antigravity's hook crash or timeout fail mode is undocumented as of an October 2026 documentation review. The writeup notes that Antigravity's CLI defaults its terminal sandbox off (auto-enabled in auto mode) while the Antigravity App enables it by default, and recommends combining pre-tool hooks, network limits, env-file controls and reviewable session capture. Originally published at ReclaimLLM https://reclaimllm.com/blogs/antigravity-codex-secret-leaks . How Google Antigravity and OpenAI Codex agents read, print, and send secrets; what hooks and sandboxes cover; and where vendor docs leave failure modes undocumented. agy defaults sandbox off auto-enables in auto mode . Google’s hook crash/timeout fail mode is undocumented. read-only , workspace-write default , danger-full-access ; approvals on-request / never . Google Antigravity and OpenAI Codex both offer hooks that can deny a tool call before it runs, plus sandboxes or approval boundaries that limit what shell commands can do. Neither stack gives you secret protection by default: post-tool hooks cannot undo side effects, and hook failures do not always block the underlying action. For a team rolling out either agent in 2026, the practical answer is to combine pre-tool hooks, network limits, env-file controls, and session capture you can review after the fact. This guide compares Antigravity and Codex side by side: where secrets leak, what each vendor documents, and how ReclaimLLM extends both with shipped hooks, env DLP, and an egress guard. Facts about vendor behavior were checked against public documentation in October 2026; re-verify Antigravity docs before you change production policy—they change often. Every coding agent faces the same three exfiltration paths, whether the model runs in the cloud or on your laptop: .env , key files, or config that holds credentials. For a vendor-neutral map of those paths and the control layers that address them, see What is AI DLP?. The sections below focus on Antigravity and Codex specifically. On June 18, 2026, Google announced that Gemini CLI and Gemini Code Assist IDE extensions would stop serving Google AI Pro/Ultra and free individual users. Gemini Code Assist Standard/Enterprise and paid API-key users can keep using Gemini CLI. For everyone else, Antigravity CLI agy is the replacement path. Timeline note: Antigravity as an IDE existed before that cutover. Research such as PromptArmor’s exfiltration write-up and Simon Willison’s commentary 25 November 2025 predates the June 2026 consumer CLI transition—they describe Antigravity-era behavior, not the later Gemini CLI → agy migration by itself. Antigravity loads hooks from project .agents/hooks.json and user ~/.gemini/config/hooks.json . Documented events include SessionStart, PreToolUse, PostToolUse, PreInvocation, PostInvocation, and Stop. On PreToolUse, decisions include allow, auto approve, deny, ask, force ask, and deny unless prior grant, and hooks can overwrite tool input before execution. See Antigravity hooks. PostToolUse does not receive tool output in the documented hook payload—only an error field when something failed—so post-tool hooks cannot redact what already ran. Prevention has to happen at PreToolUse or in sandbox/network policy. Hook failure behavior: As of our October 2026 doc review, Google does not document whether Antigravity’s hook runner fails open or closed on crash, timeout, or malformed hook output. Do not assume either behavior; treat undocumented failure modes as a gap in your risk register. Sandbox defaults depend on surface, not account type: | Surface | Default sandbox behavior | |---|---| | Antigravity App | Terminal sandbox on by default | | Antigravity CLI agy | enableTerminalSandbox defaults to false; auto mode can enable it | Sandboxed commands get no network access by default; domains allowed under read url are added to the sandbox outbound allowlist. Business and enterprise accounts use a different escape-hatch syntax unsandboxed ... vs personal command ... , but Google does not document a default sandbox difference beyond that syntax. Non-workspace access defaults to false on both surfaces. Details: Antigravity sandbox and agent settings. The sandbox limits terminal commands. It does not replace hook-based DLP for file tools or browser subagents. MCP configuration lives in ~/.gemini/config/mcp config.json . OAuth tokens for MCP are stored under ~/.gemini/antigravity/mcp oauth tokens.json . Treat both like credential stores—same rotation and access-review discipline as API keys. See Antigravity MCP. Session logs are written under paths such as: ~/.gemini/antigravity-cli/brain/