Skip to main content

Module sandbox_image

Module sandbox_image 

Source
Expand description

What a sandbox image must carry for the agent to serve, and the Dockerfile text carrying it.

Two kinds of image exist and neither is built the way the other is. AWS renders one per deployment onto a customer-supplied base image; GCP builds static images in CI. Nothing at build time reads the other side, and a value that disagrees is invisible until a session fails: an agent listening on a port no caller dials, or an exec into a uid the image never created.

So the values live here once and both kinds render the block that carries them from this module. The same holds for the default sandbox base both kinds start from: its toolchain is listed here once, and a probe reads that list rather than restating it. The Dockerfiles and the tool list are committed as generated text because CI builds them with docker build and probes them from a shell, neither of which can call a Rust function.

Structs§

SandboxImage
The values an image must carry for the agent to run in it.
SandboxImageCommand
Root-owned metadata copied from the base image at bundle creation, never from an exec caller.
SandboxTool
A tool the default sandbox base ships, and the command that shows it runs.

Enums§

Authorization
How the agent decides a caller may be served.
Isolation
How an image ends, and the isolation that ending permits.

Constants§

AGENT_IDENTITY_ARGUMENT
The agent’s first argument that prints its uid and gid and exits, touching nothing else.
AGENT_MODE
Mode of the agent binary, owned by 0:0 so the exec uid cannot rewrite its supervisor.
AGENT_PATH
Path the agent binary is installed at inside every sandbox image.
AGENT_PORT
Port the agent serves unless the platform pins another.
AWS_MICROVM
The Lambda MicroVM image, rendered per deployment onto a customer base image.
AZURE_SANDBOX
Azure serves the agent through a published port and an authenticated native file read. Its native exec path is never used for packaged images because it grants excess capabilities.
CALLER_AUTHORIZATION_HEADER
Header a caller puts its own bearer in when the backend’s edge consumes Authorization for its own credential (GCP). The agent, after the capability verifies, re-emits it as Authorization towards 127.0.0.1 only.
DEFAULT_SANDBOX_BASE_IMAGE
The image every default sandbox builds on, by index digest so both architectures are pinned.
DEFAULT_SANDBOX_TOOLS
The toolchain of the default sandbox base, and the one list its probes read.
DEFAULT_SANDBOX_UV_IMAGE
The image uv and uvx are copied out of, by index digest.
ENV_CALLER_AUTHORIZATION_HEADER
Environment variable naming the header a backend’s callers use for their own bearer (authorization when unset). Set on backends whose edge replaces Authorization.
ENV_IMAGE_COMMAND
Turns on the image’s own command under the root boot contract. Released agents accept only true and refuse to start on anything else.
ENV_IMAGE_PERMISSIONS
JSON crate::sandbox_image_permissions::ImagePermissionsContract: the mounts the agent performs for the image, the connections it exempts from the gateway, and the lifecycle steps.
ENV_IMAGE_PERMISSIONS_VERSION
Version of the ENV_IMAGE_PERMISSIONS contract.
ENV_MUST_DROP_KUBE_API
Comma-separated host:port addresses of the Kubernetes API server (its Service ClusterIP and the real endpoint IPs) that the startup gate must see dropped. The Operator sets it on every Kubernetes sandbox pod, because service links are off and the pod has no KUBERNETES_SERVICE_HOST to learn the address from.
ENV_MUST_DROP_PUBLIC
A public host:port the startup gate must also see dropped. The Operator sets it only where the declared egress forbids direct public traffic (none, and internet, which goes through the gateway). It is unset when the policy allows that address, so an allow pod is not refused for reaching it.
ENV_PROTECTED_MOUNTS
Set by the Kubernetes backend only: the pod mounts the agent binary and /opt/alien read-only itself, so the agent verifies that instead of building a private mount namespace (a pod’s default seccomp profile blocks unshare). The agent refuses to start if the mounts are not there, so setting it elsewhere cannot turn protection off.
EXEC_USER
Name of the exec identity’s passwd and group entries.
GCP_AGENT_LOG_FILTER
RUST_LOG for a GCP image, which the agent needs set before it logs anything.
GCP_AGENT_PLATFORM
GCP keeps a root supervisor separate from the non-root command identity. Live conformance must verify root execution and capability bounds because the provider’s published custom-image requirements do not promise root support. Agent Platform serves the port the template declares; the agent keeps the shared port so a workload that binds 8080 itself does not collide with it (measured live: with the agent on 8080 a root supervisor that also binds 8080 exits at startup).
IMAGE_COMMAND_PATH
Installed outside the command-writable session directory.
IMAGE_COMMAND_WITH_IMAGE_PERMISSIONS
The ENV_IMAGE_COMMAND value deployment sets when the sandbox declares image permissions or lifecycle steps. A released agent refuses it and so fails the image build’s validate hook; a current one reads it as true plus a requirement to enforce ENV_IMAGE_PERMISSIONS.
IMAGE_PERMISSIONS_VERSION
The only ENV_IMAGE_PERMISSIONS_VERSION value.
IMAGE_ROOT_CAPABILITY_MASK
IMAGE_ROOT_CAPABILITY_SET as the 32-bit CapEff mask the agent applies.
IMAGE_ROOT_CAPABILITY_SET
Linux capabilities a root image process keeps: Docker’s default set without NET_RAW.
KUBERNETES_SANDBOX
A Kubernetes sandbox pod. The cluster’s sandboxed runtime is the tenant boundary and refuses to start a root container here (runAsNonRoot), so the agent starts as the exec uid and supervises under it. Anything on the cluster network can reach the pod, so a caller presents a signed capability. The exec uid is a default: a non-root base USER replaces it.
MUST_DROP_PUBLIC_PROBE
The public address the Operator asks the gate to probe.
NATIVE_TOKEN_PATH
Per-boot agent credential read only through an authenticated native file API.
PREVIEW_CAPABILITY_HEADER
Header carrying a preview capability. Never Authorization: the caller’s own bearer token belongs to the code inside the sandbox and reaches it untouched.
PREVIEW_CAPABILITY_MAX_SECONDS
Longest a preview capability lives, in seconds. A grant never outlives the session either.
PREVIEW_PORT_HEADER
Header naming the sandbox port a preview request is for.
SESSION_ROOT_MODE
Mode of the session root, which the exec uid owns.
STAGED_AGENT_FILE
The agent’s file name inside that directory. A pod mounts directories only, never the single file: runtimes that run the pod in a VM share a directory mount into the guest as a mount point but do not list a single-file bind mount, so the agent could not prove the file read-only there. The container starts the agent from STAGED_AGENT_PATH.
STAGED_AGENT_NAME
File name the staging step also writes at the top of the staging directory. Agents built before the directory mount were staged that way and an Operator of that release mounts it over the image’s agent path; keeping it lets that Operator run an image built with this agent.
STAGED_AGENT_PATH
Where the staged agent runs from on Kubernetes (inside the read-only /opt/alien mount).
STAGED_METADATA_NAME
Name of the directory inside the staging volume that the pod mounts read-only at /opt/alien.
STAGE_PROTECTED_FILES_ARGUMENT
The agent’s first argument that stages the protected files (the Kubernetes init container).

Functions§

contract_env
The ENV block carrying the agent’s configuration contract.
entrypoint
EXPOSE, the image’s ending, and the ENTRYPOINT.
gcp_agent_platform_env
Every variable a GCP Agent Platform image sets: the contract, then RUST_LOG.
identity_setup
The RUN step creating the exec identity and the session root it owns.