Your build attestation is a chain of custody, not a safety certificate
Executive Summary
The prevailing narrative in modern software supply chain security treats build attestation as a final seal of approval—a cryptographic certificate that guarantees the safety, correctness, or vulnerability-free status of a binary. This is a fundamental architectural misconception. Build attestation is not a safety certificate; it is a chain of custody. It answers the question "Who built this and how?" rather than "Is this safe?"
This analysis dissects the distinction between provenance and policy enforcement. While attestation (such as SLSA or in-toto) provides an immutable record of the build environment, the tools used, and the source code committed, it does not inherently validate the semantic correctness of the code or the absence of logic bugs. Confusing these two concepts leads to false security postures where organizations assume that because a build is attested, it is secure. In reality, an attested build can still contain logic errors, misconfigurations, or vulnerabilities introduced by the source code itself. This tutorial explores the engineering implications of treating attestation as a strict chain of custody mechanism, detailing how to implement verifiable provenance without conflating it with runtime safety guarantees.
Implementation & Architecture
To implement a robust chain of custody, we must move beyond simple signature verification and adopt a workflow that captures the entire build state. The architecture relies on three core components: the build environment isolation, the attestation generation, and the verification pipeline.
The following Bash script demonstrates a minimal, runnable implementation of a build attestation generator using slsa-framework/slsa-github-generator concepts. It captures the git commit, the build arguments, and the environment variables, then signs the resulting provenance statement using a local GPG key. This simulates the "chain of custody" recording process.
#!/bin/bash
# build_attestation_chain.sh
# Implements a basic chain of custody record for a build artifact.
# Requires: gpg, jq, git, sha256sum
set -euo pipefail
ARTIFACT_NAME="${1:-app.bin}"
PROVENANCE_FILE="provenance.json"
SIGNATURE_FILE="provenance.sig"
# 1. Capture Build Context (The Chain of Custody)
echo "Capturing build context..."
# Get immutable build identifiers
BUILD_ID=$(git rev-parse HEAD)
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
BUILDER_ID="ci-runner-$(hostname)"
# 2. Generate Provenance Statement (The Attestation)
# This JSON structure represents the 'who', 'what', and 'how' of the build.
cat > "$PROVENANCE_FILE" <<EOF
{
"subject": [
{
"name": "${ARTIFACT_NAME}",
"digest": {
"sha256": "$(sha256sum "${ARTIFACT_NAME}" | awk '{print $1}')"
}
}
],
"builder": {
"id": "${BUILDER_ID}"
},
"buildType": "https://example.com/build/v1",
"invocation": {
"configSource": {
"uri": "git+https://github.com/example/repo@${BUILD_ID}",
"digest": {
"sha1": "${BUILD_ID}"
},
"entryPoint": "build.yaml"
},
"parameters": {
"compiler": "gcc",
"flags": "-O2 -Wall"
}
},
"metadata": {
"buildInvocationId": "inv-001",
"completeness": true,
"authenticated": true
}
}
EOF
# 3. Sign the Attestation (Securing the Chain)
echo "Signing provenance..."
gpg --default-key "shvasa-ci-key" --detach-sign --output "$SIGNATURE_FILE" "$PROVENANCE_FILE"
echo "Chain of custody recorded in ${PROVENANCE_FILE} and signed in ${SIGNATURE_FILE}"
echo "Artifact: ${ARTIFACT_NAME}"
echo "Commit: ${BUILD_ID}"
The architectural flow is linear and deterministic. The build system produces the artifact and simultaneously produces the metadata describing the artifact's creation. This metadata is then cryptographically bound to the builder's identity. Verification systems do not analyze the binary's content; they verify that the signature on the provenance file matches the builder's public key and that the provenance file accurately describes the artifact's hash.
ShVaSa Intuition & Hardware Sizing
The critical insight from ShVaSa Lab is that the hardware requirements for attestation are fundamentally different from those for security scanning. Attestation is a lightweight, metadata-heavy operation, whereas safety verification (static analysis, fuzzing) is compute-intensive.
Hardware Trade-offs
- CPU vs. GPU Latency: Attestation Generation: This is CPU-bound but I/O-light. It involves hashing files and signing small JSON structures. A standard 4-core CPU can generate thousands of attestations per second. There is no need for GPU acceleration. Safety Verification: If you were to integrate static analysis or binary analysis into the same pipeline, you would see significant latency spikes. However, since attestation is not safety verification, we keep these processes separate. The hardware for attestation should be optimized for low-latency cryptographic operations (using hardware AES-NI or SHA extensions), not parallel compute.
- Memory Footprint: The provenance JSON files are typically under 10 KB. The memory footprint for generating and storing attestations is negligible (< 50 MB per build context). This allows for high-density CI runners. In contrast, a full security scan of a large binary might require 2-4 GB of RAM for symbol table analysis. By decoupling attestation from scanning, we can run attestation on minimal, ephemeral containers, reducing the overall infrastructure cost.
- Storage Bandwidth: * The primary bottleneck is not compute, but storage I/O when dealing with large artifact sets. Each build produces one artifact and one provenance file. For high-throughput pipelines (e.g., microservices with 50+ components), the storage backend must handle concurrent writes of small files efficiently. Object storage (S3-compatible) is preferred over block storage for provenance archives due to its durability and global accessibility for verification.
The "Safety Certificate" Fallacy
Engineers often attempt to offload safety verification to the attestation layer by adding complex policy checks (e.g., "attestation is valid only if no CVEs are found"). This is an architectural anti-pattern. It conflates the provenance (the record of the build) with the policy (the decision to allow the build).
A true chain of custody remains pure. It records that the build happened in environment X using code Y. It does not judge the quality of Y. Safety certificates should be separate artifacts, generated by separate tools, and linked to the attestation via a manifest, not embedded within it. This separation ensures that the chain of custody remains immutable and tamper-evident, while safety policies can evolve independently.
Grounding & Source Attribution
This analysis is grounded in the principles of supply chain security as discussed in industry literature, specifically drawing from the conceptual framework presented by Dimitris Kyrkos in his Dev.to publication. The core thesis—that attestation serves as a chain of custody rather than a safety guarantee—aligns with the SLSA (Supply chain Levels for Software Artifacts) framework's distinction between provenance and security controls.
Source Attribution:
- Topic: Your build attestation is a chain of custody, not a safety certificate
- Original Author: Dimitris Kyrkos
- Platform: Dev.to
- Context: Editorial curation and architectural analysis of build security postures.
ShVaSa Lab (shvasa.us) provides this technical deep-dive to clarify the engineering boundaries between provenance tracking and security validation, ensuring that systems architects do not conflate the two in their design decisions.
flowchart TD
subgraph Ingestion["1. Workload Profiling & Input Tensors"]
A["Input Stream: Your build attestation is"] --> B["Memory Allocator & Batch Sizer"]
B --> C["Pinned Host Buffers"]
end
subgraph Execution["2. Hardware Execution & Memory Bus"]
C --> D{"Bus Saturation Monitor"}
D -->|Within Bandwidth| E["High-Throughput Kernel Execution"]
D -->|Bus Contention| F["Adaptive Quantization / KV-Eviction"]
end
subgraph Telemetry["3. Verification & Telemetry"]
E & F --> G["Verified Invariant Telemetry"]
end