Skip to content

SBOM and Container Image Signing: Building an Artifact Chain of Trust

Interactive Diagram

새 탭 ↗

Software supply chain security is the discipline of identifying and defending against threats across the whole path a piece of software travels: development, build, and deployment. Incidents like SolarWinds, Log4Shell, and the XZ backdoor have made it essential to define core security strategies at every stage of that path, and the key actions per stage are now fairly well standardized.

This project deployed Applications as containers, so we applied SBOM and image signing integration specifically around container images.

Key concepts

  • SBOM (Software Bill of Materials): a list of the libraries, dependencies, and versions bundled into an application. Used for vulnerability tracking, license review, and similar concerns. Formats: SPDX, CycloneDX.
  • Image Signing: proves an image/piece of code is legitimate and hasn’t been tampered with. Cosign and Notary v2 are the leading tools.
  • SLSA (Supply-chain Levels for Software Artifacts): a supply chain security maturity model led by Google, with levels 1 through 4.
  • Policy Enforcement: verifies before deployment that an SBOM exists, signatures are valid, and no known vulnerabilities are present. Kyverno, OPA-Gatekeeper, Sigstore Policy Controller, etc.

Common tools

AreaTools
SBOM generationSyft, Trivy, Anchore
Image signingCosign, Notary v2
CI securityGitHub Actions + OIDC, SLSA Provenance
Policy validationKyverno, Gatekeeper, Sigstore Policy Controller
Risk detectionGrype, Trivy, Dependency Track

Notable attacks

IncidentSummary
SolarWinds (2020)A backdoor was inserted into the build pipeline, compromising thousands of companies and government agencies
Log4Shell (2021)A zero-day vulnerability in a widely used library that affected countless applications
Python/NPM malwareMalicious code inserted into packages with names similar to popular libraries
XZ backdoorA maintainer of a popular compression library planted a backdoor over the course of years

Response strategy summary

StageResponse
Source codeThird-party code review, branch protection
DependenciesSBOM generation, vulnerability scanning
Build/CIReproducible builds, isolated CI, OIDC integration
ImageImage signing, signature verification pipeline
DeploymentPolicy-driven Admission Controller
OperationsAudit logging, integrity monitoring

An SBOM is the list of components that make up a piece of software, a manifest of exactly which open-source libraries, packages, and versions are baked into a given application or container image.

Why it matters

  • Fast vulnerability triage: quickly identify which packages are affected
  • License compliance
  • Audit and compliance checks
  • Supply chain attack response

Formats and tools

  • SPDX, CycloneDX, and SWID are the leading formats
  • Tools: syft (Anchore), trivy sbom, GitHub Action generate-sbom, Docker’s native docker sbom

Example SBOM (CycloneDX format):

{
"bomFormat": "CycloneDX",
"specVersion": "1.3",
"components": [
{
"name": "openssl",
"version": "1.1.1n",
"type": "library",
"licenses": ["Apache-2.0"]
},
{
"name": "nginx",
"version": "1.21.6",
"type": "application"
}
]
}

Container image signing attaches a digital signature to an image so anyone consuming it can verify who built it and confirm it hasn’t been tampered with.

Why it matters

  • Confirms an image is trustworthy (origin verification)
  • Confirms an image pulled from a registry hasn’t been altered in transit
  • Lets a CI/CD pipeline restrict deployment to signed images only

Key tools

  • Cosign: an open-source tool for signing OCI images
  • Notary v2 / OCI Artifacts
  • Sigstore: a transparent public log (TUF-based)
  • Solutions built on TUF (The Update Framework)

Integration with Kubernetes

  • Kyverno, OPA Gatekeeper, and similar tools can enforce a policy allowing only signed images
  • An Admission Controller can check a Cosign signature and block deployment if it’s missing
ItemSBOMImage Signing
PurposeRecords what’s inside an imageConfirms who built an image and that it wasn’t tampered with
FormatJSON or XML: CycloneDX, SPDX, etc.Digital signature (Cosign, Notary v2, etc.)
Security benefitVulnerability visibility, license clarity, transparencyIntegrity, trust, supplier authentication
RelationshipDescribes the contents of an imageAuthenticates the image itself

Using GitHub’s Dependency Graph

A public GitHub repo’s Dependency Graph can generate a basic SBOM out of the box. GitHub’s SBOM output format is SPDX, so different formats require different tools. (The actual generated result included a separate JSON attachment; due to sensitivity concerns, this article omits the attachment and describes it in prose only.)

