Interview Prep/DevSecOps/Supply Chain Security at Scale

How do you write an admission policy that verifies both the signer identity and an SBOM attestation?

AdvancedProductionSupply Chain Security at Scale
Answer

With Kyverno:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: verify-acme-images
spec:
  validationFailureAction: Enforce
  webhookTimeoutSeconds: 30
  rules:
    - name: signed-by-ci
      match:
        any:
          - resources:
              kinds: [Pod]
      verifyImages:
        - imageReferences: ["ghcr.io/acme/*"]
          mutateDigest: true
          attestors:
            - entries:
                - keyless:
                    subject: "https://github.com/acme/platform-workflows/.github/workflows/build.yml@refs/heads/main"
                    issuer: "https://token.actions.githubusercontent.com"
          attestations:
            - type: https://cyclonedx.org/bom
              attestors:
                - entries:
                    - keyless:
                        subject: "https://github.com/acme/platform-workflows/.github/workflows/build.yml@refs/heads/main"
                        issuer: "https://token.actions.githubusercontent.com"

Pinning the subject to the reusable build workflow means only images built by the paved road are admitted.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply Chain Security at Scale