#3956·kubescape

C-0236: make the image signature verification policy configurable (no-tlog and keyless signing)

Author: nishantbkl3345-ship-itCreated Sep 28, 2026Updated Sep 28, 2026

Overview

Control C-0236 ("Verify image signature") is backed by the regolibrary rule verify-image-signature, which calls the cosign.verify(image, key) Rego builtin once for each entry in data.postureControlInputs.trustedCosignPublicKeys. The builtin is implemented by verify() in core/pkg/opaprocessor/cosign_verify.go.

verify() hardcodes a single policy: a PEM public key, a Rekor entry required, and the claim check that was added in #3930. The only thing an operator can configure is the list of public keys.

Problem

Two common signing setups can't be expressed today, and C-0236 reports them as failures:

  1. Key-signed images without a transparency-log entry. cosign sign --key ... --tlog-upload=false is the usual flow for private registries and air-gapped clusters. verify() sets RekorPubKeys but no RekorClient and no IgnoreTlog, so cosign's online lookup path errors out. Run against upstream/master (11038ce7) with an in-memory registry and a correctly key-signed image whose signature has no bundle:

    key-signed, no Rekor bundle: ok=false err=verifying signature: no matching signatures: rekor client not provided for online verification

    The rule then emits signature not verified for image: .... Rejecting this by default is correct: cosign verify --key does the same. But the CLI lets the operator opt out with --insecure-ignore-tlog or --rekor-url, and C-0236 gives no equivalent.

  2. Keyless (Fulcio/OIDC) signatures. The builtin accepts only a public key, so images signed with cosign sign keyless (identity + OIDC issuer, as most CI pipelines now do) can never pass C-0236, whatever the operator configures.

The file already lists the settings that were apparently meant to exist. VerifyCommand in the same file declares RekorURL, CertIdentity, CertOidcIssuer, EnforceSCT, RegistryOptions and others, but the type has no constructor and no references anywhere in the repository.

Solution

Expose the verification policy through control inputs, the project's existing mechanism for per-deployment settings, and translate them into cosign.CheckOpts in verify(). For example:

  • cosignRequireTransparencyLog (default true, today's behaviour). When false, set CheckOpts.IgnoreTlog = true, equivalent to cosign verify --insecure-ignore-tlog.
  • cosignRekorURL (optional): build CheckOpts.RekorClient so signatures without a bundle can be checked online against a public or private Rekor.
  • Later: keyless trust entries (certIdentity / certOidcIssuer, with regexp variants) checked against the Fulcio roots, so C-0236 can cover keyless signing.

Defaults would keep today's results unchanged. This needs a matching change in kubescape/regolibrary to pass the new inputs to the builtin, whether through extra arguments or a new builtin, so I'd like maintainer input on the shape before starting.

The unused VerifyCommand struct could be removed as part of this or wired up as the options holder.

Alternatives

  • Always set IgnoreTlog = true. This is simpler, but it would also stop checking the Rekor bundle on public images, which weakens the control for everyone.
  • Document that C-0236 supports only key-signed images that have a Rekor entry. That's honest, but it leaves private-registry and keyless users with a control that always fails.

Additional context

  • core/pkg/opaprocessor/cosign_verify.go (verify(), VerifyCommand)
  • core/pkg/opaprocessor/utils.go (cosign.verify builtin registration)
  • kubescape/regolibrary rules/verify-image-signature/raw.rego, controls/C-0236-verifyimagesignature.json
  • Related: #3930 (claim verification, merged). #2992 is about signing kubescape's own output, not verifying images.