NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
PipelineJune 8, 202610 min read

Securing Your Container Supply Chain: SBOM, Cosign Signing, and SLSA Provenance in One Pipeline

Generate an SBOM, sign with cosign, attach SLSA provenance, and enforce with Kyverno. One GitHub Actions pipeline.

R
Founder, O3 Security
Container
Security illustration
Key takeaways
  • Most container security guides stop at 'scan your image.' Supply chain attacks require four layers: SBOM generation, image signing, provenance attestation, and admission enforcement.
  • Cosign keyless signing uses ephemeral OIDC-backed certificates. No long-lived private keys to rotate, leak, or manage in CI.
  • SLSA Build Level 3 provenance is a signed attestation that records exactly which source commit and build system produced your image. It's automatable with slsa-github-generator in one workflow step, though that project is no longer actively maintained and GitHub artifact attestations are the maintained path.
  • Kyverno policies can block any unsigned or unattested image at the Kubernetes admission layer, so even a compromised registry can't sneak an image into production.
  • The March 2026 trivy-action incident (76 of 77 version tags poisoned via force-push) is exactly why tag-based pulls without signature verification are dangerous.

On 19 March 2026, 76 of 77 version tags in the aquasecurity/trivy-action repository were force-pushed to malicious commits. Anyone using a tag pin (rather than a commit SHA) silently pulled a tampered scanner. The tag rewrite needed no registry compromise (the same campaign also pushed malicious Trivy images to Docker Hub). It exploited one simple fact: tags are mutable, and nobody was checking signatures.

That's the supply chain threat container teams face. Not a bug inside your app. A compromise of the build artifacts flowing into your cluster. A poisoned base image. A hijacked CI action. A registry mirror serving stale layers. CVE scanning is necessary. It's not enough. What you need is a chain of custody from source commit to running pod.

This guide builds that chain. By the end you'll have a GitHub Actions pipeline that does four things: generates a machine-readable SBOM, signs your image with cosign keyless (no long-lived secrets), attaches SLSA Build Level 3 provenance, and enforces all three at the Kubernetes admission layer with Kyverno. Every step uses open-source tooling. Each layer adds to the one before it.

Tip

You can adopt these layers incrementally. Each one independently reduces risk. Start with SBOM generation in CI, add signing next week, and layer in admission enforcement when you're ready. You don't need all four on day one.

Why four layers? What each one actually stops

Before writing any YAML, it's worth understanding what threat each layer addresses. They're different threats, and skipping one leaves a real gap.

LayerToolWhat it stops
SBOM generationSyft or TrivyUnknown composition: you can't triage a Log4Shell if you don't know who's shipping log4j-core in their image.
Image signingcosign (keyless)Tampered or substituted images: a signed image from your registry can be verified to come from your build, not an attacker's.
SLSA provenanceslsa-github-generatorBuild-time compromise: provenance links the image digest to the exact source commit and build job, so you can detect a poisoned pipeline.
Admission enforcementKyvernoRuntime introduction of unsigned images: blocks pods that lack a valid signature or provenance attestation from starting in the cluster.
Each supply chain security layer and the attack it stops.

What you'll need

  • A GitHub repository with Actions enabled
  • A container registry that supports OCI 1.1 artifacts (Docker Hub, GHCR, ECR, GCR, and ACR all work)
  • A Kubernetes cluster (local kind/k3d works fine for testing) with Kyverno installed
  • The cosign CLI installed locally for verification steps (brew install cosign / go install github.com/sigstore/cosign/v3/cmd/cosign@latest)

Layer 1: Generate an SBOM inside the container build

An SBOM (Software Bill of Materials) is a structured inventory of every package, library, and OS component inside your image. It's what lets you answer "are we affected by CVE-2021-44228?" in minutes rather than hours. The right place to generate it is immediately after the docker build step, before the image leaves CI.

We'll use Syft (from Anchore) to generate a CycloneDX 1.6 SBOM and push it as a signed attestation bound to the image digest. This keeps the SBOM co-located with the image in your registry. No separate storage, no sync problem.

Note

CycloneDX 1.6 is the format of choice here: it's the same format used for CBOM, AIBOM, and HBOM, making it easy to extend your container inventory into a full BOM posture later. SPDX is a valid alternative if your toolchain already produces it.

Add this to your GitHub Actions workflow after the docker/build-push-action step:

  1. Install Syft: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
  2. Generate the SBOM: syft ${IMAGE}@${DIGEST} -o cyclonedx-json > sbom.cdx.json
  3. Attest it to the image: cosign attest --yes --type cyclonedx --predicate sbom.cdx.json ${IMAGE}@${DIGEST}
  4. Optionally scan the SBOM for known CVEs with Grype: grype sbom:sbom.cdx.json --fail-on high

