Viral Wire

Open-source Hazmat secures AI coding agents with sandboxing

New tool isolates AI agents to prevent credential theft and accidental file access...

Deep Dive

Hazmat, an open-source tool developed to address security risks in AI coding agents, launches to mitigate the threat of credential theft and unintended file access. Built by Anamarija Pogorelec and released on GitHub, Hazmat wraps popular agents like Claude Code, Codex, and Cursor Agent, as well as custom scripts, and runs them in a sandboxed environment on your local machine. This isolation ensures agents cannot access sensitive data such as SSH keys or cloud credentials stored outside the designated project directory.

The tool provides transparency by displaying the terms of the session before launch, listing accessible directories, network permissions, and backup status. On macOS, Hazmat performs four sequential steps: backing up the project, building a sandbox policy, switching to an agent-specific account, and launching the harness—all while a firewall rule is already in place. Linux users benefit natively, while an experimental backend leverages Apple’s container tooling for macOS. A demo script highlights the containment by attempting to read a private key, which fails, while a legitimate file write succeeds. Approximately 5.5% of Hazmat’s code is a formal TLA+ specification, verifying its containment model, though the Go binary remains subject to independent bugs.

Key Points
  • Hazmat sandboxes AI coding agents like Claude Code and Cursor Agent to prevent access to sensitive files like SSH keys and cloud credentials
  • Pre-launch session terms show directory access, network permissions, and backup status before running the agent
  • Supports macOS natively and Linux via native containerization; demo shows 100% failure to access private keys outside the project directory

Why It Matters

Protects developers from credential theft and accidental data leaks during AI-assisted coding workflows.

📬 Get the top 10 AI stories daily