Skip to content

Capsule publication verification

An execution capsule reaches a node with a publication attestation: a statement the control plane signed when the capsule's release was published, binding the capsule to its manifest, its file tree, its archive and its executable surface. The node checks that statement twice. Before it reads any bytes, it compares the attestation with the capsule's other inputs and verifies the signature; after opening the archive, it measures the files and compares them with the signed tree. This page covers both checks, what each field is compared with, and the refusals.

For what the attestation binds and how the control plane signs it, see Publication attestation and signing.

What the attestation is checked against

flowchart TB
  subgraph AS["ASSIGNMENT, from the control plane"]
    direction LR
    MAN[("Capsule manifest<br/>closure_inputs")]
    SUR[("Executable surface digest<br/>admitted closure reference")]
    REGN[("Signer registration<br/>artifact set scope")]
    subgraph ART["EXECUTION CAPSULE ARTIFACT"]
      direction TB
      ATT[("Publication attestation<br/>capsule_identity, signature")]
      IDS[("content_digest, blob_digest,<br/>publication_digest")]
    end
  end
  subgraph NODE["NODE"]
    direction TB
    V1{{"Before fetch or reuse<br/>fields and Ed25519 signature"}}
    V2{{"After opening<br/>measured file tree"}}
    TREE[("Opened capsule tree<br/>content store")]
    TREE --> V2
  end
  ATT --> V1
  IDS --> V1
  MAN --> V1
  SUR --> V1
  REGN --> V1
  ATT --> V2

Every field the attestation signs is compared with a value that reached the node by another path: the manifest and the executable surface from the admitted closure, the key from the signer registration sealed at catalog scope, and the file tree from the bytes the node opened itself. An artifact that carries its own public key or signer has an open shape and is refused, so the key always comes from the registration.

An attestation

{
  "contract_version": "xck.capsule_publication_attestation.v1",
  "produced_by": "control_plane",
  "publication_identity": {
    "workspace_uuid": "workspace-1",
    "package_id": "acme.billing",
    "release_version": "1.0.0"
  },
  "capsule_identity": {
    "reusable_capability_block_id": "acme.billing.charge",
    "capsule_digest": "sha256:aaaa...",
    "manifest_digest": "sha256:06a6...",
    "immutable_tree_digest": "sha256:2e2d...",
    "blob_digest": "sha256:bbbb...",
    "executable_surface_digest": "sha256:7777...",
    "provenance_digest": "sha256:7add..."
  },
  "signer_identity": "spiffe://xratu/control-plane/capsule-publication",
  "key_id": "ed25519:3475...",
  "attestation_digest": "sha256:c782...",
  "signature": {
    "algorithm": "ed25519",
    "signature_domain": "xck.capsule_publication_attestation.v1",
    "signed_digest": "sha256:c782...",
    "signature": "qcgCS1jl..."
  }
}

Before fetch or reuse

The check runs before the node looks in its content store or contacts your registry. The shape comes first:

  1. The attestation has exactly the fields in the example, contract_version xck.capsule_publication_attestation.v1, and produced_by control_plane.
  2. signer_identity and key_id equal the registered signer's. The registered key_id is ed25519: followed by the SHA-256 of the public key.
  3. attestation_digest is recomputed and must match, and signature.signed_digest equals it.

Then each signed field is compared with its independent source:

Signed field Must equal
capsule_digest The artifact's content_digest
blob_digest The artifact's blob_digest
attestation_digest The artifact's publication_digest
manifest_digest The canonical digest of the capsule manifest in the assignment
immutable_tree_digest The canonical digest of that manifest's immutable_file_tree
provenance_digest The canonical digest of that manifest's provenance
reusable_capability_block_id The manifest's reusable_capability_block_id
executable_surface_digest The executable surface digest of the admitted closure

A canonical digest is the SHA-256 of the document serialized as JSON with sorted keys and no whitespace.

Last, the signature is verified with Ed25519 against the registered public key. The signed message is the signature domain, a zero byte, and the attestation digest:

xck.capsule_publication_attestation.v1 \x00 sha256:<attestation_digest>

The attestation digest itself is the SHA-256 of the same domain, a zero byte, and the canonical JSON of the attestation without attestation_digest and signature. A signature from another domain therefore fails to verify here.

After opening

Once the archive is opened, on a fresh fetch and on every reuse of a stored entry, the node measures the tree:

  1. Every regular file under the opened root is read and hashed with SHA-256, keyed by its path relative to the root.
  2. A symlink anywhere in the tree refuses the capsule.
  3. The canonical digest of that path-to-digest map must equal the signed immutable_tree_digest.

A file added, removed or changed after publication changes the measured digest.

When verification fails

Stage Detail begins with Materialization reports
Field comparison capsule publication metadata refused: RUNTIME_CLOSURE_ARTIFACT_SIGNATURE_INVALID
Signature capsule publication signature is invalid: RUNTIME_CLOSURE_ARTIFACT_SIGNATURE_INVALID
Opened tree opened capsule tree does not match the signed immutable tree RUNTIME_CLOSURE_ARTIFACT_OPEN_FAILED

The first two are wrapped as execution capsule publication authentication failed:, and the third as signed capsule tree verification failed:. The detail names the field or digests that disagreed:

execution capsule publication authentication failed: capsule publication metadata refused: signed manifest_digest does not match the independent manifest
signed capsule tree verification failed: opened capsule tree does not match the signed immutable tree (expected=sha256:2e2d... observed=sha256:9f01...) for sha256:aaaa...

A metadata or signature failure means the capsule in the assignment differs from the one the control plane published: check the release's attestation and the signer registration. An opened-tree failure means the archive in your registry differs from the one the attestation names: check the blob stored under the capsule's immutable reference.

The kernel opens the capsule again when a cell starts and checks it once more. See Verified closure view.