A note on using the image digest rather than the tag: the digest is immutable. Once you've pinned your SBOM to a digest, you know exactly which image layers it describes. Tags can be overwritten (see the trivy-action incident). Throughout this guide we work with digests.

Layer 2: Sign the image with cosign keyless

Image signing proves that an image came from your pipeline and hasn't been tampered with. The old way: store a long-lived private key as a CI secret, rotate it, scan for leaks, repeat. It works. It's also annoying.

Cosign keyless signing removes long-lived keys entirely. GitHub Actions issues a short-lived OIDC token for each workflow run. Cosign uses that token to get an ephemeral certificate from Sigstore's Fulcio CA. The signature lands in Sigstore's Rekor transparency log. To verify, you check the log. No private key to manage, rotate, or lose.

“Keyless signing doesn't mean 'no cryptography.' It means 'no long-lived secret to rotate, leak, or lose.' The private key exists for milliseconds inside the GitHub Actions runner.”

The GitHub Actions steps are straightforward once you understand the flow:

  1. Add id-token: write and contents: read to your workflow permissions (this is what lets Actions fetch an OIDC token)
  2. Install cosign: uses: sigstore/[email protected]
  3. Sign after push: cosign sign --yes ${IMAGE}@${DIGEST} (cosign fetches the OIDC token automatically in Actions)
  4. Verify locally: cosign verify --certificate-oidc-issuer https://token.actions.githubusercontent.com --certificate-identity-regexp '^https://github\.com/YOUR_ORG/YOUR_REPO/\.github/workflows/' ${IMAGE}@${DIGEST}

The verification command is the critical part: it checks that the certificate was issued by GitHub Actions for your specific repository. The ^ anchor and the trailing /.github/workflows/ matter: cosign treats the pattern as a substring match, so an unanchored 'https://github.com/YOUR_ORG/YOUR_REPO' would also accept a signature from YOUR_REPO-fork. Anchored, a workflow in a different repository cannot produce a valid signature for yours.

Watch out

Do NOT use cosign sign without --yes in automation. It prompts for user input and will hang. Also confirm your registry supports OCI referrers (needed to attach the signature). GHCR, ECR (with OCI 1.1 enabled), and GCR all do.

Layer 3: Attach SLSA Build Level 3 provenance

A cosign signature proves an image is authentic. SLSA provenance proves how it was built. That distinction matters. If your build pipeline gets compromised (a malicious build step injected, a GitHub Action hijacked) the image might be legitimately signed but built from something you didn't intend.

SLSA provenance is a signed attestation. It records the source repo, the commit SHA, the build system, and the environment that produced the artifact. At Level 2, it must be signed by the build service itself (GitHub Actions), not just your key. That closes the self-attestation gap. Level 3, which the generator below targets, also keeps the signing material out of reach of your own build steps.

The SLSA GitHub Generator project makes Build Level 3 provenance a single reusable workflow call. The project is no longer actively maintained (existing workflows still run); for new pipelines its README points to GitHub artifact attestations, verified with gh attestation verify, which reach Build L3 when the build runs in a reusable workflow. The generator steps are:

  1. In your existing workflow, output the image digest as a job output: echo "digest=$(docker inspect --format='{{index .RepoDigests 0}}' ${IMAGE} | cut -d'@' -f2)" >> $GITHUB_OUTPUT
  2. Add a separate job that calls the reusable workflow: uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
  3. Pass image: ${{ env.IMAGE }} and digest: ${{ needs.build.outputs.digest }} as inputs, plus registry-username and the registry-password secret (the job also needs actions: read, id-token: write and packages: write)
  4. The generator job runs as a separate, isolated job and signs the provenance with its own OIDC identity, distinct from your build job

The result is a signed provenance attestation pushed to your registry alongside the image. You can verify it with slsa-verifier verify-image --source-uri github.com/YOUR_ORG/YOUR_REPO ${IMAGE}@${DIGEST}.

Key takeaway

SLSA Build Level 3 (the top of the build track) adds isolation between runs and keeps signing secrets away from user build steps; slsa-github-generator's container workflow targets it. Level 2 is the practical floor for most teams: the provenance is signed by the build platform, not by you, which means it can't be self-issued by a compromised build job.

Layer 4: Enforce at admission with Kyverno

Signing and provenance only protect you if something actually checks them. A Kyverno ClusterPolicy running in your cluster can verify the cosign signature and SLSA attestation at admission time, before any pod is allowed to start. This closes the gap: even if someone pushes an unsigned image to your registry, it can't run in production.

