GitLab shows how to test an AI agent's sandbox with 14 checks: what it actually blocks
GitLab Duo's agent runs code on your behalf, and a sandbox limits its access to websites and files. But if the flow fails, it quietly runs without the sandbox. Rather than trusting the config on faith, GitLab has published the Sandbox Probe flow, which runs 14 checks of file writes and requests to five domains. The first line of the report states whether protection is on. In the test, pypi.org is blocked in both modes. So after changing network rules, run the probe again.
AI-processed from GitLab Blog; edited by Hamidun News
Imagine an AI agent running code on your behalf that can, at that moment, reach any website or write a file anywhere. This is how source code and tokens leak, and how malicious packages get into a project. To prevent this, GitLab Duo Agent Platform runs agents in a sandbox: an isolated environment where network and file access are restricted.
The rules for it live in the agent-config.yml file, and it is easy to make mistakes in them. Worse, if the sandbox fails, the agent keeps running without it and nobody notices.
So the author of the GitLab blog suggested not taking the config on faith, but running the Sandbox Probe flow. It performs 14 checks: it tries to write to different folders and reach five domains in three ways. In the first line of the report, it states whether the sandbox is active.
How the sandbox works
GitLab wraps every flow run in the Anthropic Sandbox Runtime (SRT). It monitors two things. The first is the network: every request is intercepted and checked against a list of allowed domains. Four addresses are always open: localhost, host.docker.internal, the domain of your GitLab instance, and the Duo Workflow Service. The second is files: writing is allowed in the working directory and in /tmp, reading ~/.ssh is blocked, and the directory holding the sandbox's own settings is protected.
The activation conditions have an unpleasant detail. The sandbox works only if SRT is present in the image, the session runs on a runner, and the job can create user and mount namespaces. If one of these conditions is not met, the flow still starts, but without protection. A warning such as "SRT found but can't create sandbox" appears in the log, and the network policy stops applying. A flow can finish successfully and still be unprotected.
For this case, GitLab 19.6 added the option "Don't run flows when the sandbox is unavailable". It is enabled by owners of the top-level group or by instance administrators. If the sandbox cannot be started, the job fails. The option applies to all subgroups and projects, and a separate agent-config.yml cannot override it. There is a caveat: if a project uses its own image or setup_script, the project itself determines the SRT binary, and GitLab cannot guarantee full isolation.
What is configured in agent-config.yml
The file lives at .gitlab/duo/agent-config.yml and is read only from the default branch, so changes take effect after merging. It has three keys: image, setup_script, and network_policy.
On a custom image, the sandbox works only if SRT is installed. Without it, the flow can reach anywhere the runner can reach and sees the entire file system. For requirements such as FedRAMP, there is a hardened image based on Red Hat UBI 9 Minimal. It runs without root and does not require outbound internet access.
Keep setup_script short and under control. It runs before SRT and outside the sandbox, which means it sees all environment variables, including the user's OAuth token and the service token. GitLab advises protecting the file through Code Owners and approval rules so that the security team approves every change.
In network_policy, you define allowed and denied domains. The include_recommended_allowed flag opens a broad set of package registries, git hosts, and cloud domains, and any of them could become a leak channel. Enable it only when needed. The mode depends on a checkbox at the group level. If it is enabled, the group works in flexible mode: the project's allowed_domains are merged with the group's. If it is disabled, strict mode applies, and project-level allowed_domains are ignored.
What the probe showed
Sandbox Probe is a deterministic flow: the agent chooses and interprets nothing. It runs two scripts from the project and publishes their output as a note on the issue. The first, sandbox-probe.sh, performs the same 14 checks: configuration, writes to allowed and protected paths, and requests to five domains. The second, sandbox-evidence.sh, outputs raw command output shorter than 4096 characters. If the report begins with NOT ACTIVE, the remaining results refer to a run without the sandbox.
Results in both modes matched all 14 expectations. gitlab.com was always open, and registry.npmjs.org was open as a recommended domain. pypi.org was blocked by the project denylist, which shows that a deny takes precedence over an allow. example.com was open only in flexible mode. httpbin.org, which is on neither list, was blocked everywhere.
The probe has limitations too. The proxy returns "blocked-by-allowlist" for any block, even when the denylist was the cause, so the reason is visible only through the configuration checks. ~/.ssh is absent from the standard image, so the read rule cannot be verified. Traffic to localhost, link-local, and private networks bypasses the proxy, and the probe does not cover it. Variables needed for Git and Duo work remain accessible inside the sandbox: it restricts traffic routes and file writes, but it does not hide credentials.
The practical takeaway: after any change to network_policy, the image, or the runner, run the probe and check the ACTIVE line. If a security policy is mandatory, enable the option to refuse running without the sandbox at the group level.
- Nov 30, 2026Kodacode 2.0: AI coding agent gets plugins, built-in Git, and a skills catalog
- Nov 30, 2026Gemini, Codex and Claude Together Burn Through Limits: An Agent Team Uses 15 Times More Tokens Than a Chat
- Nov 30, 2026Claude blocked? How to run Claude Code on a ChatGPT subscription in 15 minutes
- Nov 30, 2026Sber's GigaChat 4 Fixes 80.89% of Real GitHub Bugs, Versus 64.7% for 3.5 Ultra
Key Questions Answered
How the sandbox works?
GitLab wraps every flow run in the Anthropic Sandbox Runtime (SRT). It monitors two things. The first is the network: every request is intercepted and checked against a list of allowed domains. Four addresses are always open: localhost, host.docker.internal, the domain of your GitLab instance, and the Duo Workflow Service. The second is files: writing is allowed in the working directory and in /tmp, reading ~/.ssh is blocked, and the directory holding the sandbox's own settings is protected.
What is configured in agent-config.yml?
The file lives at .gitlab/duo/agent-config.yml and is read only from the default branch, so changes take effect after merging. It has three keys: image, setup_script, and network_policy. On a custom image, the sandbox works only if SRT is installed. Without it, the flow can reach anywhere the runner can reach and sees the entire file system. For requirements such as FedRAMP, there is a hardened image based on Red Hat UBI 9 Minimal. It runs without root and does not require outbound internet access.
What the probe showed?
Sandbox Probe is a deterministic flow: the agent chooses and interprets nothing. It runs two scripts from the project and publishes their output as a note on the issue. The first, sandbox-probe.sh, performs the same 14 checks: configuration, writes to allowed and protected paths, and requests to five domains. The second, sandbox-evidence.sh, outputs raw command output shorter than 4096 characters. If the report begins with NOT ACTIVE, the remaining results refer to a run without the sandbox.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
