---
title: "Image signature verification"
description: "How a container image scan verifies cosign signatures and attestations against keys you trust, how a policy requires a signed image, and what is not verified."
---

When TRUSTIVAN scans a container image it also looks for the
[cosign](https://github.com/sigstore/cosign) signatures and attestations
published beside that image, verifies them against the public keys your
policies trust, and records the result on the scan. A policy rule can then
refuse an image that is not signed by one of those keys.

<Note>
Both kinds are verified: **key-based** signatures (`cosign sign --key`) against
the public keys a rule trusts, and **keyless** signatures (a short-lived Fulcio
certificate with a Rekor bundle, `cosign sign` with OIDC) against the Sigstore
public-good trust root and the signer identity a rule trusts. See
[Keyless signers](#keyless-signers) and [Limits](#limits).
</Note>

## Require a signed image

Add a rule with `signed_by` to a policy. It holds the public keys you trust,
exactly as cosign writes them to `cosign.pub`:

```bash
curl -s -X POST "https://app.trustivan.com/api/v1/policies/$POLICY_ID/versions" \
  -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d @- <<'JSON'
{
  "rules": [
    {
      "id": "signed-by-release",
      "description": "Image must be signed by the release key",
      "effect": "fail",
      "signed_by": [
        {
          "name": "release",
          "public_key": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE...\n-----END PUBLIC KEY-----\n"
        }
      ]
    },
    { "id": "no-criticals", "effect": "fail", "min_severity": "critical" }
  ]
}
JSON
```

Creating a policy version needs a signed-in owner or admin; an API key cannot
change a policy. In the dashboard, open the policy, choose **New version**, and
turn on **Require a cosign signature on the image** on a rule: the editor clears
the rule's finding conditions and the ignore effect, and **Add a keyless signer**
takes a name, the OIDC issuer (GitHub Actions, GitLab, Google and the Sigstore
public issuer are offered) and the subject, either exactly (it is escaped into
a pattern for you) or as a pattern. It checks a signer as the API does (below)
before the version is sent, and a signature rule with no signer cannot be
submitted. Public keys already on a rule are kept and can be removed there;
adding one is done through the API.

A signature rule:

- **is about the image, not about findings.** It cannot be combined with
  `min_severity` or any other finding condition in the same rule; write those
  as a second rule, as above.
- takes effect `fail` or `warn`, and up to 10 keys. The image must be signed
  by **any one** of them.
- **does not apply** to a scan of a repository, a filesystem or an SBOM, and
  says so in the verdict.
- accepts a PEM public key (`-----BEGIN PUBLIC KEY-----`). Anything else,
  including a private key pasted by mistake, is refused when the version is
  created, and the error does not repeat what was pasted. ECDSA P-256, which
  is what `cosign generate-key-pair` produces, is the key type the tests use;
  RSA and Ed25519 keys go through the same library and have no test.

### Scan after adding a key

A scan verifies against the keys trusted by the **latest version of every
policy** in your organization at the moment it runs, whether or not the
policy is enabled. So the order is: add the rule, scan the image, then request
a verdict. A scan that ran before the key was added did not check it, and the
rule fails with *"this scan did not check the image against this rule's keys;
scan the image again"*.

Because disabled policies count, you can add a signature rule to a draft
policy, scan, read the result on the scan, and enable the policy once it
decides what you expect.

## What the rule decides

The rule passes in exactly one case: the scan verified a signature made by
one of the rule's keys. Everything else fails it (or warns, if that is its
effect), including the cases where TRUSTIVAN could not tell:

| What the scan found | Verdict says |
|---|---|
| A signature by one of the rule's keys | *signed by release*: the rule passes |
| Signatures, none by a key the rule trusts | *the image is not signed by a key this rule trusts* |
| No signature | *the image is not signed* |
| The registry could not be read | *the image's signatures could not be read* |
| The scan predates the key, or made no signature check | *scan the image again* |

A registry outage therefore blocks a gated build rather than letting an
unsigned image through. That is deliberate.

## What a scan records

`GET /api/v1/scans/{id}` returns the check as `signature_verification`, and
the scan's page in the dashboard shows it under **Target → Image signature**:

```json
{
  "status": "verified",
  "digest": "sha256:7a7f5113…",
  "checked_at": "2026-10-13T12:31:21Z",
  "trusted_keys": [{ "name": "release", "fingerprint": "sha256:3f1c…" }],
  "signatures": [
    { "verified": true, "key": { "name": "release", "fingerprint": "sha256:3f1c…" } }
  ],
  "attestations": [
    { "predicate_type": "https://slsa.dev/provenance/v0.2", "verified": true,
      "key": { "name": "release", "fingerprint": "sha256:3f1c…" } }
  ]
}
```

| `status` | Meaning |
|---|---|
| `verified` | At least one signature was verified by a trusted key |
| `unverified` | Signatures exist; no trusted key verifies any of them, or no key is trusted yet |
| `unsigned` | The registry holds no cosign signature for the image |
| `unknown` | The registry could not be read. Not evidence either way |

The field is absent when no check was made: the scan was of something other
than a container image, or it ran before this feature existed.

A key is identified by its `fingerprint`, the SHA-256 of the public key, so
the same key is the same key however it was pasted.

### How a signature is verified

For each signature next to the image, TRUSTIVAN checks two things, and both
must hold:

1. one of your trusted keys verifies the signature over its signed payload;
2. that payload names **this image's digest**.

The second check is what stops a genuine signature for one image being copied
beside another. An attestation is verified the same way: the key must verify
the envelope, and the statement inside must name this image's digest. Its
`predicate_type` is read from the signed statement.

A tag is resolved to a digest first, and for a multi-platform tag that is the
digest of the index. TRUSTIVAN looks for signatures on that digest and, when
the scanner reports a different digest for what it actually scanned and the
first has none, on that one too.

Attestations are **reported, not enforced**: no policy rule requires one.

### Where the request goes

The check reads the same registry the scan pulled from, with the same stored
[registry credential](/how-to/scan-a-private-registry-image), through the same
guarded transport and registry policy. It makes a handful of small requests
and is given 60 seconds; a registry that does not answer is recorded as
`unknown` and the scan still succeeds with its findings.

## Keyless signers

A signer in `signed_by` without `public_key` is a keyless identity: the OIDC
`issuer`, exactly, and a `subject` regular expression the certificate's
identity (an email, or a URI such as a GitHub Actions workflow ref) must match
in full.

```json
{
  "signed_by": [
    {
      "name": "release workflow",
      "issuer": "https://token.actions.githubusercontent.com",
      "subject": "https://github\\.com/acme/api/\\.github/workflows/release\\.yml@refs/tags/v.*"
    }
  ]
}
```

A keyless signature is accepted when all of these hold:

1. the certificate chains to a Fulcio root in the embedded Sigstore trust root
   (`sigstore/root-signing`'s `trusted_root.json`), at the time Rekor logged it;
2. the certificate's key verifies the signature over the signed payload, and
   the payload names the image's digest;
3. the Rekor bundle's signed entry timestamp verifies with a Rekor key from the
   trust root, and the logged entry is this signature, this certificate and
   this payload's hash;
4. the certificate's OIDC issuer equals `issuer` and its identity matches
   `subject`.

The scan's record names the verified signer
(`"signer": "<identity> (<issuer>)"`) even when no rule trusts it, so you can
see who signed before writing the rule. Tested against
`gcr.io/distroless/static`'s real keyless signature
(`keyless@distroless.iam.gserviceaccount.com`, `https://accounts.google.com`),
and against tampered copies of it.

## Limits

- **Keyless: the certificate's SCT is not checked**, nor a Rekor inclusion
  proof; the signed entry timestamp is what is verified (as cosign does offline
  for this layout). The trust root is embedded: a Fulcio or Rekor key rotation
  needs a TRUSTIVAN release. A private Sigstore deployment is not supported.
- **Signatures stored as OCI referrers in the Sigstore bundle format are not
  found.** cosign 3 writes that format by default. TRUSTIVAN reads the
  `sha256-<digest>.sig` and `.att` tags that cosign 1 and 2 write, which
  cosign 3 writes only when its new bundle format is turned off.
- **No transparency-log check.** A key-based signature is accepted on the
  key alone; TRUSTIVAN does not confirm a Rekor entry exists.
- **No key expiry or revocation.** A key is trusted for as long as a policy
  lists it. Remove it by adding a policy version without it, then rescan.
- **Notation (Notary v2) signatures are not read.**
- **Checked at scan time only.** A signature added after the scan is not seen
  until the next scan, and nothing re-verifies an image that is already
  running.
- **What the tests cover.** The verifier is tested against a local registry
  with signatures it constructs, including a signature copied from another
  image, a tampered payload and an untrusted key. A further test signs and
  attests an image with the real `cosign` binary and verifies it; it runs only
  where `cosign` is installed and is skipped, with that reason, elsewhere. It
  has not been exercised against every registry product.

## Related

- [Policies and verdicts](/concepts/policies-and-verdicts)
- [Supply chain security](/security/supply-chain): how TRUSTIVAN's own images are signed
- [GitHub Actions](/integrations/github-actions): the gate that enforces the verdict