Integrating with a GitHub Actions pipeline

The GitHub Actions Marketplace can be used to integrate SBOM generation with a Container Image push, building on the popular docker build-push actions.

name: ci
on:
push:
env:
IMAGE_NAME: user/app
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
sbom: true
push: true
tags: ${{ steps.meta.outputs.tags }}

The container image’s SBOM can be inspected with a docker buildkit-based command.

docker buildx imagetools inspect ${IMAGE-NAME}:${IMAGE-TAG} --format "{{json .SBOM}}"

Example output:

Other tools

  • Syft: generates SBOMs in the format managed by Anchore
  • Grype: scans for vulnerabilities against SBOMs generated by Syft

Azure Container Registries offer a native image trust capability (the Image Trust feature on the ACR Premium tier). Since we didn’t use the ACR Premium tier for cost reasons in this project, we applied a separate image signing approach and integrated it into the pipeline.

Notation-based image signing

Notation, a part of the Notary project managed by CNCF, implements the OCI signature standard.

Notation-based image signing flow: to reference a certificate registered in Key Vault, the GitHub Actions job acquires permissions via a Managed Identity federated per-branch to the GitHub repo. With a self-hosted runner, permissions can instead be assigned directly to the Pod or VM running inside Azure.

Creating and registering the signing certificate

We used the Azure CLI to create the certificate (this can also be done as Terraform code). Example self-signed certificate input:

# app-img-cert-policy.json File Contetns
{
"issuerParameters": {
"certificateTransparency": null,
"name": "Self"
},
"keyProperties": {
"exportable": false,
"keySize": 2048,
"keyType": "RSA",
"reuseKey": true
},
"secretProperties": {
"contentType": "application/x-pem-file"
},
"x509CertificateProperties": {
"ekus": [
"1.3.6.1.5.5.7.3.3"
],
"keyUsage": [
"digitalSignature"
],
"subject": "CN=app.example.net",
"validityInMonths": 999
}
}

Example Azure CLI command:

az keyvault certificate create -n cert-az01-dev-app-img-01 \
--vault-name kv-az01-dev-app-01 \
-p @app-img-cert-policy.json

Integrating with a GitHub Actions pipeline

The Actions workflow needs Azure login plus a Notation step added. Prior work is needed to federate the User Assigned Managed Identity with GitHub for Azure auth, and the workflow references the URI where the certificate’s key is registered.

permissions:
id-token: write
contents: write
jobs:
ci:
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
name: Build and push container image
runs-on: ubuntu-latest
steps:
- name: ACR login
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_LOGIN_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

Example Action step for signing with Notation:

jobs:
ci:
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
name: Build and push container image
runs-on: ubuntu-latest
steps:
- name: Retrieve digest
run: |
echo "target_artifact_reference=${{ secrets.ACR_LOGIN_SERVER }}/${{ github.event.repository.name }}-${{ steps.extract_branch.outputs.branch }}@${{ steps.push.outputs.digest }}" >> "$GITHUB_ENV"
- name: sign OCI artifact using key pair from AKV
uses: notaryproject/notation-action/sign@v1
with:
plugin_name: azure-kv
plugin_url: https://github.com/Azure/notation-azure-kv/releases/download/v1.1.0/notation-azure-kv_1.1.0_linux_amd64.tar.gz
plugin_checksum: 2fc959bf850275246b044203609202329d015005574fabbf3e6393345e49b884
key_id: ${{ secrets.KV_CERT_ID_IMG_SIGN }}
target_artifact_reference: ${{ env.target_artifact_reference }}
signature_format: cose
plugin_config: |-
self_signed=true
allow_referrers_api: 'true'

Signature verification

Verifying a signature requires importing a trust policy into Notation. We import policy from a file like this:

# trustpolicy.json Contents
{
"version": "1.0",
"trustPolicies": [
{
"name": "sample-images",
"registryScopes": [ "myacr.azurecr.io/app-be-develop" ],
"signatureVerification": {
"level" : "strict"
},
"trustStores": [ "ca:app.example.net" ],
"trustedIdentities": [
"*"
]
}
]
}

Example verify command:

# Import notation image policy
notation policy import ./trustpolicy.json
# Verify image
notation verify myacr.azurecr.io/app-be-develop@sha256:97437da711617d557ead9eaeca5efdb1d64cf6de55f0d8b1c9604971b692ca57

Example successful output:

Previous post: Container Image Vulnerability Management: Registry Scanning and Runtime Risk
Next post: Operating Cloud Security Posture with CSPM