Install Kyverno via Helm if you haven't already (after helm repo add kyverno https://kyverno.github.io/kyverno/ and helm repo update): helm install kyverno kyverno/kyverno -n kyverno --create-namespace. Then apply a policy that requires a valid cosign signature:

A minimal signature verification policy in Kyverno looks like this:

  1. Create a ClusterPolicy of kind ClusterPolicy whose verifyImages rule sets failureAction: Enforce
  2. Under rules, add a verifyImages rule targeting your registry prefix (e.g. ghcr.io/YOUR_ORG/*)
  3. Set attestors to your GitHub Actions OIDC issuer and subject pattern (this is what ties the signature to your specific repository)
  4. Optionally add an attestations block requiring the SLSA provenance predicate type https://slsa.dev/provenance/v1
  5. Test by attempting to run an unsigned image. Kyverno should block it with a clear audit log entry

Start with failureAction: Audit (logs without blocking) to understand what would be blocked before flipping to Enforce. (Kyverno 1.13 deprecated the older policy-level validationFailureAction field, so set this on the rule.) This is especially important if you're rolling Kyverno into an existing cluster with a mix of signed and unsigned images.

Putting it together: the complete pipeline

Here's the structure of the complete GitHub Actions workflow. There are three jobs: build (build, push, generate SBOM, sign), provenance (SLSA attestation via the reusable workflow), and a verify job that runs as a gate before any deployment proceeds.

  1. build job: checkout → login to registry → build and push → get digest → generate SBOM with Syft → attest SBOM → sign image with cosign keyless → output digest
  2. provenance job: depends on build → calls slsa-framework/slsa-github-generator with the image and digest
  3. deploy job (optional): depends on both → runs cosign verify + slsa-verifier verify-image as a pre-deploy gate. Fail fast before any kubectl apply
Pro tip

Pin your GitHub Actions to commit SHAs, not tags (e.g. sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6, the v4.1.2 commit, not @v4). The exception is slsa-github-generator, which must be referenced by its full @vX.Y.Z tag. The trivy-action incident was a tag-based attack. Dependabot can keep your SHA pins current automatically.

SBOM-driven vulnerability triage

The SBOM you generate isn't just a compliance artifact. It's the foundation for prioritized vulnerability triage. Once every image has a machine-readable SBOM attached as an OCI artifact, your security tooling can continuously scan for new CVEs without re-pulling images. When Log4Shell dropped in December 2021, teams with SBOMs found every affected image in minutes; teams without them spent weeks running manual grep exercises.

The workflow is: new CVE published → your scanner matches it against the indexed SBOMs → affected images surfaced immediately with exact package version and all affected tags/digests. Pair this with reachability analysis (is the vulnerable function actually called?) to prioritize which findings need emergency patching vs. which can wait for the next release cycle.

By the numbers

Studies consistently show 60–80% of SCA/container CVE alerts are for packages not reachable in the application's execution path. Reachability analysis is what separates an actionable alert from noise.

Mapping to CERT-In and SEBI requirements

If you're operating in India under CERT-In's Technical Guidelines v2.0 (July 2025) or SEBI's cybersecurity circular, this pipeline directly addresses several requirements. CERT-In's guidelines say software supplied to government, public-sector and essential-services organisations must come with a complete SBOM, and encourage every organisation to make SBOMs standard practice. The provenance attestation addresses the supply chain integrity requirements. Image signing satisfies the artifact authenticity controls.

Pipeline layerCERT-In v2.0 requirementSEBI relevance
SBOM generationRequired for software supplied to government, public sector and essential services; 21 data fields including supplier, version, licenseSEBI cybersecurity circular: software transparency for regulated entities
Image signingArtifact integrity controls; audit trail of software provenanceNon-repudiation requirements for software delivery
SLSA provenanceBuild integrity; tamper-evident build pipeline evidenceApplicable to tech infrastructure of market intermediaries
Admission enforcementRuntime control; only authorized software executesRuntime security controls for systemically important entities
Pipeline layers mapped to CERT-In v2.0 and SEBI requirements.

Common pitfalls

  • Signing the tag, not the digest. Tags are mutable. Always sign and verify by digest (@sha256:...). cosign will warn you if you try to sign a tag.
  • Forgetting id-token: write permissions. Without this, GitHub won't issue an OIDC token and keyless signing fails silently with a confusing auth error.
  • OCI referrers support. Some private registries don't support OCI 1.1 referrers by default. Check that your registry accepts cosign attest before you build the pipeline.
  • Kyverno in Audit before Enforce. Jumping straight to Enforce in production is how you cause an outage. Always run a 48-hour Audit window first to inventory unsigned images.
  • Not pinning the slsa-github-generator version. Same logic as pinning any Action: use the full release tag (@vX.Y.Z). Unlike most Actions, the generator must not be pinned to a commit SHA or a short tag.

Frequently asked questions

What is the difference between cosign image signing and SLSA provenance?

+
Cosign signing proves a specific image digest came from your trusted registry/pipeline and wasn't tampered with. SLSA provenance goes further: it records exactly which source commit, build system, and build job produced the image. Signing verifies authenticity; provenance verifies build integrity. Both together mean you can trace any running container back to a specific line of source code.

Does cosign keyless signing require Sigstore or can I use my own PKI?

+
Cosign supports both. Keyless signing (the default for GitHub Actions) uses Sigstore's Fulcio CA and Rekor transparency log. No infrastructure to run. For air-gapped or regulated environments, cosign also supports hardware keys (YubiKey, HSM) and private PKI via KMS providers (AWS KMS, GCP KMS, HashiCorp Vault). Choose based on your compliance requirements.

What SLSA level should most teams target for container images?

+
SLSA Level 2 is the practical target for most teams. It requires the provenance to be generated and signed by the build service (GitHub Actions) rather than self-signed, which closes the self-attestation gap. Level 3 adds hardened builds: runs can't influence one another, and the provenance signing secrets stay out of reach of user-defined build steps. The generator used in this guide already targets Level 3, and GitHub artifact attestations reach it when the build runs in a reusable workflow.

Can I use Trivy instead of Syft to generate the SBOM?

+
Yes. Trivy generates CycloneDX and SPDX SBOMs directly from container images: trivy image --format cyclonedx --output sbom.cdx.json myimage:tag. Trivy works well and is already in most container security pipelines. Either SBOM can be attested to the image digest with cosign attest.

Does Kyverno work with clusters other than Kubernetes?

+
Kyverno is Kubernetes-native (it runs as a webhook admission controller). For non-Kubernetes container runtimes (Nomad, ECS, raw Docker), you'd use Connaisseur (for Docker/containerd) or admission-controller equivalents in your platform. The core verification logic (cosign verify against an OIDC subject) is portable and CLI-invokable regardless of orchestrator.

How does this pipeline address CERT-In's SBOM guidelines for containerized applications?

+
CERT-In's Technical Guidelines v2.0 (July 2025) say software supplied to government, public-sector and essential-services organisations must come with a complete SBOM carrying the 21 data fields in section 4.2 (supplier, version, hashes, license, etc.). A scanner like Syft fills the component-identity fields; others, such as criticality, end-of-life date and usage restrictions, record your own decisions and have to be added separately. The SBOM attested to the image digest means you can produce it on demand for any image, which is the evidence an auditor will ask for.

Sources

  1. https://github.com/aquasecurity/trivy/security/advisories/GHSA-69fq-xp46-6x23
  2. https://docs.sigstore.dev/cosign/signing/overview/
  3. https://docs.sigstore.dev/quickstart/quickstart-ci/
  4. https://docs.sigstore.dev/cosign/system_config/installation/
  5. https://github.com/sigstore/cosign/blob/main/doc/cosign_verify.md
  6. https://github.com/sigstore/cosign/blob/main/internal/ui/warnings.go
  7. https://github.com/sigstore/cosign/blob/main/cmd/cosign/cli/attach.go
  8. https://docs.sigstore.dev/cosign/signing/other_types/
  9. https://github.com/anchore/syft
  10. https://github.com/anchore/grype
  11. https://cyclonedx.org/specification/overview/
  12. https://slsa.dev/spec/v1.2/build-track-basics
  13. https://slsa.dev/spec/v1.2/provenance
  14. https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/container/README.md
  15. https://github.com/slsa-framework/slsa-github-generator
  16. https://github.com/slsa-framework/slsa-verifier
  17. https://docs.github.com/en/actions/concepts/security/artifact-attestations
  18. https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect
  19. https://github.com/opencontainers/distribution-spec/blob/main/spec.md
  20. https://kyverno.io/docs/installation/methods/
  21. https://kyverno.io/docs/policy-types/cluster-policy/verify-images/sigstore/
  22. https://kyverno.io/docs/policy-types/cluster-policy/policy-settings
  23. https://kyverno.io/docs/policy-types/image-validating-policy/
  24. https://cert-in.org.in/PDF/TechnicalGuidelines-on-SBOM,QBOM&CBOM,AIBOM_and_HBOM_ver2.0.pdf
  25. https://www.sebi.gov.in/legal/circulars/aug-2024/cybersecurity-and-cyber-resilience-framework-cscrf-for-sebi-regulated-entities-res-_85964.html
  26. https://nvd.nist.gov/vuln/detail/CVE-2021-44228

See your full attack chain.
Code, build, runtime. One platform.