返回资讯中心
外部精选
软件工程
#开发者实时流

Sandboxing AI Coding Agents: Nono vs. Docker Sbx vs. Microsandbox vs. OpenShell

AI coding agents typically need to use secrets, including the API token used to authenticate with 3rd party LLM providers. If those secrets enter the sandbox at any time, an attacker who manipulates the agent can probab…

Hacker News 最新spiridow2026/11/23 · 今天28 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

AI coding agents typically need to use secrets, including the API token used to authenticate with 3rd party LLM providers. If those secrets enter the sandbox at any time, an attacker who manipulates the agent can probably exfiltrate them. To solve this problem, a technique called credential injection can be used.

The sandbox is configured to route all network traffic through a proxy that sits outside the sandbox. Placeholders for real secrets are stored inside the sandbox, for example in config files. Whenever the agent makes a network request, it goes through the proxy. The proxy intercepts the request and replaces the placeholder with the real secret, and then forwards the request to the endpoint. This is a feature that many dedicated sandboxing tools now support and that we will mention multiple times throughout this blog post.

In order for the credential to never be sent to an attacker, it must be scoped to an endpoint. What would happen if the agent is manipulated to make a request that contains the placeholder secret to attacker.com and the proxy blindly replaces it with the real secret and forwards it to the attacker controlled website? The secret must only be replaced if the destination is an approved one for this specific secret (scoped to domain and endpoint).

For each tool, we first read its official documentation, then installed the tool on Linux and used it for a short period of time on real work, typically with GitHub Copilot CLI and OpenCode. We used the criteria listed above to evaluate each tool.

Additionally, we gave each tool an overall security score out of 5. This score is based on the isolation primitive used, granularity of restrictions available and the project's maturity and track record of vulnerabilities.

We did not try to escape the sandbox of each of these tools. Our evaluation is only based on the above criteria and this is not a security audit. So our security scores do not account for that.

Claude Code, Cursor, Copilot CLI and other AI coding agents come with a built-in sandboxing feature, which is often turned off by default. We tried these features in GitHub Copilot for VS Code and Claude Code. They are definitely better than no sandboxing at all, but they come with a few limitations that dedicated sandboxing tools typically do not have:

A standalone sandboxing tool is run from the outside, so once configured, it can be used with any AI coding agent.

Not all tools could be reviewed, such as OpenSandbox (originally from Alibaba). Raw bubblewrap (Linux) and Seatbelt (macOS) can also be used directly or with a simple wrapper script. These two are the building blocks behind several tools, but bubblewrap has no network filtering. The network is either fully open or fully off. Seatbelt, on the other hand supports network filtering. A few others are also worth mentioning:

With that in mind, let's now go through the 4 sandboxing tools we decided to evaluate in more depth: nono, Docker Sandboxes, Microsandbox and OpenShell.

nono uses OS-level sandboxing primitives like Landlock and seccomp on Linux, and Seatbelt on macOS, so the agent shares the host kernel. It's written in Rust and is open source. It doesn't require an account and it's made by the author of Sigstore, Luke Hinds, and his team at nolabs.

