Courseiva
Supply Chain SecurityhardMultiple ChoiceObjective-mapped

CKS Supply Chain Security Practice Question

You are asked to generate an SBOM for a container image and attach it as an attestation using cosign. Which two commands would you run in sequence?

⚠ Common exam trap

In CNCF/CKS exams, a common trap is confusing cosign sign (image signature) with cosign attest (attach an attestation). Also, the SBOM must be generated before it can be attached.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

syft myimage:latest -o spdx > sbom.spdx && cosign attest --type spdx --predicate sbom.spdx myimage:latest

It first uses Syft to generate an SPDX-format SBOM from the container image, then uses cosign attest to attach that SBOM as an in-toto attestation to the image. This sequence satisfies the requirement to generate an SBOM and attach it as an attestation using cosign.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • trivy image --format spdx myimage:latest > sbom.spdx && cosign verify --key cosign.pub myimage:latest

    Why it's wrong here

    Trivy can generate SBOM, but cosign verify is for verification, not for attaching attestations.

  • syft myimage:latest -o spdx > sbom.spdx && cosign attest --type spdx --predicate sbom.spdx myimage:latest

    Why this is correct

    This correctly generates an SBOM in SPDX format and attaches it as an in-toto attestation.

  • cosign sign --key cosign.key myimage:latest && syft myimage:latest -o spdx

    Why it's wrong here

    Signing first is unnecessary and the order is wrong; SBOM generation should precede attestation.

  • crane ls myimage:latest && cosign attest --type spdx --predicate sbom.spdx myimage:latest

    Why it's wrong here

    crane ls lists tags, it does not generate an SBOM.

About these practice questions

One of 114 original CKS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKS practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKS exam.