Repository navigation
Authenticate setup-cli release downloads with GH_TOKEN - #76428
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Category: bug | Risk: medium | Score: 59/100 (impact 29 + urgency 18 + quality 12) | Recommended action: batch_review | Notes: authenticates setup-cli release downloads using GH_TOKEN; security-adjacent dependency fetch hardening with moderate urgency.
|
|
Category: bug | Risk: medium | Score: 59/100 (impact 29 + urgency 18 + quality 12) | Recommended action: batch_review | Notes: authenticates setup-cli release downloads using GH_TOKEN; security-adjacent dependency download hardening with moderate urgency.
|
|
Category: bug | Risk: medium | Score: 59/100 (impact 29 + urgency 18 + quality 12) | Recommended action: batch_review | Notes: authenticates setup-cli release downloads with GH_TOKEN; security-adjacent hardening with moderate urgency.
|
1 similar comment
|
Category: bug | Risk: medium | Score: 59/100 (impact 29 + urgency 18 + quality 12) | Recommended action: batch_review | Notes: authenticates setup-cli release downloads with GH_TOKEN; security-adjacent hardening with moderate urgency.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Reviewed the installer authentication changes. One actionable diagnostics/retry issue was found; no blocking correctness or security issue was confirmed.
Highlights
- Anonymous fallback is currently attempted for all authenticated download failures, including non-auth failures, and is reported as token rejection.
- The specialist pass completed; its other candidates were discarded as out of scope, unchanged-line concerns, or insufficiently supported.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| fi | ||
| done | ||
|
|
||
| if [ "${#AUTH_CURL_ARGS[@]}" -gt 0 ]; then |
There was a problem hiding this comment.
The anonymous fallback is attempted for every failure after the authenticated retries, not just an authentication rejection, so a nonexistent asset, outage, timeout, or DNS failure incurs another request and is misreported as a rejected token.
💡 Restrict the fallback to authentication failures
Capture the HTTP status (for example with curl -w) and retry without AUTH_CURL_ARGS only for 401/403, or use a neutral warning that accurately covers non-auth failures. This avoids extra traffic and makes installer diagnostics trustworthy.
There was a problem hiding this comment.
Updated the fallback warning to describe the actual authenticated download failure without assuming the token was rejected. Commit: fc79c12e.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. The auth change and anonymous fallback look correct, and the bash path has solid test coverage. The remaining items are small and non-blocking.
📋 Key Themes & Highlights
Key Themes
- Misleading PowerShell checksum output: the skip warning prints before the anonymous retry, so a successful retry still reports that verification is skipped (inline).
- Swallowed errors: both PowerShell anonymous fallbacks use empty
catchblocks (inline). - Misleading token-rejected wording: it fires on any authenticated failure, not only on rejected tokens (inline).
- PowerShell test gap:
scripts/test-install-script.ps1covers only the GH_TOKEN header on the release list and the pinned path. It does not exercise the anonymous fallback for binary or checksum downloads, or thelatestlookup auth. The bash fixture covers all of these, so the PowerShell fallback is the untested side. Add fixture cases, or note that it is untested.
Positive Highlights
- ✅ The anonymous fallback runs only when a token is set, so no-token behaviour is unchanged.
- ✅ No
--location-trustedis used, and the test script rejects it. - ✅ The bash fixture asserts per-request auth, exhausted authenticated retries, and a single anonymous retry.
- ✅
install-gh-aw.shand.ps1are mirrored intoactions/setup-cli/, and the copies are identical.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~10 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| if (-not $checksumsDownloaded -and $env:GH_TOKEN) { | ||
| Write-WarningMessage "GitHub token was rejected; retrying checksums download without authentication." | ||
| try { | ||
| Invoke-WebRequest -Uri $ChecksumsURL -Headers $AnonymousHeaders -OutFile $ChecksumsPath -TimeoutSec 60 | Out-Null |
There was a problem hiding this comment.
[/diagnosing-bugs] The skip warning at line 430 is printed on the third failed attempt, before this anonymous retry runs. If the retry succeeds, the output still says checksum verification will be skipped. Print that warning only when $checksumsDownloaded is still false after this fallback.
@copilot please address this.
There was a problem hiding this comment.
Moved the checksum failure and skip-verification warnings until after the anonymous retry, so they’re emitted only if it also fails. Commit: fc79c12e.
| Invoke-WebRequest -Uri $Url -Headers $AnonymousHeaders -OutFile $DestinationPath -TimeoutSec 120 | Out-Null | ||
| Write-Success "Binary downloaded successfully" | ||
| return $true | ||
| } catch { |
There was a problem hiding this comment.
[/diagnosing-bugs] The empty catch discards the anonymous retry exception, so the caller only sees the generic download failure and the root cause is lost. Log the exception message with Write-WarningMessage so a future regression can be diagnosed.
@copilot please address this.
There was a problem hiding this comment.
The anonymous binary retry catch now reports the exception message with Write-WarningMessage. Commit: fc79c12e.
| done | ||
|
|
||
| if [ "${#AUTH_CURL_ARGS[@]}" -gt 0 ]; then | ||
| print_warning "GitHub token was rejected; retrying binary download without authentication." |
There was a problem hiding this comment.
[/diagnosing-bugs] This warning says the token was rejected for any failure after the authenticated retries, including network errors and timeouts, so it misreports the cause. With curl -f, exit code 22 means an HTTP error, so check for that before using the rejection wording, or use neutral text such as authenticated download failed, retrying anonymously. The same wording appears at line 554 and in install-gh-aw.ps1 at line 275.
@copilot please address this.
There was a problem hiding this comment.
Changed the fallback warning to neutral wording that remains accurate for network and HTTP failures. Commit: fc79c12e.
There was a problem hiding this comment.
🟡 Changes recommended
The installer exposes GH_TOKEN in curl’s command-line arguments, allowing other local users on shared Linux runners with readable /proc entries to steal the credential.
4 open issues
What changed in this PR
Updates setup-cli and the standalone installers to authenticate release requests with GH_TOKEN, while retaining anonymous fallback for failed asset downloads.
Changes:
- Authenticates Bash latest-release lookups, binary downloads, and checksum downloads.
- Adds anonymous download retries to Bash and PowerShell installers.
- Expands Bash authentication coverage and documents token behavior across GitHub instances.
| File | Description |
|---|---|
scripts/test-install-script.sh |
Adds authenticated, anonymous, rejected-token, and latest-release cases. |
install-gh-aw.sh |
Adds authenticated release requests and anonymous download fallback. |
install-gh-aw.ps1 |
Adds anonymous retries for binary and checksum downloads. |
actions/setup-cli/README.md |
Explains download authentication and GHES/GHE.com token behavior. |
actions/setup-cli/install.sh |
Mirrors the standalone Bash installer changes. |
actions/setup-cli/install.ps1 |
Mirrors the standalone PowerShell fallback changes. |
actions/setup-cli/action.yml |
Updates the token input description to include release downloads. |
.changeset/patch-authenticated-setup-cli-downloads.md |
Records the authentication changes for a patch release. |
Review effort: Max (auto)
| if [ -n "${GH_TOKEN:-}" ]; then | ||
| AUTHORIZATION_HEADER="Authorization: Bearer " | ||
| AUTHORIZATION_HEADER+="$GH_TOKEN" | ||
| AUTH_CURL_ARGS=(-H "$AUTHORIZATION_HEADER") |
| FALLBACK_CHECKSUMS_URL="" | ||
| if [ "$VERSION" = "latest" ]; then | ||
| if LATEST_RELEASE_RESPONSE=$(curl -sLf --connect-timeout 15 --max-time 30 "https://api.github.com/repos/$REPO/releases/latest"); then | ||
| if LATEST_RELEASE_RESPONSE=$(curl -sLf --connect-timeout 15 --max-time 30 "${AUTH_CURL_ARGS[@]}" "https://api.github.com/repos/$REPO/releases/latest"); then |
| FIXTURE_REJECT_AUTH="$reject_auth" \ | ||
| FIXTURE_REQUEST_LOG="$case_root/requests" \ | ||
| FIXTURE_LATEST="$case_root/latest.json" \ | ||
| GH_TOKEN="$([ "$case_name" = channel-page-and-semver ] && echo test-token || echo "$gh_token")" \ |
| [ "$(awk -F '\t' '$1 ~ /\/download\/v0[.]37[.]18\/linux-amd64$/ && $2 == "authenticated" { count++ } END { print count+0 }' "$case_root/requests")" -eq 3 ] || | ||
| fail "binary did not exhaust authenticated retries" | ||
| [ "$(awk -F '\t' '$1 ~ /\/download\/v0[.]37[.]18\/linux-amd64$/ && $2 == "anonymous" { count++ } END { print count+0 }' "$case_root/requests")" -eq 1 ] || | ||
| fail "binary did not retry anonymously once" |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "62f98f69ad1d3483a223e395873d887d9731acd0",
"kind": "requested",
"schema_version": "1",
"state": "4abba2516c00260e755192ef4c81eefc045d1f2459e24272c514290af795c956",
"work": [
"0805a68bef3f9901737eccb5266c4e4353355b4ef56a59249dd9e550fc148c72",
"17f29de159c89322705bfa6825b6b0dc538a501449017ae61baf6d2dc8560165",
"604ea0cc9c4d87c3fd81446c99877bf0c3ca8302ec5a29a56780f95aed69b93e",
"ad83d803e327a8a8d0eff17296ce86fa6b81a621f87a418644958cf1a223a55f"
],
"workflow": "pr-sous-chef"
}
|
…downloads Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |


setup-cliusedGH_TOKENfor some API calls but not direct release downloads, leaving pinned binary and checksum requests anonymous. It now authenticates release lookups and downloads, while preserving anonymous access when the token is rejected.--location-trusted.install-gh-aw.sh/setup-cli: sendGH_TOKENwith the binary and checksums downloads, not only the releases API #76167