It starts instantly with literally no overhead. The documentation is excellent and you can tell it's made for running AI coding agents. They have an official packs registry where profiles for various popular coding agents can be downloaded from. One should note that since nono uses OS-level sandboxing, whatever agent you run inside it must be already installed on your host. So, for example you'll need to first install GitHub Copilot CLI to be able to run it with nono. If there's no pack for your agent or if it's not supported on your platform (for example, the official nono copilot-cli pack doesn't support Linux), you can create your own pack or profile to support it, which is what we did. Profiles are JSON files that describe your policy and they live in~/.config/nono/profiles on Linux. Most packs come with agent skills that tell the agent that they're running inside a sandbox. Indeed, without this, an agent may be confused when it hits a permission error when trying to read or write a file or make a network request. So this is a big plus.

Of course, nono supports filesystem restrictions. Read-write access to specific files or directories can be defined in a profile. It also supports filesystem snapshots and rollback. This is off by default but can be enabled just by passing the --rollback CLI flag. When enabled, nono keeps track of every filesystem change during the session, and in case the agent makes unwanted changes to the filesystem, it's then very easy to rollback to an earlier state with this feature. One downside which is actually a Landlock limitation is that it's not possible to deny a sub-directory of an allowed directory.

Nono allows filtering outgoing network traffic by domain name, IP or CIDR range. It also supports filtering traffic by HTTP method and endpoint, including globs. It also supports enterprise proxy passthrough and it prevents DNS rebinding attacks where a malicious DNS server resolves an allowed domain name to an internal IP address. The proxy sitting outside the sandbox first checks all resolved IP addresses against the policy before approving network traffic.

When nono exits, it suggests profile changes based on the network requests and filesystem accesses that were blocked during the session. This is the output after exiting GitHub Copilot CLI running in a nono sandbox:

╭─╮╭─╮ Changes +0 -0 ╰─╯╰─╯ AI Credits 7.8 (17s) █ ▘▝ █ Tokens ↑ 31.1k (31.1k written) • ↓ 31 ▔▔▔▔ Resume copilot --resume=fb4d1d58-5a2e-4093-9699-09fa7dfdaaa2

The command succeeded, but stderr showed a likely sandbox-related access issue.

Sandbox denial: /home/nils/.gitconfig (read+write) Try: --allow-file /home/nils/.gitconfig

Network denials were observed during this session: deny connect cafe.example.ghe.com:443 (host cafe.example.ghe.com:443 is not in the allowlist) deny connect copilot-telemetry-service.example.ghe.com:443 (host copilot-telemetry-service.example.ghe.com:443 is not in the allowlist)

To allow this traffic, re-run with: --allow-domain cafe.example.ghe.com --allow-domain copilot-telemetry-service.example.ghe.com

To grant additional access, re-run with: --allow <path> read+write access to directory --read <path> read-only access to directory --write <path> write-only access to directory

Next steps: Add permissions: nono run --allow <path> -- copilot Query policy: nono why --path <path> --op <read|write|readwrite> [nono] Review denied paths ↑/↓ move · Space cycle · a grant-all · d deny-all · Enter confirm · Esc cancel

▶ grant ⚠ ~/.ssh (read dirs) grant ~/.gitconfig (read+write files)

Here nono suggests granting access to ~/.ssh and ~/.gitconfig, which were blocked during the session when we tried to access them. Just by selecting an option and pressing Enter, nono directly edits the profile JSON file and adds the selected rule to be granted for future sessions, which is pretty convenient. Note that granting read access to ~/.ssh is a bad idea, though, and is only shown here to demonstrate the feature. Only grant more permissions if they are really needed.

Credential injection is where nono shines. It supports injecting secrets from various password vaults on the host, including 1Password, Bitwarden, environment variables and custom CLI commands. Credentials can be injected into various locations, including:

And the format of credential placeholders can be configured too. This is useful in situations where the agent requires the credential to be in a specific format to be able to login in the first place. For example, GitHub Copilot CLI requires the token to start with "gho". Otherwise, login will fail. Credentials can be scoped to a domain and endpoint, which is a plus.

One of the coolest features of nono is that, not only its proxy supports credential injection in the traditional direction, that means when the agent makes an outgoing request, but it also supports intercepting credentials that are returned in a network response from a server before passing them to the agent. Nono calls this Sandboxed OAuth Logins. This is super useful when you have to login for the first time with your agent. Typically you would have to type /login from inside the sandbox, and if the sandbox doesn't do anything special, you'll end up with credentials stored inside of the sandbox after doing /login. But nono can actually intercept this process and securely store the obtained credentials outside of the sandbox, only store a placeholder inside the sandbox, in the format configured, and inject the actual secret when future traffic goes out. This is one of the killer features a sandbox designed to be used with AI coding agents should have. We actually got this setup for GitHub Copilot CLI and made it work with a GitHub Copilot Business account. It worked with the OAuth device code flow.

To run GitHub Copilot CLI with nono with a custom profile called copilot-custom and allow read/write to the current directory:

nono run --profile copilot-custom --allow-cwd -- copilot

Here's the stripped JSON nono profile we used to make that work with only the relevant pieces:

{ "extends": null, "meta": { "name": "copilot", "version": "1.0.0", "description": "Copilot CLI profile with example.ghe.com /login support", "author": null }, "network": { "block": false, "allow_domain": [ "example.ghe.com", "copilot-api.example.ghe.com", "api.github.com", "api.githubcopilot.com", ], }, "credential_providers": { "github_copilot_ghe": { "type": "oauth_capture", "token_endpoints": [ { "host": "https://example.ghe.com", "path": "/login/device/code", "response_fields": [ { "path": "access_token", "kind": "opaque" }, { "path": "refresh_token", "kind": "opaque" }, { "path": "id_token", "kind": "opaque" } ], "request_body": "auto", "request_nonce_fields": [ "refresh_token" ] }, { "host": "https://example.ghe.com", "path": "/login/oauth/access_token", "response_fields": [ { "path": "access_token", "kind": "opaque", "format": "gho_deadbeef{}" }, { "path": "refresh_token", "kind": "opaque" } ], "request_body": "auto", "request_nonce_fields": [ "refresh_token" ] } ], "api_hosts": [ "https://api.example.ghe.com", "https://copilot-api.example.ghe.com", ], "inject_header": null, "credential_format": null, "credential_store": { "type": "file_json", "path": "~/.github-copilot-ghe/auth.json", "phantom_fields": [ "tokens.access_token", "tokens.refresh_token" ] } "helpers": null } }, "credential_routes": [ { "name": "github_copilot_ghe_oauth", "provider": "github_copilot_ghe", "env_var": null, "base_url_env_var": null, "endpoint_policy": null, "upgrades": [] } ], }

‍ In terms of resource usage limitations, nono supports memory and max process count.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →