13 min read

Supply Chain Integrity
Advanced

Signed Supply Chain

A compromised pipeline produces a well-formed artefact. The build succeeds, the tests the pipeline ran pass, and the output is signed if the pipeline was configured to sign. Signing does not stop a bad build. It changes who can be deceived afterwards, and only when the consumer, not the producer, verifies before use.

A Valid Signature Over the Wrong Build

A verification step that asks only whether some valid signature exists is satisfied by the attacker's key, and a pipeline that signs whatever it built is satisfied by the attacker's build. Signed is not safe. A signature says the bytes are unchanged since a named signer attested them, not that the signer was entitled to publish or that the build was honest.

The Build That Signs Its Own Mistake

The usual supply chain story is a poisoned dependency: someone publishes a package, a pipeline installs it, the output carries a backdoor. A stolen maintainer token, a workflow file edited on a branch that a privileged job checks out, or a step injected into a shared template reach the same place by a shorter route, and the pipeline does what it was configured to do.

A signature appended at the end of that run signs the attacker's output. This is the part usually misread: signing is not a verdict on the build, only a statement about the bytes that survived it.

The attack worth addressing here is substitution: modified bytes behind a familiar name, a mirror serving a different layer, a package reinstalled from a local path. It is cheap, and verification at the consumer detects it. But integrity in transit is not integrity of origin, and origin is not intent. A signature answers the first, provenance narrows the second, and nothing answers the third.

A signature made inside the build proves the build can sign. Checking it where the artefact is deployed proves something about the artefact. Putting both halves in one pipeline means the pipeline validates itself.

What Is Signed Is a Digest

A signature is not attached to a file. The signer hashes the artefact, wraps the digest in a statement naming the subject, and signs the statement. The signature covers bytes by identity: the digest is the subject, and the rest is description.

Names and tags are pointers, not identities. A version tag is a mutable mapping to a digest, and a registry can move it without touching the artefact it pointed at. Verify a tag, then let the runtime resolve it again a moment later, and the verified bytes need not be the bytes that run. Anyone who can push can run that race.

A digest reference closes it. A reference written repo@sha256:… names content: the same digest is the same bytes, and a different build cannot inherit it. The rule is not to sign the image, since a tag can satisfy that while the artefact behind it changes; it is to verify a digest and deploy that digest. A signature without a digest is a claim about a name.

Consumer reference What can change while the reference stays fixed What the signature covers
A tag, including a version tag Anything: the registry can re-point it The digest the tag resolved to when the signer ran
repo@sha256:… Nothing: the digest is the content Those bytes
pin-by-digest.sh
# A tag is a pointer to a digest. Ask the registry what it points at now.
crane digest registry.example.com/app:1.4.2
# sha256:6d1f...   <- this is the only value that identifies the bytes

# The reference a consumer should hold, and a deployment should pin:
#   registry.example.com/app@sha256:6d1f...

# The tag can be moved to another digest without any artefact changing.
# The digest reference cannot be moved: it names those bytes or nothing.

Key Custody Is the Design

What a signature means depends on who can produce it. If the signing key is a secret in the CI system, the CI system signs whatever it is instructed to build. It cannot tell an intended commit from a pushed one, and nothing in the key knows which refs may publish. Its trust boundary is everything that can influence a job: repository write access, workflow files, cached dependencies, the runner image.

Hardware custody moves that boundary rather than removing it. A key generated inside an HSM or signing appliance and never exported cannot be copied off the machine and used elsewhere, which ends key theft and out-of-band signing. It does not end misuse: whoever can call the appliance can ask it to sign, so its authorisation policy and audit trail are the control.

Keyless signing changes the question from custody to identity. The build presents a short-lived workload identity issued by the platform, naming the repository, workflow and ref; a signing service returns a certificate binding that identity to an ephemeral key, and the event is recorded in a transparency log. Nothing long-lived exists to steal, and the signature names the workload. But anyone who can run a job on that repository can obtain the identity, so keyless signing does not survive a compromised pipeline either.

Each model answers a different question. Hardware custody asks whether the key can be copied, keyless signing asks which identity signed, and neither asks whether the build was honest.

verification-policy.yaml
# Sketch of a verification policy. What matters is what it makes explicit,
# not the syntax of any one tool.
subject: registry.example.com/app

require_digest_reference: true     # a tag-only reference fails closed
signature:
  identity: ci://org/app/build     # pinned here, not discovered from the registry
  issuer: https://token.ci.example.com
provenance:
  repository: https://git.example.com/org/app
  ref: refs/heads/main
  builder: ci://org/app/build
on_verification_unavailable: deny  # a timeout is a failure, not a pass

Provenance Is a Second Statement

An artefact signature says the bytes are unchanged since a named signer attested them. It says nothing about how they were made. Sign an attacker's build and the result is a valid signature over a malicious artefact: authentic, intact and wrong.

Provenance is a separate signed statement, bound to the artefact digest, describing the build: source repository and commit, pipeline definition or builder identity, invocation parameters, materials consumed. The in-toto attestation model is the general shape — a subject identified by digest, and a predicate describing how it came to exist. SLSA is a provenance vocabulary carried in that shape (the current specification version and its level definitions are not stated here). Sigstore and cosign are one implementation family, and OCI referrers attach the statement to an image in the registry.

What it buys is a second, independent condition. A consumer can require that the signature verify and that the provenance name the expected repository, commit and builder. That rejects a correctly signed artefact produced from a fork, another branch, a builder the organisation does not run, or inputs nobody approved.

It remains a builder's statement. A compromised builder produces provenance that accurately describes its own build, and the signature over it is valid. Provenance turns a quiet substitution into a mismatch; it cannot make a dishonest builder honest.

Verification Is a Policy Decision

A signature beside an artefact is inert data. Something has to read it at the point of use, against a policy that says who may sign what, and act on the answer. The order matters:

  1. Resolve the reference to a digest; refuse a reference that is only a tag.
  2. Verify the signature against a key or identity pinned out of band, not fetched from the artefact's registry.
  3. Compare the signed subject digest with the digest that will run.
  4. Check the provenance repository, commit and builder against policy.
  5. Record the decision, and let any failure stop the deployment.

The failure path is where these systems stop being controls. An admission check that calls a verification service and proceeds when it is unreachable is a check an attacker can arrange to skip: block egress, or wait for an outage. It does not fail safe, and it is still described as signing.

The trust anchor must arrive by a route other than the artefact. A key downloaded from the same registry as the image proves only that whoever could write the image could write the key. Pinning key material, or an issuer and subject for keyless signatures, puts the decision where a registry compromise cannot reach it.

Enforcement must also be the only path. A cluster that rejects unsigned images in one namespace still runs them from another; a pipeline that verifies before promotion is bypassed by whoever applies the manifest directly. Verification is a control only where nothing else can deploy.

What a Review Can and Cannot Prove

Some of this is checkable from outside, with no trust in the vendor. Recompute the digest from the bytes you downloaded — hashing is public arithmetic — and compare it with the reference the consumer is configured to use. If those differ, nothing later matters.

Then verify the signature against the key or identity you obtained separately, and read what it names. A keyless certificate should name a workload — issuer, repository, workflow and ref — rather than a person, since a signature valid under a key everyone holds proves little about this artefact. Check that the provenance subject is the same digest and that the predicate names the expected repository, commit and builder.

verify-release.sh
# Re-derive the subject from the bytes you actually have.
sha256sum ./app-linux-amd64.tar.gz

# Check the detached signature against a key published out of band.
# A key fetched from the same download page proves nothing extra.
openssl dgst -sha256 -verify release.pub -signature release.sig ./app-linux-amd64.tar.gz

# The provenance statement must carry the same digest as its subject.
grep -o 'sha256:[0-9a-f]*' app.provenance.jsonl

Enforcement is tested rather than read. Push an unsigned or wrongly signed artefact at staging and confirm it is refused; make the verifier unreachable and confirm the deployment still stops. A warning in a log, a started pod, or a green pipeline after a timeout all say the control exists on paper.

The evidence stops at the build. Nobody outside it can show that the key was never exposed, that the signing service was not itself compromised, or that the build environment was clean while it ran. Provenance records what the builder said it did, and a builder under an attacker's control writes accurate provenance for a build that includes their step. The honest claim is narrow: these bytes are the bytes that were signed, by this identity, and the recorded build claims this source.

Evidence to Capture

The artefact and the statements about it are the evidence; a signing dashboard is not. Capture values a second party can re-check without your access.

Artefact digest: The digest you computed yourself from the bytes, the digest in the consumer reference, and the digest carried as every signature subject. Record whether the three agree.

Reference form: The exact string the deployment or install path uses, so the report shows whether it names a digest (repo@sha256:…) or a tag that can move.

Signer identity: The key fingerprint, or the certificate issuer and subject, as written in the verified signature rather than as configured in the pipeline.

Provenance fields: The subject digest, source repository, commit, ref and builder named in the statement, together with the statement's own signature.

Verification decision: The policy the consumer applied, the verifier output for this artefact, and the log line showing the deployment was allowed or refused.

Failure-path behaviour: What the consumer does when the verifier is unreachable or the statement is missing, observed rather than documented.

Likely False Positives

A signature that verifies is not automatically a finding, and a missing signature is not automatically an exposure. Both need the consumer behaviour before either is a finding.

  • Unsigned artefact on an internal mirror: A mirror that accepts only verified artefacts and verifies again on serve may hold unsigned copies by design. Test whether the consumer accepts them.
  • Signature under an unexpected key: A rotated key or a new builder identity is a change to confirm, not a compromise. Check the rotation record and whether the verification policy moved with it.
  • Tag reference in a build step: A tag that a CI step resolves to a digest and deploys as that digest is not the same as a tag in a deployment manifest. Read where the reference is consumed.
  • Provenance naming a fork: A fork used for a pull-request build legitimately produces provenance naming the fork. The finding is a consumer that accepts it for production.
  • No public transparency entry: A private signing deployment may not publish to a public log. The control is the log's integrity and access, not its address.
  • Warning-only verification gate: A gate that annotates a pull request but does not block the merge is advisory. That is a finding about the policy, not about the signature.

Testing Checklist

Artefact identity

  • ☐ Every consumer reference recorded as digest or tag
  • ☐ Digest recomputed from the fetched bytes and compared
  • ☐ Tag-to-digest resolution checked at deploy time, not only at build time
  • ☐ Registry write access mapped to the identities that hold it
  • ☐ Artefacts promoted between environments by digest
  • ☐ Signatures still valid after promotion

Signing identity

  • ☐ Key location recorded: CI secret, HSM, appliance or keyless issuer
  • ☐ Jobs and refs able to obtain the signing identity listed
  • ☐ Key rotation and revocation procedure read
  • ☐ Signer identity in the signature compared with the expected workload
  • ☐ Transparency log entries located, where one is used
  • ☐ Human-held keys listed with their owners

Verification

  • ☐ Verification enforced on every path that can deploy
  • ☐ Policy pinned to keys or to issuer and subject, not a registry fetch
  • ☐ Provenance checked for repository, commit, ref and builder
  • ☐ Unsigned artefact refused in a staging test
  • ☐ Verifier outage tested and shown to block
  • ☐ Decision recorded against the artefact it applied to

Remediation

Signing

  • • Move signing off the build host where the platform allows it: an HSM or signing service that holds the key and applies its own authorisation policy.
  • • Prefer short-lived workload identities to long-lived keys, so there is no signing secret in the CI system to steal.
  • • Sign an artefact once and promote that digest between environments instead of rebuilding per environment.
  • • Restrict which refs and workflows can obtain the signing identity, and record every signing event with the artefact it covered.

Verification

  • • Require digest references in every deployment manifest, chart value and install instruction, and reject tag-only references.
  • • Pin the trust anchor in configuration: key material, or issuer and subject for keyless signatures, with rotation as a reviewed change.
  • • Make verification fail closed: an unreachable verifier, a missing statement or an unparsable one denies the deployment.
  • • Verify provenance as well as the signature, requiring the source repository, commit and builder to match policy.
  • • Remove the bypasses: direct applies, alternate namespaces, manual pulls and warning-only gates.

CWE References: CWE-345, CWE-494, CWE-829