Make selfupdate avoid GitHub API rate limits#22
Conversation
roborev: Combined Review (
|
Tag-only web and manifest discovery previously synthesized and probed platform assets before comparing the discovered tag with CurrentVersion. That meant an already-current client could fail because optional release asset metadata was missing even though no update would be offered. Conventional releases also collapsed checksum and signature metadata to a single guessed URL, which broke releases that publish checksums.txt or <asset>.sig instead of the first default candidate. Keep discovery tag-first, try configured checksum candidates in order, and only select synthesized signature URLs that exist. Validation: go test ./selfupdate; go test ./... Generated with Codex Co-authored-by: Marius van Niekerk <[email protected]>
roborev: Combined Review (
|
Web-discovered conventional releases can prove the archive exists while still lacking usable checksum metadata. Returning that Info shifts the failure to Install, which is too late and regresses releases where the GitHub API body or asset metadata can still provide the checksum. Retry the API release path before returning install metadata when a web-synthesized release has no checksum. If the API cannot recover a checksum either, fail Check with an explicit checksum error instead of producing unusable update info. Validation: go test ./selfupdate; go test ./... Generated with Codex Co-authored-by: Marius van Niekerk <[email protected]>
roborev: Combined Review (
|
Release manifests can provide arbitrary archive and checksum URLs. In the temporary migration mode where callers allow unsigned checksums, accepting manifest-derived http URLs leaves the checksum and archive responses vulnerable to active network rewriting. Fail manifest checks early unless the manifest URL and manifest-derived asset metadata use HTTPS whenever unsigned checksums are actually allowed. Signed configurations keep their existing behavior because signature verification authenticates the update metadata. Validation: go test ./selfupdate; go test ./... Generated with Codex Co-authored-by: Marius van Niekerk <[email protected]>
roborev: Combined Review (
|
Token-bearing API requests and unsigned manifest update flows should not trust redirects that downgrade HTTPS to HTTP. Without that guard, credentials can be exposed during API fallback and unsigned manifest metadata can still be rewritten after the initial URL validation. Reject GitHub token use with non-HTTPS API bases, reject HTTPS-to-HTTP redirects for authenticated API requests, and carry manifest provenance into install so unsigned manifest-derived archive downloads keep the same downgrade protection. Validation: go test ./selfupdate; go test ./... Generated with Codex Co-authored-by: Marius van Niekerk <[email protected]>
roborev: Combined Review (
|
Unsigned checksum mode trusts release metadata, checksum bytes, and archive bytes without signature verification. The previous downgrade protection only covered manifest-derived releases, leaving web and conventional discovery able to follow HTTPS-to-HTTP redirects or use HTTP bases while still relying on checksum-only validation. Apply the HTTPS requirement to unsigned checksum mode itself so every metadata, checksum, and archive fetch used by that mode rejects cleartext origins and downgrade redirects, regardless of whether the source was a manifest, web discovery, or API fallback. Validation: go test ./selfupdate; go test ./... Generated with Codex Co-authored-by: Marius van Niekerk <[email protected]>
roborev: Combined Review (
|
Unsigned checksum mode needs transport authentication before any release metadata, checksum, or archive bytes are trusted. Applying the shared redirect guard to most fetches still left web/API discovery with their own redirect behavior and allowed a direct HTTP archive request to be sent before failure. Route web and API discovery through the same unsigned-mode HTTPS checks, reject non-HTTPS initial requests before issuing them, and revalidate API fallback assets before returning install metadata recovered after a missing web checksum. Validation: go test ./selfupdate; go test ./... Generated with Codex Co-authored-by: Marius van Niekerk <[email protected]>
roborev: Combined Review (
|
Release manifests decide which signed or unsigned update metadata a client will inspect, so they should not be fetched over cleartext transport even when later archive verification uses signatures. Checksum fallback probing also should not hide real request, cancellation, or read errors as though a checksum asset was merely absent. Require HTTPS and downgrade rejection for manifest fetches in every mode, and only suppress a typed not-found checksum asset miss while propagating cancellation, transport, and response-size failures. Validation: go test ./selfupdate; go test ./... Generated with Codex Co-authored-by: Marius van Niekerk <[email protected]>
roborev: Combined Review (
|
Summary
api.github.comas the default path by following the GitHub web/releases/latestredirect and constructing conventional release asset URLs.ReleaseManifestURLsupport; a manifest can be as small as{ "tag_name": "vX.Y.Z" }, or can provide GitHub-style asset metadata for custom download URLs.GitHubTokenauth scoped to the API request only, plusEnvironmentGitHubToken()for callers usingGH_TOKEN/GITHUB_TOKEN.Repo-wide
golangci-lint runandgo run ./cmd/testify-helper-check ./...currently report pre-existing issues ingit/cmd; the selfupdate-scoped lint checks pass.