|
| 1 | +# Verifying Knative Images |
| 2 | + |
| 3 | +Knative publishes SBOMs and SLSA provenance documents for each image in the |
| 4 | +Knative release. You can also use this information to configure [the sigstore |
| 5 | +policy controller](https://docs.sigstore.dev/policy-controller/overview/) or |
| 6 | +other admission controllers to check for these image attestations. |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +You will need to install the [cosign tool](https://github.com/sigstore/cosign/tree/main) |
| 11 | +to fetch and interact with the attestations stored in the container registry. |
| 12 | + |
| 13 | +## Knative SLSA Provenance (signed) |
| 14 | + |
| 15 | +The Knative build process produces a SLSA [in-toto](https://in-toto.io/) |
| 16 | +attestation for each image in the build process. For a given image in the |
| 17 | +Knative release manifests, you can verify the build attestation using the |
| 18 | +following: |
| 19 | + |
| 20 | +```bash |
| 21 | +cosign verify-attestation \ |
| 22 | + --certificate-oidc-issuer https://accounts.google.com \ |
| 23 | + --certificate-identity [email protected] \ |
| 24 | + --type slsaprovenance02 \ |
| 25 | + $IMAGE |
| 26 | +``` |
| 27 | + |
| 28 | +Note that the in-toto document is base64 encoded in the `.payload` attribute |
| 29 | +of the attestation; you can use `jq` to extract this with the following |
| 30 | +invocation: |
| 31 | + |
| 32 | +```bash |
| 33 | +cosign verify-attestation \ |
| 34 | + --certificate-oidc-issuer https://accounts.google.com \ |
| 35 | + --certificate-identity [email protected] \ |
| 36 | + --type slsaprovenance02 \ |
| 37 | + $IMAGE | jq -r .payload | base64 --decode | jq |
| 38 | +``` |
| 39 | + |
| 40 | +## Knative SBOMs |
| 41 | + |
| 42 | +For each container image, Knative publishes an SBOM corresponding to each |
| 43 | +image. These SBOMs are produced during compilation by the |
| 44 | +[`ko` tool](https://ko.build/), and can be downloaded using the `cosign download sbom` |
| 45 | +command. Note that the image references in the Knative manifests are to |
| 46 | +multi-architecture images; to extract the software components for a particular |
| 47 | +architecture (as different architectures may build with different libraries), |
| 48 | +you will need to run `cosign download sbom` on the architecture-specific image |
| 49 | +(e.g. for `linux/amd64`). |
0 commit comments