Repository navigation
Tool plugins: allow a headers table in the PreInstall result for authenticated downloads #14527
Replies: 2 comments
|
Thanks for the detailed write-up. I opened #14531, which implements this as proposed:
Since this adds new plugin API, it would help if you could try it once the PR is built and confirm it covers your private-repo and Artifactory cases. AI-assisted — Tool: Claude Code; model: anthropic/claude-sonnet-5-5; version: 2.1.299. |
|
Thanks for the quick turnaround. I tried it with mise 2026.10.14 and it covers both of our cases: release assets of a private GitHub repository through the API ( mise verifies the checksum, the headers reach only the origin of AI-assisted — Tool: opencode; model: github-copilot/claude-sonnet-5.5; version: 2.0.32. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Let a Lua tool plugin return request headers from
PreInstall, next tourlandsha256, so that mise downloads, verifies and records artifacts that need a token other than Basic auth.Use case
I'm moving a plugin that installs internal tools from asdf to a native tool plugin. The artifacts live in two places:
GET /repos/{owner}/{repo}/releases/assets/{id}withAccept: application/octet-streamand a Bearer token, which redirects to a signed URL)Authorization: Bearer <token>The plugin lists versions and resolves checksums from a JSON index, so a tool plugin fits well. The only missing piece is authenticating the download itself.
What happens today (mise 2026.10.8)
PreInstallacceptsversion,url,note, the checksums andattestation. Anything else, includingheaders, is ignored.netrc(#12168) covers Basic auth only, and can't sendAccept: application/octet-stream, which the GitHub asset API needs (without it the endpoint answers with JSON metadata instead of the file).headersoption of thehttp:backend (#14014, #14022) is configured per tool inmise.tomland doesn't apply to plugins. A plugin can't use it either: the plugin decides URLs and versions dynamically, so it can't be replaced by statichttp:entries.Current workaround and its cost
PreInstallreturns only{ version = ... }, andPostInstalldownloads withhttp.download_file({ url, headers }, path)(which does accept headers), verifies the checksum withshasumthroughcmd.execand extracts the archive. This works, but:mise.lockrecords the version only: no URL and no checksum, andmise lockcan't pre-resolve other platforms becausePreInstallreturns nourlProposal
Accept an optional
headerstable in thePreInstallresult, with the semantics that #14022 already gave to thehttp:backend:url, and dropped on a redirect to another host, port or scheme (what signed URLs like GitHub's need)mise.lockAuthorizationtakes precedence over netrc and the automatic GitHub token, as it does for the other pathsmise lockalready callsPreInstallper platform; the plugin would build the headers in the same call.headers_forwardisn't needed for a first version: the default of dropping credentials on cross-host redirects covers the GitHub case.Related
PreInstallheadersfor thehttp:backendAI-assisted — Tool: opencode; model: github-copilot/claude-sonnet-5.5; version: 2.0.32.
All reactions