Skip to main content

Module artifact

Module artifact 

Source
Expand description

The build artifact: a zip of the daemon binary and a Dockerfile.

What CreateMicrovmImage’s codeArtifact.uri points at (sandbox.py:523 build_artifact). Two entries, and both of them carry a measured constraint.

§The execute bit has to be in the zip entry

A build that copies a non-executable binary produces an image whose CMD fails, and the failure surfaces as a run-hook timeout — which says nothing about permissions, and sends the reader to look at the daemon’s startup path instead of at the archive. So the agentd entry sets mode 0o755 explicitly rather than inheriting whatever the host file had.

§The agent token is never in here (TRAP-5’s other half)

The artifact becomes a shared image snapshot: every MicroVM launched from the image sees the same bytes. A per-VM secret in there is a per-VM secret shared with every VM. So the token travels through runHookPayload at launch instead, and this function has no parameter that could carry one — see crate::control::microvm. The test at the bottom of this file scans the produced zip’s raw bytes for a token value to prove the path stays closed, which is a byte scan rather than an API review because the leak would be a value appearing somewhere, not a parameter being declared.

Structs§

BaseImage
A base image: the platform ARN, the Dockerfile FROM that pairs with it, and whether it declares a WORKDIR.

Functions§

artifact_content_hash
The sha256 of the artifact’s two inputs, as lowercase hex.
build_artifact
Zips binary with dockerfile into the bytes codeArtifact.uri will point at.
default_dockerfile
A Dockerfile that makes the daemon the container CMD.
dockerfile_agentd_port
The port in a Dockerfile’s last ENV AGENTD_PORT=, or None when it sets none.
dockerfile_cmd
The value of a Dockerfile’s last CMD, or None when it sets none.
dockerfile_entrypoint
The value of a Dockerfile’s last ENTRYPOINT, or None when it sets none.
dockerfile_env_u64
The seconds in a Dockerfile’s last ENV AGENTD_SSE_KEEPALIVE_SECS=, or None when it sets none.
dockerfile_from_ref
The image ref in a Dockerfile’s first FROM, or None when it has none.
require_daemon_cmd
Rejects a Dockerfile whose image would never run the daemon: no CMD, or an ENTRYPOINT that swallows it.
require_keepalive_under_idle_timeout
Rejects a Dockerfile whose AGENTD_SSE_KEEPALIVE_SECS is not shorter than the client’s stream idle timeout.
require_matching_agentd_port
Rejects a Dockerfile whose AGENTD_PORT disagrees with the port the create call sends as hooks.port.
require_matching_from
Rejects a Dockerfile whose FROM is not the selected base image.
require_workdir
Rejects working-directory inheritance when nothing declares one.