Automatic Attestation Architecture
Overview of the Tinfoil attestation process for enclave verification.
Overview
Tinfoil uses confidential computing to provide a verifiably private runtime environment in the cloud. This verifiability property is realized through an attestation architecture which ensures that:
-
The secure enclave environment is genuine and properly configured, as attested to by AMD and NVIDIA.
-
Only immutable and publicly-auditable code is executed inside the secure enclave.
-
Only static model weights are loaded into the inference engine.
Components
This attestation architecture is illustrated in Figure 1 and consists of the following components.
cvmimage
: Confidential VM Image based on Ubuntu, with the CPU TEE compatible kernel, the vLLM inference server, oursev-shim
andmodelpack
mount utils.modelpack
: Read only volume containing model weights or other immutable datatinfoil-config.yml
: Manifest for models, shim configuration, and dependency versionssev-shim
: Reverse proxy that runs inside the VM image and terminates TLS, enforces security policy, and serves the remote attestation documentpri-image-builder
: Converts thetinfoil-config
file into a deployment config and publishes a new Sigstore Bundle on the Sigstore transparency logedk2 ovmf
: UEFI boot firmware- Sigstore: Transparency log record containing source code measurements (i.e., a SHA256 hash of the compiled code)
- Verifier (on Client Device): Checks that the source code and runtime measurements match and that the TLS connection matches the attested public key
Figure 1: Overview of Tinfoil’s attestation architecture.
Immutability
The Confidential VM (CVM) is inherently stateless. It has no persistent data whatsoever; all virtual disks are mounted as read-only.
Consequently, we need a means to verify the integrity of the read-only disk images to ensure they haven’t been modified by an attacker on the host.
We use dm-verity to create an attested measurement of the disk image which the CVM verifies at boot time.
We use mkosi
to build the rootfs and modelpack
to create immutable disk images from huggingface model weights.
CPU-GPU Chain of Trust
Once the CVM verifies the integrity of the disks, it in turn queries the GPU to ensure it’s also configured correctly by NVIDIA. This creates a link between the CPU and GPU attestations. If the CPU fails to verify the GPU’s attestation, it aborts the boot process and returns an error.
Lifecycle
To run a model on Tinfoil, we first build the model into a deployment configuration, deploy it on our infrastructure, then verify it’s integrity on the client device.
Build-time
- Download model weights from huggingface or other model repository
- Use modelpack to create an immutable
.mpk
file of the weights (EROFS+dm-verity) and an info string ([root node hash]_[offset]_[block uuid]
) that verifies the integrity of that file - Create a
tinfoil-config.yml
with:- MPK info string for the model
- sev-shim config (domains, path ACL, allowed CORS origins)
- CVM image and OVMF firmware versions
- Memory and vCPU core count
- Commit the config file and a GitHub Actions workflow for pri-build-action to a new repo
- Tag a release and pri-build-action publish the release including a measured deployment manifest
- Run the VM in QEMU
Runtime setup
- QEMU starts the VM
- When the CVM boots, our initialization process does the following:
- Creates a ramdisk for all ephemeral data
- Ensures the tinfoil-config file matches the attested hash provided in the kernel command line
- Checks the NVIDIA GPU attestation with NVIDIA’s
local-gpu-verifier
- Uses
modelpack
to mount each model weight directory - Applies
sev-shim
andvllm
configurations from the attested config and starts each service
Connection-time verification
Before exchanging application data (e.g., chat completions) with an enclave, the verifier SDK completes the following checks:
- Fetches the attestation document from enclave which includes the signed runtime measurements
- Verifies the certificate chain in the attestation to the CPU’s hardcoded root certificate: (AMD)
- Fetches the Sigstore bundle from GitHub
- Verifies the Sigstore bundle to Sigstore’s root trust anchor
- Checks the measurement predicates to ensure the source code and runtime enclave measurements match
- Opens a TLS connection to enclave and ensures the public key offered by the remote server matches the public key included in the attestation document
Tinfoil Config File
The “tinfoil config file” is always called tinfoil-config.yml
and placed at the root of a deployment repo.
The private image builder action parses this file to create an attested deployment config and includes the SHA256 hash of the entire file as a kernel command line parameter to provide a cryptographic link to the running enclave.
For example, our DeepSeek R1 deployment: