feat(auth): authenticate GitHub release downloads with per-host tokens - #102
Merged
albertodebortoli merged 7 commits intoJul 23, 2026
Merged
Conversation
Enables the GitHub Enterprise release-asset API endpoint
(.../releases/assets/{id}) as a url: workaround for SSO-gated GHE
instances where the plain web download URL is intercepted before
reaching GHE.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Downloader.swift uses URLRequest, which lives outside Foundation on Linux.
Merged
2 tasks
albertodebortoli
marked this pull request as ready for review
July 23, 2026 09:47
albertodebortoli
added a commit
to LucaTools/lucatools.github.io
that referenced
this pull request
Jul 23, 2026
Adds a new Tool Management page covering LUCA_GITHUB_TOKEN / LUCA_GITHUB_TOKEN_<HOST> and the API-asset-URL workaround for GHE instances behind an SSO gateway, per LucaTools/Luca#102.
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.
Description
Tool's release archive/executable from a private repository — ongithub.comor a GitHub Enterprise Server instance — by attaching a personal access token read from a per-host environment variable (LUCA_GITHUB_TOKENforgithub.com,LUCA_GITHUB_TOKEN_<HOST>for any other host).github.comhosts:github.comrelease-asset downloads redirect to a separate presigned-URL storage host, and forwarding a token there would leak it. Theapi.github.comrelease-metadata lookup (used byluca install org/repo@version) is authenticated separately, always against thegithub.comtoken.Accept: application/octet-streamon every release download. This enables a workaround for GitHub Enterprise Server instances sitting behind a browser-SSO gateway (e.g. Okta): the plain web download URL can be intercepted by the SSO gateway before it reaches GHE, but the/api/v3/.../releases/assets/{id}endpoint is typically exempt and requires this header to return raw bytes instead of JSON.org/repo@versionCLI shorthand host-configurable for GitHub Enterprise. That shorthand still only targetsgithub.com; this PR only adds authentication for URLs already reachable today (theurl:field on aTool, which already accepts any host).Type of Change
How Has This Been Tested?
GitHubTokenResolverTests, plus new cases inDownloaderTests,ReleaseInfoProviderTests,FileDownloaderTests)url:entry pointing at a private GitHub Enterprise Server release asset downloads successfully withLUCA_GITHUB_TOKEN_<HOST>set; also verified theAccept: application/octet-stream+ API-asset-URL workaround against an SSO-gated (Okta) GHE instanceScreenshots / Demo (if applicable)
N/A
Checklist
CI Considerations
LUCA_GITHUB_TOKEN/LUCA_GITHUB_TOKEN_<HOST>environment variables, documented in README.mdBreaking Changes?
Additional Notes
FileDownloading.download(from:)was changed todownload(for:)(request-based instead of URL-only) to allow attaching headers to the asset-download request. This is an internal protocol used only byDownloaderandSelfUpdater; both call sites were updated, and no public API changed.