Opscraft
DevSecOps & secrets management · Lesson 2 of 7 · 4 min read

Software supply chain security

Threats

Compromised dependencies (malicious package versions, typosquatting, dependency confusion), compromised build systems (tampered CI, malicious actions/plugins), tampered artifacts in registries, leaked publishing credentials. Real-world examples: SolarWinds (build compromise), Codecov (CI script tampered), xz-utils (backdoored upstream), compromised GitHub Actions leaking secrets.

Enlarge diagramSourcestolen commits,bad PRsDependenciesmalicious ortyposquattedBuildtampered CI, badactionsRegistryswapped imagesDeployunverified imagesrun
Figure 1. Where a software supply chain can be attacked, from source to running workload.
Swipe sideways to see all of it, or tap to open it full screen.

SBOMs

A Software Bill of Materials lists every component and version in an artifact — formats SPDX and CycloneDX. Generate at build time (Syft, Trivy, CycloneDX Maven/Gradle plugins, docker buildx --sbom=true), store alongside the image (as an attestation), and query when a new CVE drops ("which running images contain log4j-core 2.14?"). Tools like Dependency-Track ingest SBOMs for continuous monitoring.

Signing and provenance

  • Sigstore cosign signs images and attestations. Keyless signing: CI uses its OIDC identity (e.g. GitHub Actions workflow identity) to get a short-lived certificate from Fulcio; signatures are logged in the Rekor transparency log — no long-lived signing keys to protect. Key-based signing with AWS KMS keys is the alternative.
cosign sign --yes 123456789012.dkr.ecr.ap-south-1.amazonaws.com/orders@sha256:abc...
cosign verify \
  --certificate-identity-regexp 'https://github.com/acme/orders/.github/workflows/.*' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  123456789012.dkr.ecr.ap-south-1.amazonaws.com/orders@sha256:abc...
  • Provenance (SLSA): a signed statement of how an artifact was built — source repo, commit, builder, parameters. GitHub's actions/attest-build-provenance, SLSA GitHub generators.
  • Verify at admission: Kyverno verifyImages, Sigstore policy-controller, or Gatekeeper + Ratify — only images signed by your CI identity (and with provenance from your repos) may run. Reference images by digest, not mutable tags.
Enlarge diagramCI buildGitHub OIDCidentitycosign signkeyless, logged inRekorECRimage + signature+ SBOMadmissionKyvernoverifyImagesAn image built anywhere else has no valid signature, so it is rejected.
Figure 2. Signing and verifying: CI signs the image with its own identity; the cluster only admits images signed by that identity.
Swipe sideways to see all of it, or tap to open it full screen.

SLSA levels (simplified)

Level Requirement
Build L1 Provenance exists
Build L2 Hosted build platform, signed provenance
Build L3 Hardened build platform — isolated, ephemeral builds; provenance can't be forged by the build's tenant
Enlarge diagramBuild L3hardened, isolated, ephemeral builders: provenance cannot be forged by the buildBuild L2hosted build platform signs the provenanceBuild L1provenance exists
Figure 3. SLSA build levels: each level makes it harder to fake how an artifact was built.
Swipe sideways to see all of it, or tap to open it full screen.

Hardening the pipeline itself

  • Least-privilege CI tokens, OIDC to clouds, no long-lived secrets on runners.
  • Ephemeral, isolated runners; untrusted PR code never gets secrets.
  • Pin actions/plugins/base images by digest/SHA; restricted allow-lists.
  • Protected branches, required reviews, CODEOWNERS for pipeline and IaC files.
  • Separate build and deploy identities; production deploy needs approvals.
  • Audit logs of the CI system shipped centrally.