---
id: 18731
lang: en
title: "GitLab shows how to test an AI agent's sandbox with 14 checks: what it actually blocks"
published_at: "2026-11-30 18:32:03"
source_name: "GitLab Blog"
source_url: "https://about.gitlab.com/blog/verify-duo-agent-platform-sandbox-rules/"
canonical_url: "https://news.hamidun.com/en/news/18731"
categories: ["ethics", "autonomous"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# GitLab shows how to test an AI agent's sandbox with 14 checks: what it actually blocks

> **Краткая суть (BLUF):** 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.  • A deny beats an allow: a domain on both lists is blocked • On a custom image without SRT, the sandbox is not enabled at all • The GitLab 19.6 option fails the job if the sandbox cannot be started

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.

---
- **Первоисточник:** [GitLab Blog](https://about.gitlab.com/blog/verify-duo-agent-platform-sandbox-rules/)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18731
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
