Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Verify exact release activation bytes

pulse-triage[bot]1ef56181905a
diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
index a08f809636..8793ad85ef 100644
--- a/.github/workflows/create-release.yml
+++ b/.github/workflows/create-release.yml
@@ -1870,7 +1870,8 @@ jobs:
[ "$actual_prerelease" = "$IS_PRERELEASE" ]; then
validate_existing_activation_commit
./scripts/verify-github-release-integrity.sh \
- "$TAG" "${GITHUB_REPOSITORY}" "$RELEASE_ID" "$EXPECTED_COMMIT"
+ "$TAG" "${GITHUB_REPOSITORY}" "$RELEASE_ID" "$EXPECTED_COMMIT" \
+ "${verified_marker}"
rm -f "$release_json" "$publish_payload" "$quarantine_payload" \
"$verified_marker"
rm -rf "$activation_marker_dir"
@@ -1997,10 +1998,11 @@ jobs:
fi
rm -f "$visual_plan"
- ./scripts/verify-github-release-integrity.sh \
- "$TAG" "${GITHUB_REPOSITORY}" "$RELEASE_ID" "$EXPECTED_COMMIT"
curl -fsSL --retry 12 --retry-delay 5 --retry-all-errors \
-o "${verified_marker}" "${base}/release-activation.json"
+ ./scripts/verify-github-release-integrity.sh \
+ "$TAG" "${GITHUB_REPOSITORY}" "$RELEASE_ID" "$EXPECTED_COMMIT" \
+ "${verified_marker}"
jq -e \
--arg tag "${TAG}" \
--arg target_commitish "${EXPECTED_COMMIT}" \
diff --git a/.github/workflows/recover-release-activation.yml b/.github/workflows/recover-release-activation.yml
index 7896e4b189..858ae67f6d 100644
--- a/.github/workflows/recover-release-activation.yml
+++ b/.github/workflows/recover-release-activation.yml
@@ -463,10 +463,11 @@ jobs:
-o /dev/null "${base}/${asset_name}"
done
- ./scripts/verify-github-release-integrity.sh \
- "${TAG}" "${GITHUB_REPOSITORY}" "${RELEASE_ID}" "${EXPECTED_COMMIT}"
curl -fsSL --retry 12 --retry-delay 5 --retry-all-errors \
-o "${verified_marker}" "${base}/release-activation.json"
+ ./scripts/verify-github-release-integrity.sh \
+ "${TAG}" "${GITHUB_REPOSITORY}" "${RELEASE_ID}" "${EXPECTED_COMMIT}" \
+ "${verified_marker}"
jq -e \
--arg tag "${TAG}" \
--arg target_commitish "${EXPECTED_COMMIT}" \
diff --git a/.github/workflows/release-convergence.yml b/.github/workflows/release-convergence.yml
index 94571b9907..19aa282df1 100644
--- a/.github/workflows/release-convergence.yml
+++ b/.github/workflows/release-convergence.yml
@@ -106,6 +106,16 @@ jobs:
marker_downloaded=true
fi
if [ "${marker_downloaded}" = "true" ]; then
+ # Verify the exact bytes this job will parse. The integrity
+ # helper must not reacquire a parallel copy and then let this
+ # unverified download drive customer-facing image pointers.
+ if ! ./scripts/verify-github-release-integrity.sh \
+ "${TAG}" "${GITHUB_REPOSITORY}" \
+ "${EXPECTED_RELEASE_ID}" "${EXPECTED_COMMIT}" "${marker}"; then
+ rm -f "${marker}"
+ echo "::error::Immutable release attestation verification failed for ${TAG}; customer convergence is blocked."
+ exit 1
+ fi
if ! jq -e \
--arg tag "${TAG}" \
--arg commit "${EXPECTED_COMMIT}" \
@@ -133,13 +143,6 @@ jobs:
fi
echo "[OK] Adopting committed ${TAG} from completed convergence owner ${activation_owner_run_id}."
fi
- if ! ./scripts/verify-github-release-integrity.sh \
- "${TAG}" "${GITHUB_REPOSITORY}" \
- "${EXPECTED_RELEASE_ID}" "${EXPECTED_COMMIT}"; then
- rm -f "${marker}"
- echo "::error::Immutable release attestation verification failed for ${TAG}; customer convergence is blocked."
- exit 1
- fi
activation_marker_sha256="$(sha256sum "${marker}" | awk '{print $1}')"
server_image_digest="$(jq -r '.server_image_digest' "${marker}")"
control_plane_image_digest="$(jq -r '.control_plane_image_digest' "${marker}")"
diff --git a/docs/CODE_SIGNING_POLICY.md b/docs/CODE_SIGNING_POLICY.md
index 0db6561c01..1bfec40bb7 100644
--- a/docs/CODE_SIGNING_POLICY.md
+++ b/docs/CODE_SIGNING_POLICY.md
@@ -116,11 +116,12 @@ Normal stable publication and stable dry runs select `signpath` directly.
environments are not promoted until `gh release verify <tag> --repo
rcourtman/Pulse` validates GitHub's signed release attestation and `gh release
verify-asset <tag> <downloaded-asset> --repo rcourtman/Pulse` binds the
- downloaded activation marker to that attestation. The activation verifier
- also binds the release's downloaded `checksums.txt` to that immutable packet
- and verifies its exact workflow and source provenance. Operators can use the
- same commands to verify the packet and any downloaded release asset
- independently.
+ exact downloaded activation marker consumed by the promotion job to that
+ attestation; verification never substitutes a parallel download. The
+ activation verifier also binds the release's downloaded `checksums.txt` to
+ that immutable packet and verifies its exact workflow and source provenance.
+ Operators can use the same commands to verify the packet and any downloaded
+ release asset independently.
## Project roles
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index 32fa59d2cf..a8303467db 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -447,6 +447,15 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("verify-github-release-integrity.sh", activation)
self.assertIn("verify-github-release-integrity.sh", convergence)
self.assertIn("verify-github-release-integrity.sh", commit_verdict)
+ self.assertIn('"${EXPECTED_COMMIT}" "${marker}"', convergence)
+ self.assertIn('"${verified_marker}"', activation)
+ marker_download = convergence.index('-o "${marker}"')
+ marker_integrity = convergence.index(
+ "verify-github-release-integrity.sh", marker_download
+ )
+ marker_parse = convergence.index("if ! jq -e", marker_download)
+ self.assertLess(marker_download, marker_integrity)
+ self.assertLess(marker_integrity, marker_parse)
for publication_job in (activation, recovery_activation):
with self.subTest(publication_job=publication_job[:40]):
self.assertIn(
@@ -536,6 +545,7 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("Recovered draft activation marker digest does not match", job)
self.assertIn(".immutable // false", job)
self.assertIn("verify-github-release-integrity.sh", job)
+ self.assertIn('"${verified_marker}"', job)
convergence = read(".github/workflows/release-convergence.yml")
helm_pages_caller = workflow_job_block(convergence, "publish_helm_pages")
@@ -548,9 +558,11 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
)
committed = job.index("committed=true", publish_patch)
readback = job.index("curl -fsSL --retry 12", committed)
+ integrity = job.index("verify-github-release-integrity.sh", readback)
self.assertLess(marker_upload, publish_patch)
self.assertLess(publish_patch, committed)
self.assertLess(committed, readback)
+ self.assertLess(readback, integrity)
helm_pages = read(".github/workflows/helm-pages.yml")
self.assertIn("Require activated GitHub release", helm_pages)
diff --git a/scripts/release_control/verify_github_release_integrity_test.py b/scripts/release_control/verify_github_release_integrity_test.py
index b874d0ce8f..c6a485d96f 100644
--- a/scripts/release_control/verify_github_release_integrity_test.py
+++ b/scripts/release_control/verify_github_release_integrity_test.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+import hashlib
import json
import os
from pathlib import Path
@@ -26,6 +27,7 @@ class VerifyGitHubReleaseIntegrityTest(unittest.TestCase):
provenance_verification_succeeds: bool = True,
gh_version: str = "2.97.0",
partial_download_once: bool = False,
+ supplied_activation: bytes | None = None,
):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
@@ -52,30 +54,43 @@ class VerifyGitHubReleaseIntegrityTest(unittest.TestCase):
exit {0 if verification_succeeds else 1}
fi
if [ "$1 $2" = "release download" ]; then
+ want_activation=false
+ download_dir=""
while [ "$#" -gt 0 ]; do
+ if [ "$1" = --pattern ] && [ "$2" = release-activation.json ]; then
+ want_activation=true
+ fi
if [ "$1" = --dir ]; then
- mkdir -p "$2"
- if [ "$PARTIAL_DOWNLOAD_ONCE" = true ] && [ ! -e "$DOWNLOAD_STATE" ]; then
- touch "$DOWNLOAD_STATE"
- printf '%s\\n' 'abc pulse-v6.5.0-linux-amd64.tar.gz' > "$2/checksums.txt"
- exit 1
- fi
- if [ -e "$2/release-activation.json" ] || [ -e "$2/checksums.txt" ]; then
- exit 66
- fi
- printf '%s\\n' '{{"schema_version": 1}}' > "$2/release-activation.json"
- printf '%s\\n' 'abc pulse-v6.5.0-linux-amd64.tar.gz' > "$2/checksums.txt"
- if [ "$HAS_PORTABLE_PROVENANCE" = true ]; then
- printf '%s\\n' '{{"mediaType": "application/vnd.dev.sigstore.bundle.v0.3+json"}}' \
- > "$2/release-build-provenance.sigstore.json"
- fi
- exit 0
+ download_dir="$2"
fi
shift
done
- exit 65
+ [ -n "$download_dir" ] || exit 65
+ mkdir -p "$download_dir"
+ if [ "$PARTIAL_DOWNLOAD_ONCE" = true ] && [ ! -e "$DOWNLOAD_STATE" ]; then
+ touch "$DOWNLOAD_STATE"
+ printf '%s\\n' 'abc pulse-v6.5.0-linux-amd64.tar.gz' > "$download_dir/checksums.txt"
+ exit 1
+ fi
+ if [ -e "$download_dir/checksums.txt" ]; then
+ exit 66
+ fi
+ if [ "$want_activation" = true ]; then
+ printf '%s\\n' '{{"schema_version": 1}}' > "$download_dir/release-activation.json"
+ fi
+ printf '%s\\n' 'abc pulse-v6.5.0-linux-amd64.tar.gz' > "$download_dir/checksums.txt"
+ if [ "$HAS_PORTABLE_PROVENANCE" = true ]; then
+ printf '%s\\n' '{{"mediaType": "application/vnd.dev.sigstore.bundle.v0.3+json"}}' \
+ > "$download_dir/release-build-provenance.sigstore.json"
+ fi
+ exit 0
fi
if [ "$1 $2" = "release verify-asset" ]; then
+ if [ "$(basename "$4")" = release-activation.json ] && \
+ [ -n "$SUPPLIED_ACTIVATION_DIGEST" ] && \
+ [ "$(sha256sum "$4" | awk '{{print $1}}')" != "$SUPPLIED_ACTIVATION_DIGEST" ]; then
+ exit 67
+ fi
printf '%s\\n' '{{"verified": true}}'
exit {0 if asset_verification_succeeds else 1}
fi
@@ -106,10 +121,26 @@ class VerifyGitHubReleaseIntegrityTest(unittest.TestCase):
for asset in release.get("assets", [])
)
).lower(),
+ "SUPPLIED_ACTIVATION_DIGEST": (
+ hashlib.sha256(supplied_activation).hexdigest()
+ if supplied_activation is not None
+ else ""
+ ),
}
)
+ command = [
+ str(SCRIPT),
+ "v6.5.0",
+ "rcourtman/Pulse",
+ "123",
+ SOURCE_SHA,
+ ]
+ if supplied_activation is not None:
+ supplied_path = root / "marker-from-customer-path.json"
+ supplied_path.write_bytes(supplied_activation)
+ command.append(str(supplied_path))
result = subprocess.run(
- [str(SCRIPT), "v6.5.0", "rcourtman/Pulse", "123", SOURCE_SHA],
+ command,
cwd=ROOT,
env=env,
text=True,
@@ -227,6 +258,24 @@ class VerifyGitHubReleaseIntegrityTest(unittest.TestCase):
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(calls.count("release download"), 2)
+ def test_verifies_supplied_activation_bytes_without_reacquiring_them(self) -> None:
+ activation = b'{"schema_version":1,"server_image_digest":"sha256:exact"}\n'
+ result, calls = self.run_verifier(
+ self.release(), supplied_activation=activation
+ )
+ self.assertEqual(result.returncode, 0, result.stderr)
+ download_call = next(
+ call for call in calls.splitlines() if call.startswith("release download ")
+ )
+ self.assertNotIn("--pattern release-activation.json", download_call)
+ self.assertIn("release verify-asset v6.5.0", calls)
+
+ def test_rejects_empty_supplied_activation_before_release_lookup(self) -> None:
+ result, calls = self.run_verifier(self.release(), supplied_activation=b"")
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("not a non-empty regular file", result.stderr)
+ self.assertEqual(calls, "")
+
def test_rejects_an_unsafe_github_cli_before_release_lookup(self) -> None:
result, calls = self.run_verifier(self.release(), gh_version="2.96.1")
self.assertNotEqual(result.returncode, 0)
diff --git a/scripts/verify-github-release-integrity.sh b/scripts/verify-github-release-integrity.sh
index 9e486bf8e0..75cf13acb1 100755
--- a/scripts/verify-github-release-integrity.sh
+++ b/scripts/verify-github-release-integrity.sh
@@ -7,8 +7,8 @@
set -euo pipefail
-if [ "$#" -ne 4 ]; then
- echo "Usage: $0 <tag> <owner/repo> <expected-release-id> <expected-source-sha>" >&2
+if [ "$#" -lt 4 ] || [ "$#" -gt 5 ]; then
+ echo "Usage: $0 <tag> <owner/repo> <expected-release-id> <expected-source-sha> [activation-asset]" >&2
exit 1
fi
@@ -16,6 +16,7 @@ TAG="$1"
REPO="$2"
EXPECTED_RELEASE_ID="$3"
EXPECTED_SOURCE_SHA="$4"
+SUPPLIED_ACTIVATION_ASSET="${5:-}"
ATTESTATION_ATTEMPTS="${PULSE_RELEASE_ATTESTATION_ATTEMPTS:-12}"
ATTESTATION_RETRY_DELAY="${PULSE_RELEASE_ATTESTATION_RETRY_DELAY:-5}"
@@ -68,6 +69,19 @@ cleanup() {
}
trap cleanup EXIT
+# A promotion workflow must verify the exact marker it will parse, not a
+# second download that merely has the same release filename. Copy supplied
+# bytes under the canonical asset name because `gh release verify-asset`
+# resolves the attested subject by the local basename. Callers that do not
+# consume a marker retain the historical download-and-verify behavior.
+if [ -n "$SUPPLIED_ACTIVATION_ASSET" ]; then
+ if [ ! -f "$SUPPLIED_ACTIVATION_ASSET" ] || [ ! -s "$SUPPLIED_ACTIVATION_ASSET" ]; then
+ echo "Supplied release activation asset is not a non-empty regular file: ${SUPPLIED_ACTIVATION_ASSET}" >&2
+ exit 1
+ fi
+ cp -- "$SUPPLIED_ACTIVATION_ASSET" "$activation_asset"
+fi
+
gh api \
-H 'Accept: application/vnd.github+json' \
-H 'X-GitHub-Api-Version: 2026-03-10' \
@@ -153,14 +167,19 @@ for attempt in $(seq 1 "$ATTESTATION_ATTEMPTS"); do
# A previous attempt can leave any asset behind after a partial
# download. Clear them because gh release download refuses to overwrite
# existing files unless explicitly told to do so.
- rm -f "$activation_asset" "$checksums_asset" "$provenance_asset"
+ rm -f "$checksums_asset" "$provenance_asset"
+ if [ -z "$SUPPLIED_ACTIVATION_ASSET" ]; then
+ rm -f "$activation_asset"
+ fi
download_args=(
"$TAG"
--repo "$REPO"
- --pattern release-activation.json
--pattern checksums.txt
--dir "$activation_dir"
)
+ if [ -z "$SUPPLIED_ACTIVATION_ASSET" ]; then
+ download_args+=(--pattern release-activation.json)
+ fi
if [ "$provenance_asset_count" = 1 ]; then
download_args+=(--pattern release-build-provenance.sigstore.json)
fi