@namzu/sandbox 15.0.0 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +324 -0
  2. package/README.md +223 -0
  3. package/dist/backends/aci-standby-pool/index.d.ts +22 -4
  4. package/dist/backends/aci-standby-pool/index.d.ts.map +1 -1
  5. package/dist/backends/aci-standby-pool/index.js +31 -7
  6. package/dist/backends/aci-standby-pool/index.js.map +1 -1
  7. package/dist/backends/docker/index.d.ts +408 -26
  8. package/dist/backends/docker/index.d.ts.map +1 -1
  9. package/dist/backends/docker/index.js +1173 -168
  10. package/dist/backends/docker/index.js.map +1 -1
  11. package/dist/backends/firecracker/transport.d.ts +156 -1
  12. package/dist/backends/firecracker/transport.d.ts.map +1 -1
  13. package/dist/backends/firecracker/transport.js +223 -29
  14. package/dist/backends/firecracker/transport.js.map +1 -1
  15. package/dist/backends/http-worker-client.d.ts +64 -2
  16. package/dist/backends/http-worker-client.d.ts.map +1 -1
  17. package/dist/backends/http-worker-client.js +78 -7
  18. package/dist/backends/http-worker-client.js.map +1 -1
  19. package/dist/backends/kubernetes/egress-policy.d.ts +193 -102
  20. package/dist/backends/kubernetes/egress-policy.d.ts.map +1 -1
  21. package/dist/backends/kubernetes/egress-policy.js +321 -146
  22. package/dist/backends/kubernetes/egress-policy.js.map +1 -1
  23. package/dist/backends/kubernetes/per-sandbox-policy.d.ts +6 -6
  24. package/dist/backends/kubernetes/per-sandbox-policy.d.ts.map +1 -1
  25. package/dist/backends/kubernetes/per-sandbox-policy.js +21 -53
  26. package/dist/backends/kubernetes/per-sandbox-policy.js.map +1 -1
  27. package/dist/backends/kubernetes/transport.d.ts +7 -0
  28. package/dist/backends/kubernetes/transport.d.ts.map +1 -1
  29. package/dist/backends/kubernetes/transport.js.map +1 -1
  30. package/dist/egress/proxy.d.ts +47 -2
  31. package/dist/egress/proxy.d.ts.map +1 -1
  32. package/dist/egress/proxy.js +31 -7
  33. package/dist/egress/proxy.js.map +1 -1
  34. package/dist/index.d.ts +130 -6
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +55 -5
  37. package/dist/index.js.map +1 -1
  38. package/package.json +4 -4
  39. package/src/backends/aci-standby-pool/index.ts +37 -7
  40. package/src/backends/docker/index.ts +1475 -196
  41. package/src/backends/firecracker/transport.ts +387 -36
  42. package/src/backends/http-worker-client.ts +89 -5
  43. package/src/backends/kubernetes/egress-policy.ts +455 -187
  44. package/src/backends/kubernetes/per-sandbox-policy.ts +21 -66
  45. package/src/backends/kubernetes/transport.ts +7 -0
  46. package/src/egress/proxy.ts +65 -8
  47. package/src/index.ts +162 -5
@@ -39,8 +39,8 @@
39
39
  * a pool-side knob, not a backend knob — the backend never
40
40
  * chooses; it just PUTs against whichever pool the caller named.
41
41
  */
42
- import { generateSandboxId, walkFilesViaExec } from '@namzu/sdk';
43
- import { HttpWorkerClient } from '../http-worker-client.js';
42
+ import { generateSandboxId, walkFilesViaExec, withHint } from '@namzu/sdk';
43
+ import { HttpWorkerClient, STANDBY_POOL_UNAUTHORIZED_HINT } from '../http-worker-client.js';
44
44
  import { OperationDeadline, OperationDeadlineExpired, probeHttpHealth, resolveReadinessOptions, runFailureCleanup, } from '../readiness.js';
45
45
  import { RemoteCancellationUnknownError, RemoteProtocolError, } from '../remote-execution-controller.js';
46
46
  const DEFAULT_READY_POLL_MS = 500;
