Software Supply Chain & SBOM Engineering Playbook
Implementing end-to-end supply chain defense: Software Bill of Materials (SBOM) generation with Syft, vulnerability scanning with Grype, and artifact cryptographic signing with Sigstore/Cosign.
Implementing end-to-end supply chain defense: Software Bill of Materials (SBOM) generation with Syft, vulnerability scanning with Grype, and artifact cryptographic signing with Sigstore/Cosign.
1. Generating Software Bills of Materials (SBOM) with Syft
A Software Bill of Materials (SBOM) catalogs all direct and transitive open-source dependencies, licenses, and file digests included in a build:
# Generate standard CycloneDX JSON SBOM for a container image
syft packages company/api:latest -o cyclonedx-json=api-sbom.json
# Generate SPDX JSON SBOM for a source repository directory
syft dir:. -o spdx-json=repo-sbom.json2. Vulnerability Scanning with Grype
Match the generated SBOM against live vulnerability databases (NVD, GitHub Security Advisories) to identify unpatched packages:
# Scan the SBOM and fail the build if CRITICAL or HIGH vulnerabilities exist
grype sbom:api-sbom.json --fail-on high --only-fixed3. Cryptographic Artifact Signing with Sigstore Cosign
Digitally sign container images in your CI/CD pipeline so Kubernetes admission controllers reject unsigned or tampered images:
# 1. Sign container image using private key
cosign sign --key cosign.key company/api:latest
# 2. Attest the CycloneDX SBOM to the container image
cosign attest --key cosign.key --type cyclonedx --predicate api-sbom.json company/api:latest
# 3. Verify image signature before deploying to cluster
cosign verify --key cosign.pub company/api:latest