Default task containers join the daemon's network instead of a sandbox bridge #1867

Closed
opened 2026-11-12 09:35:04 +00:00 by sam · 4 comments
Owner

Problem

Pool.Acquire puts a default-path task container on the daemon's own Docker network, or the configured one. That network is not internal, so the container can reach NATS, the other compose services, the host bridge and the internet directly. Model calls are routed through the egress proxy by environment variables, but nothing stops a process from ignoring them. Kit tasks already run on an internal bridge with no host address, where the egress relay is the only reachable endpoint.

Wanted

Every task container runs on its own internal sandbox bridge and reaches the egress proxy, NATS and the State Store only through the relay. Which code survives depends on #1865.

Done when

  • A default-path task container cannot open a connection to anything but the relay's three ports.
  • Model calls still work through the proxy.
  • Test covering the network the container is attached to (security boundary per CLAUDE.md).
## Problem `Pool.Acquire` puts a default-path task container on the daemon's own Docker network, or the configured one. That network is not internal, so the container can reach NATS, the other compose services, the host bridge and the internet directly. Model calls are routed through the egress proxy by environment variables, but nothing stops a process from ignoring them. Kit tasks already run on an internal bridge with no host address, where the egress relay is the only reachable endpoint. ## Wanted Every task container runs on its own internal sandbox bridge and reaches the egress proxy, NATS and the State Store only through the relay. Which code survives depends on #1865. ## Done when - A default-path task container cannot open a connection to anything but the relay's three ports. - Model calls still work through the proxy. - Test covering the network the container is attached to (security boundary per CLAUDE.md).
Author
Owner

Context I missed when filing: the external-agent-harness PRD (Egress section) keeps image profiles off the proxied path on purpose, because workflows such as the network investigator need raw DNS, ICMP and arbitrary TCP. So the fix is not "put every container on the sandbox bridge". It is to enforce the identity's network grants for image profiles, which today are not enforced at the container: the container joins the daemon's network, which also reaches NATS, the State Store and sibling services. Scope this issue to that gap.


Generated by Claude Code

Context I missed when filing: the external-agent-harness PRD (Egress section) keeps image profiles off the proxied path on purpose, because workflows such as the network investigator need raw DNS, ICMP and arbitrary TCP. So the fix is not "put every container on the sandbox bridge". It is to enforce the identity's network grants for image profiles, which today are not enforced at the container: the container joins the daemon's network, which also reaches NATS, the State Store and sibling services. Scope this issue to that gap. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

Scope after #1877 (Kit deleted): default tasks move onto the internal sandbox network behind the egress relay, containerEnv points at the relay ports, and the in-process stateStoreRelay is deleted (was #1870). Image-profile workflows that need raw network access get it as an explicit per-profile grant rather than by default.


Generated by Claude Code

Scope after #1877 (Kit deleted): default tasks move onto the internal sandbox network behind the egress relay, `containerEnv` points at the relay ports, and the in-process `stateStoreRelay` is deleted (was #1870). Image-profile workflows that need raw network access get it as an explicit per-profile grant rather than by default. --- _Generated by [Claude Code](https://claude.ai/code)_
sam added a new dependency 2026-11-12 09:54:06 +00:00
sam added the highbug labels 2026-11-12 15:51:30 +00:00
Author
Owner

Fixed in e7d3ed72. Each task container gets its own internal bridge (no host address), shared only with the egress relay. Boot sweeps leftover sandbox networks and starts the relay, which forwards :3128 to the model proxy, :4222 to NATS and :50051 to the State Store (a loopback State Store goes to the host gateway). Workers get the relay addresses via WorkerEnv, and model calls use archie-egress:3128. The network is removed with the task. The per-task State Store relay on the host bridge is gone.

Verified: task check passes. A fake-Engine test asserts the container attaches only to its sandbox network and that the network is removed on release and after a failed start; it fails if either is reverted. A table test covers the loopback State Store rewrite.

Not yet verified: a live run with Docker. Done-when still needs: a task container cannot connect to anything except the relay's three ports, and model calls work through the proxy.

Follow-ups: #1967 (allowlisted egress for remote MCP and package registries), #1968 (per-profile network grant), #1969 (containers.network now needs a restart).

Fixed in e7d3ed72. Each task container gets its own internal bridge (no host address), shared only with the egress relay. Boot sweeps leftover sandbox networks and starts the relay, which forwards :3128 to the model proxy, :4222 to NATS and :50051 to the State Store (a loopback State Store goes to the host gateway). Workers get the relay addresses via WorkerEnv, and model calls use archie-egress:3128. The network is removed with the task. The per-task State Store relay on the host bridge is gone. Verified: task check passes. A fake-Engine test asserts the container attaches only to its sandbox network and that the network is removed on release and after a failed start; it fails if either is reverted. A table test covers the loopback State Store rewrite. Not yet verified: a live run with Docker. Done-when still needs: a task container cannot connect to anything except the relay's three ports, and model calls work through the proxy. Follow-ups: #1967 (allowlisted egress for remote MCP and package registries), #1968 (per-profile network grant), #1969 (containers.network now needs a restart).
Author
Owner

Already fixed by e7d3ed72e: each task container joins its own internal network (internal/infrastructure/egress/networks.go:128, Internal: true), and TestTaskContainerRunsOnItsOwnSandboxNetwork (internal/container/sandbox_test.go:43) guards that attachment.

Already fixed by e7d3ed72e: each task container joins its own internal network (internal/infrastructure/egress/networks.go:128, Internal: true), and TestTaskContainerRunsOnItsOwnSandboxNetwork (internal/container/sandbox_test.go:43) guards that attachment.
sam closed this issue 2026-11-14 04:31:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1867