@@ -226,10 +226,28 @@ export function assertEnforceable(options) {
226
226
  * so nothing looks wrong. A caller who never heard of `subnetId` gets a
227
227
  * working sandbox on the internet and no signal at all.
228
228
  *
229
- * What is on that address matters: `worker/server.js` states "Authn: none"
230
- * in its own docblock and binds every interface. Inside a private network
231
- * that is the boundary doing the work. With a public address there is no
232
- * boundary left, and the worker's `/execute` is reachable by anyone.
229
+ * What is on that address matters: `worker/server.js` binds every interface
230
+ * and, inside a private network, that was the boundary doing the work — the
231
+ * worker authenticated nobody. With a public address there is no boundary
232
+ * left, and the worker's `/execute` is reachable by anyone.
233
+ *
234
+ * The worker now requires a per-instance `Authorization: Bearer` token on
235
+ * every route but `/healthz`, and REFUSES TO START on a routable bind when
236
+ * it has none. This backend cannot supply one, and the reason this comment
237
+ * used to give for that was wrong: it said the claim API's single admitted
238
+ * override — a config map — is no channel into the container group. It is
239
+ * one, on Linux a file mount under `/mnt/configmap/<containername>/<key>`
240
+ * carrying caller-supplied per-claim values. The credential is declined
241
+ * anyway, for two reasons that survive their source: the worker reads its
242
+ * token from `process.env` at startup and never looks for a file, so a
243
+ * mounted value is not read; and Microsoft's own guidance is that config
244
+ * map values are not validated by the runtime and that values affecting
245
+ * application security "should be made available to the container using
246
+ * environment variables". The full answer, and the change that would close
247
+ * the gap, is in `docs/sdk/container-sandbox-worker.md`. What that means
248
+ * for an operator is written down there too, rather than left to be
249
+ * discovered at startup; this refusal is unchanged, and now stands in
250
+ * front of a worker that would refuse the routable case itself.
233
251
  *
234
252
  * Defaulting to refusal rather than to a warning, because a warning on a
235
253
  * path that otherwise succeeds is read once and never again.
@@ -239,7 +257,7 @@ export function assertNotPubliclyAddressed(config) {
239
257
  return;
240
258
  if (config.allowPublicAddress)
241
259
  return;
242
- throw new Error('The standby-pool sandbox backend will not claim a container group without `subnetId`: with no subnet the platform assigns a public address, and the worker on it has no authentication of any kind, so its execute endpoint would be reachable from the internet. Supply `subnetId` to inject the group into a private network, or set `allowPublicAddress: true` if this is a benchmark and you mean it.');
260
+ throw new Error('The standby-pool sandbox backend will not claim a container group without `subnetId`: with no subnet the platform assigns a public address, so the group is reachable by anything that can route to it, and this backend has no credential to put in front of that. A worker with no token refuses to start on a routable bind at all, and a worker that has one is only as strong as its transport — plain HTTP, where a bearer token is replayable by anything on the path. Supply `subnetId` to inject the group into a private network, or set `allowPublicAddress: true` if this is a benchmark and you mean it.');
243
261
  }
244
262
  async function spawnAciSandbox(config, options, readiness) {
245
263
  options.signal?.throwIfAborted();
@@ -407,6 +425,9 @@ async function spawnAciSandbox(config, options, readiness) {
407
425
  encoding: 'base64',
408
426
  }),
409
427
  });
428
+ if (res.status === 401) {
429
+ throw withHint(new Error(`write-file failed: HTTP 401 ${await res.text()}`), STANDBY_POOL_UNAUTHORIZED_HINT);
430
+ }
410
431
  if (!res.ok) {
411
432
  throw new Error(`write-file failed: HTTP ${res.status} ${await res.text()}`);
412
433
  }
@@ -430,6 +451,9 @@ async function spawnAciSandbox(config, options, readiness) {
430
451
  body: JSON.stringify({ path, encoding: 'base64' }),
431
452
  signal: options?.signal,
432
453
  });
