All tutorials

Provenance & attestation, prove the source

Cordon 0.7.05 sections · 2 diagramsView this tutorial on GitHub

An attestation is a signed receipt a build system produces at publish time: "this exact file was built by github.com/acme/lib, at this commit, by its CI."

   cordon-scanner scan . --online
Provenance & attestation, prove the source, figure 1
   THE STOLEN-TOKEN ATTACK
   ┌────────────────────────────────────────────────────────────────────────┐
   │  attacker steals a publish token, uploads a malicious version.         │
   │  it STILL names the honest repo (github.com/acme/lib) in its metadata. │
   └────────────────────────────────────────────────────────────────────────┘

   presence check only:   "does it carry a receipt?"     ── an attacker can attach one
   FULL verification:     "is the receipt real, AND does the signer's identity
                           match the repo it claims?"     ── the attacker CANNOT forge this
   OFFLINE  (always)                       --online   ─────────────────                       ────────   sees an attestation is PRESENT          VERIFIES the sigstore bundle:   (npm dist.attestations,                   • Fulcio  certificate + CT timestamp    PyPI PEP 740)                            • Rekor   inclusion proof + checkpoint   flags a suspicious ABSENCE               • DSSE    signature over the pinned digest   POLICY.PROVENANCE.UNVERIFIED             • identity = the DECLARED source repo
Provenance & attestation, prove the source, figure 2
   dependency (advertises attestation)
        │
        ▼
   fetch the sigstore bundle the registry points at   ── host-allowlisted
        │
        ▼
   verify( bundle, digest = LOCKFILE's pinned hash, identity = declared repo )
        │                              └── a registry swap shows up here as a failure
        │
   ┌────┴─────────────┬────────────────────────┐
   VERIFIED           INVALID                   UNVERIFIABLE
   (no finding)       VULNERABLE.PROVENANCE     POLICY.PROVENANCE
                      .INVALID (critical)        .UNVERIFIED  (low)
                      sig/identity rejected      no digest, or no
                                                 usable bundle
   INVALID       →  act on it. The signature or the identity is wrong.   UNVERIFIABLE  →  pin the digest, or accept provenance is                    asserted rather than proven. Never a false pass, never a crash.
   The Fulcio + Rekor + DSSE checks are Cordon's own code, against a trust root   it pins -- no third-party crypto, nothing to install. The bundle is fetched   from the registry, which is why the check is --online only.

Next: 06 · Secrets, credentials and exfiltration.