Verify Images Rules

Check container image signatures and attestations for software supply chain security.

The logical structure of an verifyImages rule is shown below:

Image Verification Rule

Each rule contains the following common configuration attributes:

  • type: the signature type. Sigstore Cosign and Notary are supported.
  • imageReferences: a list of image reference patterns to match
  • required: enforces that all matching images are verified
  • mutateDigest: converts tags to digests for matching images
  • verifyDigest: enforces that digests are used for matching images
  • repository: use a different repository for fetching signatures

A verifyImages rule can contain a list of attestors or authorities used to check the attached image signature. The type of attestor supported will vary based on the tool used to sign the image. For example, Sigstore Cosign supports public keys, certificates, and keyless attestors.

A verifyImages rule can contain a list of attestations i.e., signed metadata, to checked for the image. The nested attestations.attestors are used to verify the signature of the attestation. Any JSON data in an attestation can be verified using a set of attestations.conditions.

The rule mutates matching images to add the image digest, when mutateDigest is set to true (which is the default), if the digest is not already specified. Using an image digest has the benefit of making image references immutable and prevents spoofing attacks. Using a digest helps ensure that the version of the deployed image does not change and, for example, is the same version that was scanned and verified by a vulnerability scanning and detection tool.

The imageVerify rule first executes as part of the mutation webhook as the applying policy may insert the image digest. The imageVerify rules execute after other mutation rules are applied but before the validation webhook is invoked. This order allows other policy rules to first mutate the image reference if necessary, for example, to replace the registry address, before the image signature is verified.

The imageVerify rule is also executed as part of the validation webhook to apply the required and verifyDigest checks:

  • When required is set to true (default) each image in the resource is checked to ensure that an immutable annotation that marks the image as verified is present.
  • When verifyDigest rule is set to true (default) each image is checked for a digest.

The imageVerify rule can be combined with auto-gen so that policy rule checks are applied to Pod controllers.

The attestors declaration specifies one or more ways of checking image signatures or attestations. The attestors.count specifies the required count of attestors in the entries list that must be verified. By default, and when not specified, all attestors are verified.

The attestors.count specifies the required count of attestors in the entries list that must be verified. By default, and when not specified, all attestors are verified.

For additional details please reference a section below for the solution used to sign the images and attestations:


Notary

Verify CNCF Notary format signatures using X.509 certificates.

Sigstore

Verify Sigstore Cosign format signatures and attestations using keys, certificates, or keyless attestors.

Last modified May 30, 2023 at 4:32 AM PST: Notary and other minor changes (#876) (c0fa248)