Section 13.4

Manifest

Definition

A manifest is a structured list that declares the items making up a package, a build or a run. For each item it gives a name and an identity, usually the cryptographic digest of the item’s bytes, and often a version, a size and a role. The producer writes the manifest; a consumer uses it to check that it holds exactly the declared items. A manifest is its author’s declaration: it is only as complete as the author’s inventory, and it may claim to list some items or every input.

The idea

A ship’s manifest lists the cargo on board, and a customs officer checks the cargo against it. In computing, a manifest does the same job for files and packages. A container image manifest lists the digest of every layer of the image. The lock file of a package manager records the exact version and a digest of each downloaded dependency. A software bill of materials (SBOM) lists the components inside a software product, with their versions. A consumer that holds a manifest can detect a missing item, a wrong version or a changed byte.

A build record lists ten input files, and every listed file matches its digest. The compiler, however, also read a header file that a script generated during the build, and that header is not on the list. The result depends on the header, and the manifest does not show it. The manifest was accurate about what it listed and silent about everything else. Two different promises can hide behind the word manifest. An inventory promises that the listed items are present and correct. A closed-input claim promises in addition that nothing else influenced the result. Checking every listed digest proves the first promise and never the second.

The ship shows the limit. Customs can confirm that every listed crate is aboard, but the manifest cannot show that nothing else is aboard; for that, someone must search the ship. A build has an advantage that a ship lacks: it can run in a sandbox §2.30, an environment that lets the process read only the files it is given. An unlisted input then becomes impossible instead of merely undetected.

How it works

A producer and a consumer use a manifest in five steps.

  1. Enumerate. The producer lists every item with its name, digest, size and role, such as source file, configuration, tool, library or data. A generated item is listed together with the generator that made it and the generator’s own inputs.

  2. Encode. The producer writes the list in one exact format. If the manifest will be hashed or signed, the encoding must be canonical, meaning that one list has exactly one byte representation, so that a producer and a verifier who build the same list obtain the same bytes. Canonical JSON §12.28 (JavaScript Object Notation) is such an encoding.

  3. Authenticate. The producer signs the manifest with a digital signature §5.14 or delivers it over a channel the consumer trusts. Either shows who made the declaration.

  4. Check presence and identity. The consumer computes the digest of each item it holds and compares it with the listed digest. It rejects a missing item and a mismatching digest. If the manifest claims to be complete, it also rejects any item that is not listed.

  5. Enforce or observe closure. For a closed-input claim, the run itself must read nothing unlisted. Either the run happens in a sandbox that exposes only the listed items, or the run is traced, every file it opens is recorded, and the recorded set is compared with the manifest.

Worked example

The manifest of a build declares three inputs: source file A (main.c), header B (config.h) and settings file C (settings.ini). A trace of the build shows that the compiler read A, B and a fourth file D, the header version.h, which a script generated during the build. The compiler never read C. Write the declared set as M={A,B,C}M = \{A, B, C\} and the set of inputs actually read as I={A,B,D}I = \{A, B, D\}. In the following, I∩MI \cap M is the set of items in both sets, I\MI \setminus M the set of items in II but not in MM, and |M||M| the number of items in MM.

The manifest has as many entries as there were inputs, |M|=|I|=3|M| = |I| = 3, and every listed digest may match, yet the closed-input claim fails because I\MI \setminus M is not empty. Header D can change the program: if version.h sets the version number to 7 instead of 6, the compiled program changes while every listed file stays the same. Adding a hundred more file names to the manifest would not help. The repair is to list D with its digest, together with the script that generated D and the script’s inputs; then I\M=∅I \setminus M = \emptyset, the empty set. The surplus item C does no harm to the closed-input claim, but it shows that the manifest was not produced from the actual build, so its other entries should be compared with the build as well.

Stated precisely

Let MM be the set of items a manifest declares, each with a recorded digest. Let II be the set of items that influenced the result, where an item influences the result if changing it could change the result. A manifest supports

The set II is rarely known exactly. In practice it is replaced by the set RR of everything the run read. If the run can be influenced only through what it reads, then I⊆RI \subseteq R, so checking R⊆MR \subseteq M is a safe test of I⊆MI \subseteq M. The test rests on three assumptions: the trace or the sandbox covers every way the run can take input, including files, environment variables, the network and the clock; the hash function is collision resistant §5.5, so that a matching digest means matching bytes; and the manifest is authentic, meaning that the stated producer made it and nobody has changed it since.

Limits and common mistakes

A signature on a manifest proves who wrote it and that it has not changed since. It does not prove that the list is complete or that the listed items are good.

A canonical, byte-exact encoding makes a manifest possible to hash and sign reproducibly. A perfectly canonical encoding of an incomplete or stale list is still incomplete or stale.

Names without digests fix nothing. A manifest that lists config.h without its digest accepts any file of that name.

Inputs that are not files are easy to miss: the compiler and its version, the build options, environment variables, the current date, random seeds and anything fetched over a network.

A manifest describes one moment. A manifest written before a run, and never compared with that run, can be stale.

A complete manifest for a build lists its source closure §13.6, the set of every input that can affect the result directly or through other inputs. Finding that set is its own task.

Questions answered

Are omitted inputs allowed to influence the result?

Omitted inputs are allowed to influence the result only when the manifest is presented as an inventory of some items, not as the complete list of inputs. If the manifest is used to claim that the result depends only on what it lists, then any omitted input that influenced the result makes that claim false. A manifest is a structured list of items with their digests, the fixed-length values computed from each item’s bytes. Checking every listed digest shows that the listed items are the right ones; it shows nothing about items that are not listed.

So first decide which claim is being made. For a closed-input claim, every item that can influence the result must be listed with its digest, including generated files and their generators, tools, configuration and libraries. The run must also be either confined to the listed items, for example by a sandbox, an environment that lets the run read only what it is given, or traced so that every item it read can be compared with the list. A build confined in this way is called a hermetic build §13.7. An omitted input found in the trace is a defect in the claim, and adding unrelated entries to the manifest does not repair it.

Related entries: Source closure (§13.6), Hermetic build (§13.7), Canonical JSON (§12.28), Transitive dependency (§10.43), Content-addressed identity (§13.2). Further reading: [30].