454
+ if (res.status === 401) {
455
+ throw withHint(new Error(`read-file failed: HTTP 401 ${await res.text()}`), STANDBY_POOL_UNAUTHORIZED_HINT);
456
+ }
433
457
  if (!res.ok) {
434
458
  throw new Error(`read-file failed: HTTP ${res.status} ${await res.text()}`);
435
459
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/backends/aci-standby-pool/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAeH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAGhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EACN,iBAAiB,EACjB,wBAAwB,EACxB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,GACjB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACN,8BAA8B,EAC9B,mBAAmB,GACnB,MAAM,mCAAmC,CAAA;AA+E1C,MAAM,qBAAqB,GAAG,GAAG,CAAA;AACjC,MAAM,wBAAwB,GAAG,MAAM,CAAA;AACvC,MAAM,mBAAmB,GAAG,IAAI,CAAA;AAChC,MAAM,uBAAuB,GAAG,oBAAoB,CAAA;AACpD,MAAM,QAAQ,GAAG,8BAA8B,CAAA;AAC/C,MAAM,6BAA6B,GAAG,YAAY,CAAA;AAElD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACzC,MAA2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,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;QAClC,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACxD,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,SAAQ;QAC7C,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IAC7B,CAAC;IACD,OAAO,OAAO,CAAA;AACf,CAAC"}
@@ -14,15 +14,35 @@
14
14
  * Trust model:
15
15
  * - Container is the trust boundary; everything inside is treated
16
16
  * as untrusted code.
17
- * - Worker only listens on loopback inside its own netns; the
18
- * host adapter reaches it via Docker's port-forward.
19
- * - Outbound network from the worker is restricted by host-side
20
- * firewall config (see {@link DockerBackendConfig.network}) plus
21
- * the egress proxy when one is configured (P3.2).
17
+ * - Every call to the worker's control API carries the per-instance
18
+ * `NAMZU_SANDBOX_TOKEN` this backend mints at create time and
19
+ * injects into the container's environment; a worker the host did
20
+ * not create must be provisioned with its own. The worker requires
21
+ * it on every route but `/healthz`, and refuses to start at all if
22
+ * it has none and is bound to anything routable.
23
+ * - Outbound network from the worker is restricted by the network
24
+ * it is attached to (see {@link DockerBackendConfig.network}) and,
25
+ * for a host allowlist, by an egress proxy running as a sibling
26
+ * container on that same network — the only way its traffic reaches
27
+ * the internet, because the network is `--internal` and has no route
28
+ * off it. The proxy is a container on that subnet like any other, so
29
+ * it is not the sandbox's only reachable destination. The proxy
30
+ * environment the sandbox is given directs traffic; the topology is
31
+ * what confines it. See {@link assertNetworkCarriesThePolicy} and
32
+ * #398.
33
+ *
34
+ * The credential above is what a previous version of this docblock
35
+ * claimed network placement alone provided. It said the worker "only
36
+ * listens on loopback inside its own netns", which is false — the worker
37
+ * binds every interface by default and has to, because a published
38
+ * container port forwards to the container's interface address rather
39
+ * than to its loopback, so a loopback-bound worker is unreachable through
40
+ * the port this backend publishes. The boundary was the network the
41
+ * container is attached to, and wanted a credential behind it.
22
42
  */
23
43
  import { type ContainerSandboxLayout, type ResolvedContainerSandboxLayout } from '@namzu/sdk';
24
- import type { BrokeredCredential, EgressProxyOptions } from '../../egress/index.js';
25
- import { type EgressPolicy, type SandboxBackend } from '../../index.js';
44
+ import type { BrokeredCredential } from '../../egress/index.js';
45
+ import { type EgressPolicy, type SandboxBackend, type SandboxBackendOptions } from '../../index.js';
26
46
  /**
27
47
  * Backend-specific tuning. Most hosts use the defaults; advanced
28
48
  * deployments override `image` to point at their own pre-built
@@ -47,13 +67,66 @@ export interface DockerBackendInternalConfig {
47
67
  /**
48
68
  * `--user` value for the container, e.g. `'1000:1000'` or `'nobody'`.
49
69
  *
50
- * Left unset by default because the correct uid depends on the image's
51
- * own filesystem ownership, and forcing one would break every image
52
- * that expects root at startup. Set it whenever the image supports a
53
- * non-root user — a container running as root is one bind-mount
54
- * misconfiguration away from writing the host.
70
+ * Left unset by default because `--user` does not ADD a non-root user, it
71
+ * OVERRIDES the image's own choice of one. The reference image ends with
72
+ * `USER namzu` (uid 1001, its `/workspace` chowned to match), so this
73
+ * backend's default is already non-root for the image it ships — a
74
+ * hard-coded uid here would replace that with a guess, and the guess is
75
+ * wrong for any image whose files are owned by someone else, which
76
+ * surfaces as `EACCES` on a path the workload was told it could write.
77
+ * Set it when the image does not declare a user of its own, or when the
78
+ * host wants a different one than it declares.
55
79
  */
56
80
  readonly runAsUser?: string;
81
+ /**
82
+ * CPU cores the container may use, rendered as `--cpus`. Unset by default.
83
+ *
84
+ * `--memory` and `--pids-limit` bound what a workload can take from the
85
+ * host, and CPU had no equivalent at all — no default, no knob — which
86
+ * reads as an oversight rather than a decision. It stays unset for the
87
+ * same reason neither of those two has a numeric default: the right value
88
+ * is a property of the host's machine and of what the workload is for, and
89
+ * any number this backend picked would silently throttle a run that
90
+ * finishes inside its timeout today. A host that wants the bound says what
91
+ * it is; the value is a decimal (`--cpus 1.5` is one and a half cores'
92
+ * worth of time, not a rounding).
93
+ *
94
+ * It lives on this config rather than beside `memoryLimitMb` on the
95
+ * per-call options because the documented deployment constructs one
96
+ * provider per task, so construction time IS per-task — and a control
97
+ * added to the tier-agnostic per-call shape would have to be refused by
98
+ * the ACI and kubernetes backends, which cannot apply a per-sandbox CPU
99
+ * limit any more than they can apply the memory and process ones.
100
+ */
101
+ readonly cpuLimit?: number;
102
+ /**
103
+ * Mount the container's root filesystem read-only. Default `true`.
104
+ *
105
+ * See {@link HARDENING_ARGS} for why the default is on and
106
+ * {@link renderWritableRootfsArgs} for the paths that stay writable while
107
+ * it is. Set it to `false` to make every path inside the container
108
+ * writable again, which is what a host whose image writes somewhere the
109
+ * writable set cannot describe needs, and which is why the switch exists
110
+ * instead of an unwritten rule that the baseline is absolute. It turns off
111
+ * that one control and nothing else: `--cap-drop=ALL`,
112
+ * `--security-opt=no-new-privileges` and `--ipc private` are applied
113
+ * whatever this says. It is a config field rather than an argument so that
114
+ * turning it off is a line somebody wrote on purpose, and not the default
115
+ * anyone gets by not looking.
116
+ */
117
+ readonly readOnlyRootfs?: boolean;
118
+ /**
119
+ * Extra paths to keep writable under `--read-only`, each mounted `--tmpfs`.
120
+ *
121
+ * The default set ({@link DEFAULT_WRITABLE_ROOTFS_PATHS}) is the reference
122
+ * image's needs, read off its Dockerfile; this is how a host that points
123
+ * `image` somewhere else says what ITS image needs, because the backend
124
+ * cannot read that out of an image and guessing is what these paths would
125
+ * otherwise be. A path the layout already mounts is refused rather than
126
+ * mounted twice (`Duplicate mount point`), and setting this at all beside
127
+ * `readOnlyRootfs: false` is refused as a contradiction.
128
+ */
129
+ readonly writableRootfsPaths?: readonly string[];
57
130
  /**
58
131
  * Credentials the egress proxy stamps on, per host.
59
132
  *
@@ -80,6 +153,53 @@ export interface DockerBackendInternalConfig {
80
153
  * is the hole the screen exists to close.
81
154
  */
82
155
  readonly allowInwardFor?: readonly string[];
156
+ /**
157
+ * Image the egress proxy runs as, when the policy needs one.
158
+ *
159
+ * A host allowlist (`static` or `resolver`) is enforced by a proxy, and
160
+ * this backend no longer runs that proxy in its own process: it runs it as
161
+ * a sibling container, dual-homed between the sandbox's `--internal`
162
+ * network (where the sandbox can reach it, and nothing else) and an
163
+ * ordinary bridge (where it reaches the internet). See
164
+ * {@link renderEgressProxyRunArgs} for the argv and
165
+ * `egress-proxy/Dockerfile` for the image to build.
166
+ *
167
+ * It is a second image rather than a reuse of `image` on purpose, and the
168
+ * reason is deployment-shaped rather than hygienic: the sandbox image is a
169
+ * host-supplied string that this backend cannot read, so there is no way to
170
+ * know whether the image named there has the proxy module in it, and the
171
+ * bind-mount alternative breaks exactly on the remote-daemon deployment
172
+ * (`hostReachability: 'container-network'`) where the SDK's own filesystem
173
+ * is not the daemon's.
174
+ *
175
+ * Unset, an allowlist policy is REFUSED at `create()` rather than
176
+ * downgraded — the same rule the rest of this file applies to a policy it
177
+ * cannot enforce. `deny-all` and `allow-all` need no image.
178
+ */
179
+ readonly egressProxyImage?: string;
180
+ /**
181
+ * Network the egress proxy joins for its route to the internet. Default
182
+ * `'bridge'`, docker's own default bridge.
183
+ *
184
+ * This is the proxy's second leg, and it exists because the internal
185
+ * network the sandbox sits on has no route out by design. `'bridge'` is
186
+ * the default because it always exists and always has NAT, which keeps a
187
+ * host's first allowlist policy working without a second network to
188
+ * create.
189
+ *
190
+ * **The default is also the one wart of this topology, and a host that
191
+ * shares a docker daemon should know it.** The proxy listens on every
192
+ * interface inside its own container, so any other container attached to
193
+ * the same network reaches it too — and this proxy enforces its allowlist
194
+ * for whoever asks and stamps brokered credentials on the requests it
195
+ * forwards. On `'bridge'` that means every container on the host's default
196
+ * bridge. Name a dedicated network here (one only this deployment's
197
+ * containers join) to decide who that is. There is deliberately no switch
198
+ * that narrows the listener instead: the container has no way to know
199
+ * which of its own interfaces is which, and a listener bound to the wrong
200
+ * one is a sandbox with no route out at all.
201
+ */
202
+ readonly egressProxyUpstreamNetwork?: string;
83
203
  readonly network?: 'none' | 'bridge' | string;
84
204
  readonly readyPollIntervalMs?: number;
85
205
  readonly readyTimeoutMs?: number;
@@ -120,6 +240,12 @@ export interface DockerBackendInternalConfig {
120
240
  * monitoring filters) via `docker ps --filter label=…`. Keys
121
241
  * containing `=` or empty names throw at spawn time — the docker
122
242
  * CLI accepts them but the resulting label split is ambiguous.
243
+ *
244
+ * They are applied to the egress proxy's container too, when one runs.
245
+ * That is deliberate in both directions: a reaper that collects a
246
+ * sandbox's containers should collect the proxy with them, and a proxy
247
+ * left running by a sandbox that died is a container holding real
248
+ * credentials with a route to the internet.
123
249
  */
124
250
  readonly labels?: Readonly<Record<string, string>>;
125
251
  }
