From 7f2da71dbe979b34d3e6f01e1fb717bb2cef7ddb Mon Sep 17 00:00:00 2001 From: Houston Putman Date: Tue, 1 Dec 2026 13:34:49 -0800 Subject: [PATCH 1/2] Stop signing the Helm repository index The index now lives in solr-site, as website content, rather than next to the release artifacts. Helm never checks a signature on a repository index, so index.yaml.asc and index.yaml.sha512 protected nobody, and tied every index update to a release manager's GPG key. What 'helm install --verify' checks is each chart's .prov file, which is pushed to the OCI registry with the chart. update_helm_index.sh drops its -g and -n options and no longer signs the index. It also writes the index the way Helm does, with lists not indented under their keys, so that adding a release only changes the lines of the new entries instead of re-indenting the whole file. --- dev-docs/helm-repository.md | 12 +++++-- hack/release/smoke_test/test_oci_index.sh | 2 +- hack/release/upload/update_helm_index.sh | 41 +++++++---------------- hack/release/wizard/releaseWizard.yaml | 6 ++-- 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/dev-docs/helm-repository.md b/dev-docs/helm-repository.md index 87290961..68fa0763 100644 --- a/dev-docs/helm-repository.md +++ b/dev-docs/helm-repository.md @@ -43,7 +43,15 @@ It needs Docker, since the registry, the index server and each Helm version run [`update_helm_index.sh`](../hack/release/upload/update_helm_index.sh) adds a release to the index. It downloads the released charts, verifies their checksums and GPG signatures, writes entries -pointing at the OCI registry, and signs the index. It never commits or uploads anything. +pointing at the OCI registry. It never commits or uploads anything. + +The index is not signed. Helm never checks a signature on a repository index, so a detached +signature next to it would protect nobody. What `helm install --verify` does check is each chart's +provenance (`.prov`) file, signed by the release manager and pushed to the OCI registry with the +chart. Changes to the index itself go through reviewed commits to solr-site. + +The index is written the way Helm writes one, with lists not indented under their keys, so that an +update's diff only shows the entries that changed. A release does this in the release wizard's `website_update_helm_index` step, after the charts are published to the OCI registry (`publish_helm_charts_oci`), and the website change is published with @@ -69,7 +77,7 @@ the website redirects to nightlies.apache.org. To move one of them to OCI: -r https://archive.apache.org/dist/solr/solr-operator/v0.9.1 \ -i ../solr-site/content/charts/index.yaml ``` -3. Commit the updated `index.yaml`, `index.yaml.asc` and `index.yaml.sha512` in solr-site. +3. Commit the updated `index.yaml` in solr-site. Versions from before the donation to Apache (`v0.2.x`) have no archive.apache.org copy, so they are left as they are. diff --git a/hack/release/smoke_test/test_oci_index.sh b/hack/release/smoke_test/test_oci_index.sh index 090b21a5..905097bd 100755 --- a/hack/release/smoke_test/test_oci_index.sh +++ b/hack/release/smoke_test/test_oci_index.sh @@ -257,7 +257,7 @@ fi # --- Generate the index, exactly as a release would ---------------------------------------------- -./hack/release/upload/update_helm_index.sh -n -c -d "${CHARTS_DIR}" -o "${OCI_BASE}" -i "${SITE_DIR}/index.yaml" +./hack/release/upload/update_helm_index.sh -c -d "${CHARTS_DIR}" -o "${OCI_BASE}" -i "${SITE_DIR}/index.yaml" # --- The checks, run once per Helm version ------------------------------------------------------- diff --git a/hack/release/upload/update_helm_index.sh b/hack/release/upload/update_helm_index.sh index 166e12f4..c8055dc3 100755 --- a/hack/release/upload/update_helm_index.sh +++ b/hack/release/upload/update_helm_index.sh @@ -23,7 +23,7 @@ set -u show_help() { cat << EOF -Usage: ./hack/release/upload/update_helm_index.sh [-h] [-g GPG_KEY] [-n] [-c] [-o OCI_BASE] [-v VERSION] (-r RELEASE_URL | -d CHARTS_DIR) -i INDEX_FILE +Usage: ./hack/release/upload/update_helm_index.sh [-h] [-c] [-o OCI_BASE] [-v VERSION] (-r RELEASE_URL | -d CHARTS_DIR) -i INDEX_FILE Add (or replace) Helm chart versions in a Helm repository index.yaml, whose entries point at the OCI registry the charts were published to, instead of at HTTPS tarballs. @@ -31,6 +31,9 @@ the OCI registry the charts were published to, instead of at HTTPS tarballs. The index is served from https://solr.apache.org/charts, and is checked into the solr-site repository. Point -i at the index.yaml in a solr-site checkout. Nothing is committed or uploaded. +The index is not signed. Helm never checks a signature on a repository index: what 'helm install +--verify' checks is each chart's .prov file, which is pushed to the OCI registry with the chart. + An entry that already exists for the same chart and version is replaced in place, keeping its original 'created' timestamp. Its digest must not change, since the OCI copy is required to be byte-identical to the released chart. This makes it safe to re-run, and is what backfills older @@ -47,8 +50,6 @@ releases once they have been published to the OCI registry. Meant for testing. -v Version of the release, e.g. v0.10.0 (Optional, defaults to the last path element of -r) -o OCI registry the charts were pushed to (Optional, defaults to ${DEFAULT_OCI_BASE}) - -g GPG Key to sign the new index file (Optional, defaults to the gpg default key) - -n Do not sign the index, or write its checksum. Meant for testing. EOF } @@ -56,7 +57,7 @@ DEFAULT_OCI_BASE="oci://ghcr.io/apache/solr-operator/helm" CHART_NAMES=(solr-operator solr) OPTIND=1 -while getopts hi:r:d:v:o:g:nc opt; do +while getopts hi:r:d:v:o:c opt; do case $opt in h) show_help @@ -72,10 +73,6 @@ while getopts hi:r:d:v:o:g:nc opt; do ;; o) OCI_BASE=$OPTARG ;; - g) GPG_KEY=$OPTARG - ;; - n) NO_SIGN=true - ;; c) CREATE=true ;; *) @@ -111,6 +108,9 @@ if [[ ! -x "${YQ}" ]]; then echo "yq was not found at ${YQ}. Run 'make yq' first, or set the YQ env var." >&2 && exit 1 fi HELM="${HELM:-helm}" +# Helm writes lists without indenting them under their key, and yq indents them unless told not to. +# Writing the index the same way keeps an update's diff down to the entries that actually changed. +YQ_WRITE=("${YQ}" --yaml-compact-seq-indent) sha512() { if command -v sha512sum >/dev/null 2>&1; then @@ -168,7 +168,7 @@ fi # can only produce HTTP urls. Helm resolves an oci:// url with a tag through its OCI getter. NEW_INDEX="${TMP_DIR}/charts/index.yaml" "${HELM}" repo index "${TMP_DIR}/charts" -OCI_BASE="${OCI_BASE}" "${YQ}" -i \ +OCI_BASE="${OCI_BASE}" "${YQ_WRITE[@]}" -i \ '.entries[][] |= (.urls = [strenv(OCI_BASE) + "/" + .name + ":" + .version])' "${NEW_INDEX}" # Guard against indexing a chart whose digest does not match the tarball that was verified. @@ -182,7 +182,7 @@ done < <("${YQ}" '.entries[][] | [.name, .version, .digest] | @tsv' "${NEW_INDEX # Start from the existing index, dropping its comments (the license header is re-added below). WORK_INDEX="${TMP_DIR}/index.yaml" if [[ -f "${INDEX_FILE}" ]]; then - "${YQ}" '... comments=""' "${INDEX_FILE}" > "${WORK_INDEX}" + "${YQ_WRITE[@]}" '... comments=""' "${INDEX_FILE}" > "${WORK_INDEX}" else echo "Creating a new index at ${INDEX_FILE}" printf 'apiVersion: v1\nentries: {}\n' > "${WORK_INDEX}" @@ -200,14 +200,14 @@ while IFS=$'\t' read -r name version; do exit 1 fi echo "Replacing ${name} ${version}, keeping its original created timestamp" - "${YQ}" -i ' + "${YQ_WRITE[@]}" -i ' (.entries[strenv(N)][] | select(.version == strenv(V))) |= (load(strenv(NEW)).entries[strenv(N)][] | select(.version == strenv(V))) * {"created": .created} ' "${WORK_INDEX}" else echo "Adding ${name} ${version}" # New releases are prepended, so the index stays newest-first. Helm sorts on load anyway. - "${YQ}" -i ' + "${YQ_WRITE[@]}" -i ' .entries[strenv(N)] = ( [load(strenv(NEW)).entries[strenv(N)][] | select(.version == strenv(V))] + (.entries[strenv(N)] // []) ) @@ -216,7 +216,7 @@ while IFS=$'\t' read -r name version; do unset N V NEW done < <("${YQ}" '.entries[][] | [.name, .version] | @tsv' "${NEW_INDEX}") -GENERATED="$(date -u +%Y-%m-%dT%H:%M:%S.000000000Z)" "${YQ}" -i '.generated = strenv(GENERATED)' "${WORK_INDEX}" +GENERATED="$(date -u +%Y-%m-%dT%H:%M:%S.000000000Z)" "${YQ_WRITE[@]}" -i '.generated = strenv(GENERATED)' "${WORK_INDEX}" mkdir -p "$(dirname "${INDEX_FILE}")" { @@ -225,18 +225,3 @@ mkdir -p "$(dirname "${INDEX_FILE}")" cat "${WORK_INDEX}" } > "${INDEX_FILE}" echo "Wrote ${INDEX_FILE}" - -if [[ "${NO_SIGN:-}" != "true" ]]; then - GPG_USER=() - if [[ -n "${GPG_KEY:-}" ]]; then - GPG_USER=(-u "${GPG_KEY}") - fi - ( - cd "$(dirname "${INDEX_FILE}")" - index_name="$(basename "${INDEX_FILE}")" - rm -f "${index_name}.asc" - gpg ${GPG_USER[@]+"${GPG_USER[@]}"} --pinentry-mode loopback -ab "${index_name}" - sha512 -b "${index_name}" > "${index_name}.sha512" - ) - echo "Signed ${INDEX_FILE}, and wrote its checksum" -fi diff --git a/hack/release/wizard/releaseWizard.yaml b/hack/release/wizard/releaseWizard.yaml index 5c912e27..1a7240ff 100644 --- a/hack/release/wizard/releaseWizard.yaml +++ b/hack/release/wizard/releaseWizard.yaml @@ -1383,20 +1383,20 @@ groups: signatures, and adds entries for them to the index, pointing at: - oci://ghcr.io/apache/solr-operator/helm/solr-operator:{{ release_version[1:] }} - oci://ghcr.io/apache/solr-operator/helm/solr:{{ release_version[1:] }} - It then signs the index, and writes its checksum. + The index is not signed: Helm never checks a signature on a repository index, and the + charts' own provenance (.prov) files, which 'helm install --verify' checks, are on ghcr.io. commands: !Commands root_folder: '{{ git_checkout_folder }}' confirm_each_command: false commands_text: | This will add the new release to the website's Helm repository index. - You will be prompted for your GPG Key passphrase, to sign the index.yaml. commands: - !Command cmd: git checkout {{ release_version }} && make yq comment: The index script and yq come from the release tag tee: true - !Command - cmd: ./hack/release/upload/update_helm_index.sh -g "{{ gpg_key | default("", True) }}" -r "{{ dist_release_url }}" -i "{{ helm_index_file }}" + cmd: ./hack/release/upload/update_helm_index.sh -r "{{ dist_release_url }}" -i "{{ helm_index_file }}" logfile: update_helm_index.log tee: true - !Command From 6f0b47924b40f84ea6baca3333d4d6a9109e62f8 Mon Sep 17 00:00:00 2001 From: Houston Putman Date: Tue, 1 Dec 2026 13:47:13 -0800 Subject: [PATCH 2/2] Check the Helm charts' Chart.yaml files for trailing whitespace A line in a YAML block scalar cannot end in whitespace, so when a changelog line in a Chart.yaml's artifacthub.io/changes annotation ends in a space, Helm writes the whole annotation into the Helm repository index as a long double-quoted string instead of as a block. That is what happened to the v0.7.0 and v0.8.1 solr-operator charts. 'make check-helm' now fails if a line in either Chart.yaml ends in whitespace. --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index c90cae18..6864e6e5 100644 --- a/Makefile +++ b/Makefile @@ -303,6 +303,12 @@ check-mod: ## Ensure the go mod files are up-to-date .PHONY: check-helm check-helm: ## Ensure the helm charts lint successfully and can be read by ArtifactHub helm lint helm/* + @# A line ending in whitespace, e.g. in the artifacthub.io/changes changelog, cannot be written as a YAML + @# block scalar, so the Helm repository index would hold that annotation as a long quoted string instead. + @if grep -n -E '[[:space:]]+$$' helm/*/Chart.yaml; then \ + echo "The lines above, in the charts' Chart.yaml files, end in whitespace. Please remove it." >&2; \ + exit 1; \ + fi # Check that the ArtifactHub Metadata is correct docker run --rm --name artifact-hub-check -v "${PWD}/helm:/etc/helm" artifacthub/ah ah lint -k helm -p /etc/helm