You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gander --upgrade currently trusts SHA256 hashes downloaded from the same host as the binary — fine over HTTPS, but no cryptographic guarantee that the release wasn't tampered with. After #32 starts signing SHA256SUMS.txt (transitionally the per-asset sidecars) with cosign, --upgrade should verify the signature before swapping the running binary. This is the upgrade-path counterpart to #32.
Acceptance criteria
New helpers in upgrade.go (or a new verify.go) — bundle the cosign blob-verification into the upgrade flow:
--bundle <bundle> and --signature <sig> as inputs.
runUpgrade calls the verifier before installBinary and aborts with a clear error on a non-zero exit (including printing the asset name and cosign verify-blob stderr).
On signature verification success, the chosen asset's hash is checked against the signed SHA256SUMS.txt (or .sha256 line) — same as today, but rooted in signed data.
verifySha256 continues to be the fallback for releases that pre-date this change; log a warning, do not fail, when SHA256SUMS.txt.sig is missing.
New tests in upgrade_test.go:
Happy path (signed, matching hash): succeeds.
Tampered signature: aborts with a clear error, leaves the existing binary untouched.
Missing signature on a release: falls back with a logged warning.
README "Upgrading an existing install" mentions signed checksums briefly.
Notes
Consider whether to vendor cosign via cgo or shell out. Shell-out is the lighter dependency and matches the existing process model. Recommend shell-out to cosign verify-blob for v1; revisit if a pure-Go signer is desired for portability.
The fallback in Clean up temp file on Ctrl+C / SIGTERM #4 is what lets us roll this out across an existing release without forcing every user to upgrade through a known-good version.
Motivation
gander --upgradecurrently trusts SHA256 hashes downloaded from the same host as the binary — fine over HTTPS, but no cryptographic guarantee that the release wasn't tampered with. After #32 starts signingSHA256SUMS.txt(transitionally the per-asset sidecars) with cosign,--upgradeshould verify the signature before swapping the running binary. This is the upgrade-path counterpart to #32.Acceptance criteria
upgrade.go(or a newverify.go) — bundle the cosign blob-verification into the upgrade flow:SHA256SUMS.txtonce ci: add windows-amd64 and windows-arm64 to release matrix #31 lands, otherwise the chosen asset's.sha256).SHA256SUMS.txt.sigandSHA256SUMS.txt.bundle(or the per-asset.sig/.bundlein the transitional path).cosign verify-blobwith:--certificate-identity-regexp 'https://github.com/gandermd/gander-cli'(or the action's workflow file URL)--certificate-oidc-issuer-regexp 'https://token.actions.githubusercontent.com'--bundle <bundle>and--signature <sig>as inputs.runUpgradecalls the verifier beforeinstallBinaryand aborts with a clear error on a non-zero exit (including printing the asset name andcosign verify-blobstderr).SHA256SUMS.txt(or.sha256line) — same as today, but rooted in signed data.verifySha256continues to be the fallback for releases that pre-date this change; log a warning, do not fail, whenSHA256SUMS.txt.sigis missing.upgrade_test.go:Notes
cgoor shell out. Shell-out is the lighter dependency and matches the existing process model. Recommend shell-out tocosign verify-blobfor v1; revisit if a pure-Go signer is desired for portability.