fix: Authenticate release asset downloads with GITHUB_TOKEN - #418
Open
kinyoklion wants to merge 1 commit into
Open
fix: Authenticate release asset downloads with GITHUB_TOKEN#418kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
|
@cursor review |
kinyoklion
marked this pull request as ready for review
August 13, 2026 17:32
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.
Requirements
Related issues
Port of #415 (merged to
main) and #416 (v2) tov3. The contract-tests action fetchesrun.shfrom thev2branch today, so this port keepsv3from regressing when it becomes the branch CI uses.Describe the solution you've provided
Previously
GITHUB_TOKENwas only used for the releases-listing request inresolve_version, so any run that passed a full version string (as CI usually does) made no authenticated requests at all, and the asset download was always anonymous. Thegithub.com/.../releases/download/...path is not a REST endpoint: GitHub publishes no rate limit for it and returns nox-ratelimit-*headers, and passing a token there is useless becausecurl -LdropsAuthorizationon the cross-host redirect to the signed asset host.This change routes the download through the documented release-assets API when a token is present:
github_curlcentralizes auth (Authorization: Bearer) plus-sS --retry 5 --retry-delay 2, replacing the previouseval-built command string that interpolated the token into a shell command.resolve_asset_urllooks up the asset for the current OS/arch viaGET /releases/tags/<version>and downloads it fromGET /releases/assets/<id>withAccept: application/octet-stream. That lands in the documented authenticated rate limit bucket instead of an undocumented one.releases/downloadURL, so external consumers are unaffected.Docs referenced: rate limits for the REST API, release assets endpoints.
Describe alternatives you've considered
releases/downloadURL — verified that this has no effect on the actual byte transfer, since the header is dropped at the redirect.v2) — rides out transient failures, but leaves the download in the unauthenticated bucket.How to test it
Also exercised full and partial version strings, the cached-binary path, and an unmatched version.
Additional context
Shell-script-only change used by CI, so no UI screenshots apply. This also brings the retry and error-surfacing behavior of #411 to
v3, which never received it. The Windowszippath is unchanged apart from going throughgithub_curl.Link to Devin session: https://app.devin.ai/sessions/98e5024773d947509ad2575ae80bf31b
Requested by: @kinyoklion
Note
Overview
CI downloader (
downloader/run.sh) now usesGITHUB_TOKENfor release asset downloads, not only when resolving partial version tags from the releases list.A shared
github_curlhelper sendsAuthorization: Bearerwith retries and replaces the oldeval-built curl that only authenticated the releases list—and did not help downloads when CI passed a full version string.When a token is set,
resolve_asset_urlfetches the OS/arch archive via the releases assets REST API (Accept: application/octet-stream), avoiding the publicreleases/downloadURL wherecurl -Ldrops auth on redirect. If asset lookup fails or no token is provided, behavior falls back to the anonymous download URL (token cleared on fallback so a bad token does not break public downloads).Reviewed by Cursor Bugbot for commit 7a13940. Bugbot is set up for automated code reviews on this repo. Configure here.