Commit 400c94e
feat(v1): DockerConfig.network_access to block the workload's internet
Adds `network_access: bool = True` to DockerConfig (mirroring prime/modal, so
`--harness.runtime.network-access false` now works uniformly across all three
runtimes). When false, the container's DNS resolver is disabled so every
hostname-based fetch (pip install, git clone, curl <host>) fails — while the
interception model tunnel keeps working, because it egresses from the HOST, not
the container: the container only reaches host.docker.internal / host loopback,
which needs no DNS.
Platform-specific (matching the existing host_url() split):
- Docker Desktop (macOS/Windows): drop --network host for the bridge, add
--dns 0.0.0.0 and --add-host=host.docker.internal:host-gateway (host route
pinned in /etc/hosts, resolves without DNS).
- Linux: keep --network host (interception is reachable at 127.0.0.1) and add
--dns 0.0.0.0. --dns writes a container-private resolv.conf, so the host's own
DNS is untouched.
A DNS-level block, not an IP-level airgap: a hardcoded raw IP could still egress;
use an iptables egress allowlist if that matters.
Verified end-to-end: a local-docker eval with --harness.runtime.network-access
false solves a task (reward 1.0, 59 model calls over the tunnel) while pip/git to
public hosts fail from inside the container.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 13eed1f commit 400c94e
2 files changed
Lines changed: 65 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
98 | 105 | | |
99 | 106 | | |
100 | 107 | | |
101 | | - | |
102 | | - | |
| 108 | + | |
103 | 109 | | |
104 | 110 | | |
105 | 111 | | |
| |||
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
118 | | - | |
| 124 | + | |
119 | 125 | | |
120 | 126 | | |
| 127 | + | |
121 | 128 | | |
122 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
123 | 145 | | |
124 | 146 | | |
125 | 147 | | |
| |||
0 commit comments