@@ -145,6 +271,14 @@ export declare function buildDockerBackend(config: DockerBackendInternalConfig):
145
271
  * just the way out. It now keeps the configured network, and
146
272
  * {@link assertNetworkCarriesThePolicy} is what makes that network a
147
273
  * boundary.
274
+ *
275
+ * Every policy that returns the configured network depends on that same
276
+ * assertion, which is why the two live side by side: this function says which
277
+ * network the container joins, and that one refuses the network if it cannot
278
+ * do what the policy asks of it (#398). An allowlist used to answer the
279
+ * configured network and get a proxy environment variable pointed at a
280
+ * host-side listener — enforcement by convention, which an uncooperative
281
+ * process simply ignores.
148
282
  */
149
283
  export declare function resolveNetwork(configured: string, egress: EgressPolicy | undefined, hasProxy?: boolean): string;
150
284
  /**
@@ -171,9 +305,9 @@ export declare function isInternalNetwork(inspectedInternalFlag: string): boolea
171
305
  /**
172
306
  * Refuse a container whose network cannot do what was asked of it.
173
307
  *
174
- * Two requirements meet on the same object here, and both were previously
175
- * unstated — which is how the backend came to ship a default configuration
176
- * that could not create a sandbox at all:
308
+ * Three requirements meet on the same object here, and the first two were
309
+ * previously unstated — which is how the backend came to ship a default
310
+ * configuration that could not create a sandbox at all:
177
311
  *
178
312
  * - **A published host port needs a route out.** Docker binds the port by
179
313
  * NAT to the container's address, so a container with no address gets no
@@ -189,24 +323,272 @@ export declare function isInternalNetwork(inspectedInternalFlag: string): boolea
189
323
  * nothing. `deny-all` pointed at the default bridge would be full egress
190
324
  * under a policy object claiming none — the "accepted and silently
191
325
  * ignored" failure the rest of this file exists to refuse.
326
+ * - **A host allowlist needs one too, for the same reason and with one
327
+ * addition.** Until #398 the allowlist tier answered the configured
328
+ * network and pointed the sandbox at a proxy running on the host's
329
+ * loopback, and the only thing making traffic go through it was
330
+ * `HTTP_PROXY`. That is a request, not a boundary: anything inside the
331
+ * container that opens a socket directly reaches the network with the
332
+ * allowlist unconsulted, and untrusted code is the caller least likely to
333
+ * honour a convention. With the proxy as a sibling container on an
334
+ * `--internal` network, the only way the sandbox's traffic reaches the
335
+ * internet is that container, and it cannot change that because
336
+ * `--cap-drop=ALL` took `NET_ADMIN` away (see {@link HARDENING_ARGS}). The
337
+ * environment variables stay and now DIRECT traffic rather than permit it.
338
+ * On a network that is not internal there is no such route to remove, and
339
+ * the policy is back to being advisory — which is what this refuses.
192
340
  *
193
- * They are exact opposites, so `deny-all` over a published host port is
194
- * impossible rather than merely unsupported: no arrangement of docker
341
+ * The first two are exact opposites, so `deny-all` over a published host port
342
+ * is impossible rather than merely unsupported: no arrangement of docker
195
343
  * networking both denies all egress and lets the host reach the worker over
196
- * TCP. Closing that needs the control channel moved off TCP — see #398 —
197
- * and is not a flag this function could accept.
344
+ * TCP. Closing that needs the control channel moved off TCP — see #398 — and
345
+ * is not a flag this function could accept. The same opposition now reaches
346
+ * an allowlist policy, which is new: an allowlist on an internal network must
347
+ * be reached by container name, so a host that used a published port with a
348
+ * host allowlist has to move that consumer onto the internal network. That is
349
+ * a consequence of the boundary existing at all and not a gap in this
350
+ * function; the refusal below names the mode to move to.
198
351
  */
199
352
  export declare function assertNetworkCarriesThePolicy(network: string, reachability: 'host-port' | 'container-network', egress: EgressPolicy | undefined, inspectedInternalFlag: string): void;
200
353
  /**
201
- * The options the boundary is built from, as a value.
354
+ * What the proxy container is told, as a value.
355
+ *
356
+ * The boundary's whole configuration. It is a value for the reason
357
+ * {@link resolveNetwork} is one: everything downstream of here needs a running
358
+ * Docker daemon, so a credential that failed to reach the boundary could only
359
+ * be caught by an operator noticing their requests arrive unauthenticated in
360
+ * production. A knob a host sets and the boundary never receives is the
361
+ * failure this shape exists to make testable.
362
+ *
363
+ * `parseProxyConfig` in `egress-proxy/server.mjs` refuses every shape in here
364
+ * it cannot read — and this function's own output is fed to that parser by
365
+ * `__tests__/hardening.test.ts`, so the two ends are pinned against each other
366
+ * rather than each against its own idea of the shape. A field renamed on one
367
+ * side alone fails a test rather than starting a boundary that enforces
368
+ * something nobody wrote.
369
+ */
370
+ export interface EgressProxyContainerConfig {
371
+ readonly port: number;
372
+ readonly allowedHosts: readonly string[];
373
+ readonly credentials: readonly BrokeredCredential[];
374
+ readonly allowInwardFor?: readonly string[];
375
+ /**
376
+ * Names that denote the proxy itself, for its loop guard. The container's
377
+ * own hostname is added to this by the entrypoint; this field carries the
378
+ * network alias, which is the name the sandbox actually dials.
379
+ */
380
+ readonly selfNames?: readonly string[];
381
+ }
382
+ /**
383
+ * Build the proxy container's configuration.
384
+ *
385
+ * `allowedHosts` is already resolved here rather than passed as a policy, and
386
+ * that is the one behavioural difference this change carries into the
387
+ * boundary: the in-process proxy called the host's resolver per request, and
388
+ * the container cannot. A `resolver` policy that rotates is honoured at
389
+ * `create()` and again at every `setNetworkPolicy()` — the container has no
390
+ * channel back to the host's resolver, and a channel the container CAN reach
391
+ * is one the sandbox can reach too, which would let the sandbox ask for its
392
+ * own allowlist to be widened. See `docs/sdk/sandbox-egress.md`.
393
+ */
394
+ export declare function egressProxyContainerConfig(config: Pick<DockerBackendInternalConfig, 'brokeredCredentials' | 'allowInwardFor'>, allowedHosts: readonly string[], port: number): EgressProxyContainerConfig;
395
+ /** Everything {@link renderEgressProxyRunArgs} renders, as a value. */
396
+ export interface EgressProxyArgvInput {
397
+ readonly config: DockerBackendInternalConfig;
398
+ readonly containerName: string;
399
+ /** Network the proxy reaches the internet through. See `egressProxyUpstreamNetwork`. */
400
+ readonly upstreamNetwork: string;
401
+ /** The internal network the sandbox is on, which the proxy is also joined to. */
402
+ readonly internalNetwork: string;
403
+ }
404
+ /**
405
+ * The `docker run` argv for the egress proxy container, as a value.
406
+ *
407
+ * Extracted for the reason every other argv in this file is: nothing
408
+ * downstream of it can run without a docker daemon, so a flag that never
409
+ * reached it — or a `--network` that named the wrong side of a dual-homed
410
+ * container — could only be caught by an operator in production, where the
411
+ * symptom is a sandbox that reaches nothing.
412
+ *
413
+ * The two networks are the whole topology and they are two calls:
414
+ * `docker run --network <upstream>` gives the container a default route, and
415
+ * {@link renderEgressProxyAttachArgs}'s `docker network connect` adds the
416
+ * internal network afterwards. The order is load-bearing. Attached to the
417
+ * internal network FIRST it would come up with no default route and no way to
418
+ * acquire one, and the proxy would be a boundary in front of nothing.
419
+ *
420
+ * The hardening baseline is the sandbox's, minus the parts that describe a
421
+ * filesystem. `--cap-drop=ALL`, `--no-new-privileges` and `--ipc private` are
422
+ * applied exactly as {@link HARDENING_ARGS} defines them, because this
423
+ * container sits between untrusted code and the internet and is the last one in
424
+ * the deployment that should be holding a capability. `--read-only` is the
425
+ * sandbox's too, with one tmpfs: the proxy writes nothing, and the tmpfs is
426
+ * there so that a Node process which one day wants a temp file fails at a
427
+ * filesystem boundary rather than at a mysterious `EROFS`.
428
+ *
429
+ * The image is last, so nothing after it is read as a flag — the same rule the
430
+ * sandbox argv follows, and here it also means the image's own `CMD` starts the
431
+ * proxy rather than this argv naming an entrypoint.
432
+ */
433
+ export declare function renderEgressProxyRunArgs(input: EgressProxyArgvInput): string[];
434
+ /**
435
+ * The `docker network connect` argv that makes the proxy dual-homed.
436
+ *
437
+ * `--alias` is what puts `namzu-egress` in the internal network's DNS, which
438
+ * is the name {@link buildDockerRunArgs} hands the sandbox in its proxy
439
+ * environment. The alias rather than the container name because the alias is
440
+ * the constant: a container named `namzu-egress-<sandbox-id>` would otherwise
441
+ * make the sandbox's `HTTP_PROXY` value depend on a generated id, and the two
442
+ * would have to be kept in step by hand.
443
+ */
444
+ export declare function renderEgressProxyAttachArgs(input: EgressProxyArgvInput): string[];
445
+ /** The backend config the hardening flags are rendered from. */
446
+ export type DockerHardeningConfig = Pick<DockerBackendInternalConfig, 'cpuLimit' | 'layout' | 'readOnlyRootfs' | 'writableRootfsPaths'>;
447
+ /**
448
+ * Refuse rootfs options that cannot both be honoured.
449
+ *
450
+ * `writableRootfsPaths` beside `readOnlyRootfs: false` is a contradiction: with
451
+ * a writable root filesystem every path is already writable, so the tmpfs
452
+ * mounts would either be dropped (a control accepted and not applied) or take a
453
+ * directory off the image for no reason. Refusing is the honest answer, and it
454
+ * is the same one the sibling backends give a per-sandbox control they cannot
455
+ * express.
456
+ *
457
+ * Called at construction and again where the argv is built, so a config that
458
+ * reaches `create()` by some path other than `buildDockerBackend` is refused
459
+ * too.
460
+ */
461
+ export declare function assertRootfsOptionsAreCoherent(config: DockerHardeningConfig): void;
462
+ /**
463
+ * Refuse a `--cpus` value that cannot mean what it says.
464
+ *
465
+ * This covers non-finite and non-positive values and does NOT claim to cover
466
+ * every bound the daemon would refuse. The difference is worth stating, because
467
+ * the two classes fail in different places and only one of them is decidable
468
+ * here. A negative, `NaN` or `Infinity` renders into the argv as text the
469
+ * daemon either rejects or turns into a bound nobody asked for, and `0` is the
470
+ * opposite of a bound (`NanoCPUs` of zero is how a container says "no CPU
471
+ * limit"), so a host that wrote one of those hears about it during wiring
472
+ * rather than as a container that never came up.
473
+ *
474
+ * The upper bound is not ours to check. Moby's `verifyPlatformContainerResources`
475
+ * refuses `NanoCPUs` above the DAEMON host's CPU count (`"range of CPUs is from
476
+ * 0.01 to N.00, as there are only N CPUs available"`), and the same function
477
+ * deliberately sets no floor of its own on Linux, leaving that to the kernel.
478
+ * Neither number is knowable from here: the `docker` binary this backend drives
479
+ * can be pointed at a daemon on another machine (`DOCKER_HOST`), and even
480
+ * locally `os.cpus().length` is this machine's view rather than the daemon's
481
+ * own `runtime.NumCPU()`. Refusing on a guess at it would break a host whose
482
+ * daemon has more cores than the process driving it, which is a worse failure
483
+ * than the one it would catch — those arrive from the daemon with its own
484
+ * message, at spawn, where every other daemon-side refusal arrives too.
485
+ */
486
+ export declare function assertCpuLimitIsRenderable(cpuLimit: number | undefined): void;
487
+ /**
488
+ * `--tmpfs` flags for the paths that stay writable under `--read-only`.
489
+ *
490
+ * See {@link DEFAULT_WRITABLE_ROOTFS_PATHS} for the paths themselves and why
491
+ * each is there. Returns nothing when the read-only root filesystem is off, and
492
+ * the two ways a host names paths that cannot be mounted — a contradiction with
493
+ * `readOnlyRootfs: false`, or a path the layout already mounts — are refusals
494
+ * rather than a silently shorter list.
495
+ */
496
+ export declare function renderWritableRootfsArgs(config: DockerHardeningConfig): string[];
497
+ /**
498
+ * The confinement preamble for one container, in argv order.
499
+ *
500
+ * A function rather than a bare constant because `--read-only` is switchable
501
+ * and the flags that follow it describe what stays writable while it is on:
502
+ * `readOnlyRootfs: false` removes both the flag and the mounts. That is the only
503
+ * thing it removes. Everything in {@link HARDENING_ARGS} is applied
504
+ * unconditionally and no field can turn one of those off, so the argv for
505
+ * `readOnlyRootfs: false` is the argv this backend produced before any of this
506
+ * existed PLUS `--ipc private` — those two flags are the whole previous argv,
507
+ * and `--ipc private` is now unconditional. `--ipc` is not folded under this
508
+ * switch, because the field names the root filesystem: a host that turned the
509
+ * read-only rootfs off would be turning IPC isolation off as well, silently,
510
+ * for a reason the name of the field does not say. A switch has to mean one
511
+ * thing.
512
+ */
513
+ export declare function renderHardeningArgs(config: DockerHardeningConfig): string[];
514
+ /**
515
+ * Everything {@link buildDockerRunArgs} renders, as a value.
516
+ *
517
+ * The pieces that come from the daemon or from the host are inputs rather than
518
+ * lookups: which network the container attaches to, and whether an egress proxy
519
+ * is listening and on which port. Both are already resolved by the caller, and
520
+ * reading them here would put a daemon call back inside the function whose
521
+ * whole point is that it needs none.
522
+ */
523
+ export interface DockerRunArgvInput {
524
+ readonly config: DockerBackendInternalConfig;
525
+ readonly options: SandboxBackendOptions;
526
+ readonly containerName: string;
527
+ readonly network: string;
528
+ readonly hostReachability: 'host-port' | 'container-network';
529
+ /**
530
+ * Port the egress proxy listens on, when one is running. Absent means no
531
+ * proxy, and no proxy environment is passed in — which is not the same
532
+ * fact as a proxy that was configured and is unreachable.
533
+ *
534
+ * It is the proxy CONTAINER's port, on the internal network the two
535
+ * containers share; nothing is published on the host any more.
536
+ */
537
+ readonly egressProxyPort?: number;
538
+ }
539
+ /**
540
+ * The complete `docker run` argv, as a value.
541
+ *
542
+ * Extracted for the same reason {@link resolveNetwork} and
543
+ * {@link egressProxyContainerConfig} were: everything downstream of it needs a running
544
+ * Docker daemon, so a confinement flag that never reached the argv — or one
545
+ * that reached it in an order that cancels another — could only be caught by an
546
+ * operator noticing its effect missing in production. Spawning a fake `docker`
547
+ * and reading back what it was handed proves what the fake was told and nothing
548
+ * about the container the daemon would build. Here the whole baseline is one
549
+ * array, and an edit that drops a flag fails a test rather than a deployment.
550
+ *
551
+ * Order matters in exactly two places, and both are asserted by the test that
552
+ * pins this: the image is the last argument, because everything after it is a
553
+ * command for the container rather than a flag for docker; and every flag that
554
+ * takes a value is pushed as two argv entries rather than one string, so no
555
+ * value is ever re-split by anything downstream.
556
+ */
557
+ export declare function buildDockerRunArgs(input: DockerRunArgvInput): string[];
558
+ /**
559
+ * The argv as it may appear in an error message: the KEYS of every env
560
+ * entry, with the values replaced.
561
+ *
562
+ * A rendered argv is the last place a secret should survive. A non-zero
563
+ * `docker run` is a routine outcome — a missing image, a name conflict, a
564
+ * daemon hiccup, ENOSPC — and its message goes wherever the sandbox
565
+ * package's errors go: a log line, a telemetry batch, a CI transcript, a
566
+ * pasted bug report. The env flags carry the worker's credential and every
567
+ * value the host put in `options.env` (an API key, a broker token), and
568
+ * none of them are needed to explain an exit code. The keys are kept
569
+ * because they are what distinguishes "the image could not be pulled" from
570
+ * "the environment was rejected".
571
+ *
572
+ * EVERY SPELLING docker accepts for that flag, not the one this backend
573
+ * happens to emit today. `-e` IS `--env`, separated or `=`-attached, and
574
+ * this function used to compare each element to the literal `'--env'`: the
575
+ * long separated form this builder writes was redacted and `-e K=V`,
576
+ * `--env=K=V` and `-e=K=V` were printed in full. A future caller writing
577
+ * any of the three would have put a credential in a log line behind a
578
+ * docblock that promised it would not. The covered forms are `--env K=V`,
579
+ * `--env=K=V`, `-e K=V`, `-e=K=V` and the attached short form `-eK=V`; the
580
+ * one shape it does not read is a value attached to an `-e` bundled into a
581
+ * group of other short flags (`-iteK=V`), which no caller here writes and
582
+ * which no rule short of matching `-e` anywhere inside an option could
583
+ * catch. A valueless entry in any form (`--env K`) is passed through: it
584
+ * resolves from the CLI's own environment and carries no value to redact.
202
585
  *
203
- * Extracted for the same reason {@link resolveNetwork} is: everything
204
- * downstream of here needs a running Docker daemon, so a policy that never
205
- * reached the proxy could only be caught by an operator noticing their
206
- * traffic denied in production. A knob a host sets and the boundary never
207
- * receives is the failure this shape exists to make testable.
586
+ * That redacts the workspace paths the layout is rendered from as well,
587
+ * which are not secrets. They are also not what an exit code is about, and
588
+ * a rule with exceptions is a rule that leaks the first time someone's
589
+ * credential does not look like one.
208
590
  */
209
- export declare function egressProxyOptions(config: Pick<DockerBackendInternalConfig, 'brokeredCredentials' | 'allowInwardFor'>, policy: EgressPolicy): EgressProxyOptions;
591
+ export declare function redactDockerArgv(args: readonly string[]): string[];
210
592
  /**
211
593
  * Validate and resolve a {@link ContainerSandboxLayout}. Returns a
212
594
  * {@link ResolvedContainerSandboxLayout} with every container path