> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Verify Artifact Signatures

ClickHouse signs every container image and Helm chart in the ClickHouse ECR with [Cosign](https://docs.sigstore.dev/about/overview/), part of the Sigstore project. Use Cosign to confirm that an image or chart was built by the ClickHouse release pipeline and hasn't changed since.

Verification is optional, but we recommend verifying each artifact every time you mirror it.

## How Artifacts Are Signed

Artifacts are signed [keyless](https://docs.sigstore.dev/cosign/signing/overview/#the-signing-witnessing-and-verifying-process) by the ClickHouse release pipeline in GitHub Actions, so there is no public key to download. Instead, you verify that each signature was made by one of these release workflows:

| Signing identity | What it signs |
| - | - |
| `https://github.com/ClickHouse/data-plane-application/.github/workflows/copy-images-to-airgap-registries.yaml@refs/heads/main` | Every release artifact: container images and Helm charts |
| `https://github.com/ClickHouse/data-plane-application/.github/workflows/daily-copy-images-to-airgap-registries.yaml@refs/heads/main` | Daily rebuilds of the container images that pick up security fixes |

Both identities use the [GitHub Actions OIDC issuer](https://docs.sigstore.dev/certificate_authority/oidc-in-fulcio/#github) `https://token.actions.githubusercontent.com`.

## How to Verify the Signature

### Prerequisites

* [Cosign](https://docs.sigstore.dev/cosign/system_config/installation/) v3.0 or later. Earlier versions do not read the Sigstore bundle format by default.
* Pull access to the ClickHouse ECR, the same access you use to copy images.
* `jq` and `skopeo`, to read the verified digest and copy it to your registry.
* HTTPS access to `tuf-repo-cdn.sigstore.dev`, where Cosign downloads Sigstore's public certificates. If the host can't reach it, see [Custom components](https://docs.sigstore.dev/cosign/system_config/custom_components/) in the Sigstore documentation.

### Steps

The steps below are an example workflow for the ClickHouse ECR. For other verification options and the full list of `cosign verify` flags, see the [`cosign verify` reference](https://github.com/sigstore/cosign/blob/main/doc/cosign_verify.md).

**1. Log In to the ClickHouse ECR**

Cosign looks up the tag's digest in the registry, so log in first:

```bash theme={null}
SOURCE_ECR_ACCOUNT_ID=<account-id-from-onboarding>
SOURCE_ECR_REPO=$SOURCE_ECR_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com

aws ecr get-login-password --region us-east-1 | cosign login --username AWS --password-stdin $SOURCE_ECR_REPO
```

**2. Verify an Artifact**

Set the identity and issuer that Cosign checks each signature against. The regular expression matches only the two signing identities in the table above:

```bash theme={null}
COSIGN_IDENTITY_REGEXP='^https://github\.com/ClickHouse/data-plane-application/\.github/workflows/(daily-)?copy-images-to-airgap-registries\.yaml@refs/heads/main$'
COSIGN_OIDC_ISSUER=https://token.actions.githubusercontent.com
```

Then verify an artifact by tag:

```bash theme={null}
cosign verify $SOURCE_ECR_REPO/clickhouse-server:26.6.1.2455 \
  --certificate-identity-regexp "$COSIGN_IDENTITY_REGEXP" \
  --certificate-oidc-issuer "$COSIGN_OIDC_ISSUER"
```

A valid signature prints the checks that passed:

```
Verification for 0000000000.dkr.ecr.us-east-1.amazonaws.com/clickhouse-server:26.6.1.2455 --
The following checks were performed on each of these signatures:
  - The cosign claims were validated
  - Existence of the claims in the transparency log was verified offline
  - The code-signing certificate was verified using trusted certificate authority certificates
```

It is followed by a JSON payload on standard output. The `docker-manifest-digest` field in that payload is the digest that was verified. Cosign exits with a non-zero status if any check fails. Do not deploy an artifact that fails verification. If this happens, contact ClickHouse support.

Helm charts are verified the same way, using their OCI path:

```bash theme={null}
cosign verify $SOURCE_ECR_REPO/helm/onprem-clickhouse-cluster:1.17.0 \
  --certificate-identity-regexp "$COSIGN_IDENTITY_REGEXP" \
  --certificate-oidc-issuer "$COSIGN_OIDC_ISSUER"
```

**3. Copy the Verified Digest**

Copy the digest you verified, not the tag. The daily rebuild can move a tag to a new image between the two commands, so copying by tag could copy an image you did not verify.

The commands below verify an artifact, read the verified digest from the output, and copy that digest to your registry under the original tag. The copy only runs if verification succeeds:

```bash theme={null}
TARGET_REGISTRY=<your-registry-host>

VERIFIED=$(cosign verify $SOURCE_ECR_REPO/clickhouse-server:26.6.1.2455 \
  --certificate-identity-regexp "$COSIGN_IDENTITY_REGEXP" \
  --certificate-oidc-issuer "$COSIGN_OIDC_ISSUER") &&
DIGEST=$(jq -r '.[0].critical.image."docker-manifest-digest"' <<< "$VERIFIED") &&
skopeo copy --all --preserve-digests \
  docker://$SOURCE_ECR_REPO/clickhouse-server@$DIGEST \
  docker://$TARGET_REGISTRY/clickhouse-server:26.6.1.2455
```

Repeat this for each image and Helm chart you mirror. These commands replace the matching `skopeo copy` command in the deployment tutorial.
