QA
Senior LevelDocker & Deployment

How do you enforce Supply Chain Security using Sigstore Cosign and Kyverno in K8s?

❓ Interview Prompt: Explain Sigstore keyless signing, Cosign image attestation, Kyverno image verification policy, and SLSA provenance for supply chain integrity.

Supply chain attacks compromise software during the build/publish process — attackers inject malicious code into legitimate container images (e.g., SolarWinds-style attacks). Image signing proves that an image was built by a specific pipeline and hasn't been tampered with.

Sigstore + Cosign Architecture:

Sigstore is an open standard for signing software artifacts using ephemeral cryptographic keys and a public transparency log.

1
Keyless Signing (OIDC-based): CI/CD pipeline authenticates with its OIDC identity (GitHub Actions OIDC, Google Workload Identity). Cosign gets a short-lived certificate from Fulcio (Sigstore CA) bound to that identity.
2
Signing: Cosign computes the image SHA256 digest and creates a signature using the ephemeral key.
3
Rekor (Transparency Log): Signature is published to Rekor — a tamper-evident, append-only log. Anyone can verify when and by whom an image was signed.
4
Attestations: Additional metadata (SBOM, SLSA provenance, vulnerability scan results) can be signed and attached as OCI artifacts.

Kyverno Image Verification:

Kyverno's verifyImages policy verifies Cosign signatures as an admission webhook — rejecting pods with unsigned or invalid image signatures before they schedule.

Code Implementation Example

yaml
# Step 1: Sign image in GitHub Actions CI (keyless)
# - uses: sigstore/cosign-installer@v3
# - run: cosign sign --yes ghcr.io/myorg/myapp:${{ github.sha }}
# This records signature to Rekor transparency log

# Step 2: Kyverno policy — verify image signatures before scheduling
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-signed-images
spec:
  validationFailureAction: Enforce    # Reject unsigned images
  rules:
    - name: verify-image-signature
      match:
        any:
          - resources:
              kinds: [Pod]
              namespaces: [production]
      verifyImages:
        - imageReferences:
            - "ghcr.io/myorg/*"        # Apply to all images from our registry
          attestors:
            - entries:
                - keyless:
                    subject: "https://github.com/myorg/myrepo/.github/workflows/build.yml@refs/heads/main"
                    issuer: "https://token.actions.githubusercontent.com"
                    rekor:
                      url: https://rekor.sigstore.dev
          # Also require SBOM attestation
          attestations:
            - type: https://spdx.dev/Document
              attestors:
                - entries:
                    - keyless:
                        subject: "https://github.com/myorg/*"
💡Kyverno verifyImages: reject pods from production unless image is signed by GitHub Actions OIDC identity and logged in Rekor.
🎯 Interview Key Takeaway

Cosign keyless signing (OIDC → Fulcio certificate → Rekor log) creates verifiable supply chain provenance. Kyverno enforces image signature verification as admission webhook — blocks unsigned images.

#Cosign#Sigstore#Supply Chain#Kyverno#Image Signing#Senior
Back to all Docker & Deployment Questions→

More Docker & Deployment Interview Questions

Beginner LevelDocker & Deployment

How do Docker Multi-Stage Builds minimize image size and improve security?

Beginner LevelDocker & Deployment

What is the difference between a Docker Container and a Virtual Machine (VM)?

Beginner LevelDocker & Deployment

What is the difference between a Docker Image and a Docker Container?