Repository navigation
cmd: install stable updates from the CDN (PRINFRA-6718) - #583
Merged
Merged
Conversation
Stable-channel updates now come from the same CDN the installer uses, and are verified against that release's checksums before they replace the binary. The dev channel still reads GitHub prereleases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
somanshreddy
force-pushed
the
11-16-update_from_cdn
branch
from
November 16, 2026 02:59
4c947f4 to
1c02a76
Compare
jrusso1020
approved these changes
Nov 16, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Approving. Reviewed at 1c02a76; range-diff against 4c947f4 shows the single commit unchanged after the rebase.
update_cdn.go, everything that runs before the binary is replaced
- URLs: every one is built only from a tag that matches
stableReleaseTag(anchoredvX.Y.Z, no leading zeros), for the stable pointer,--versionandUpdateToalike. Nothing caller-supplied reaches a path otherwise. - Checksum entry: the platform asset's line must have exactly two fields, with the name matching
assetNameexactly. A duplicate entry is refused, the hex must decode to 32 bytes, and the comparison is against the lower-cased value. A missing entry maps to "not found"; a malformed one is an error. - Order: the archive is hashed whole, before extraction. Extraction takes only a regular file named exactly
heygen/heygen.exeat the root:tar.TypeReg,zipMode().IsRegular(). Nothing is written from an entry's own name, andupdate.Applygets only bytes. - Caps: the pointer is capped at its existing limit,
checksums.txtat 16 KiB, the archive at 64 MiB and the decompressed binary at 256 MiB, each read throughLimitReader(max+1)with an explicit overflow error. So a decompression bomb stops at the cap. - Redirects:
CheckRedirectreturnsErrUseLastResponse, so a 3xx surfaces as a non-200 error rather than being followed. Any error leaves the installed binary untouched. - Notice: it now reads the pointer through the same client, so
--checkand the notice can't disagree.
Verified (Go 1.26.11):
go test -count=1 ./cmd/heygen/passes andgo vetis clean.- I removed checks one at a time and the tests failed for each: skipping the sha256 comparison, matching any tar entry ending in
heygen, and following redirects.
Non-blocking:
- Test gap: loosening the entry match to
strings.Contains(fields[1], asset)still passes the suite. The code's exact match is right, but no test pins it. A fixture with a lookalike line (e.g.heygen_v0.11.0_linux_amd64.tar.gz.sbom.json) listed before the real one would. - Trust model:
checksums.txtcomes from the same CDN prefix as the archive, so it guards against corruption and partial uploads, not against someone who can write to that prefix. That's the same level as install.sh, and the old GitHub path also readchecksums.txtfrom the same release. GitHub releases are now immutable with protected tags, though, while the CDN prefix is writable by whatever holds the publish role. Takingchecksums.txtfrom the GitHub release while downloading the archive from the CDN would need two separate stores to be tampered with. Worth considering as a follow-up.
— Rames
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
Surfaces: CLI | Module: Self-update
Summary
heygen updatenow installs stable releases from the same CDN the install script uses, and checks each archive against that release's checksums before it replaces the binary.heygen update --checkand the "update available" notice read the same source, so they always agree. Dev builds still update from GitHub prereleases.How it works
vX.Y.Ztag, or the update stops.--version vX.Y.Zlooks in that version's CDN folder. A missing folder reports "version not found".checksums.txt. Then only theheygen(orheygen.exe) file at the archive root is installed.--versionare unchanged. A stable build's--versionnow accepts stable versions only.Testing
--versionfolders (including 403 and 404 as not found), refusing a checksum mismatch, a missing entry or a misplaced binary without touching the installed file, a successful install, the dev channel staying on GitHub, and--checkagreeing with the notice.v0.10.0build tov0.11.0and back against the real CDN.🤖 Generated with Claude Code