fix(ruby): fetch precompiled binary by release tag instead of listing all releases#8488
fix(ruby): fetch precompiled binary by release tag instead of listing all releases#8488
Conversation
… all releases The precompiled Ruby lookup used `list_releases` which only fetches the first page (30 releases) from GitHub. Older Ruby versions like 3.2.2 were beyond the first page, causing the lookup to fail silently and fall through to compiling from source via ruby-build. Switch to `get_release(repo, version)` which fetches the specific release by tag, avoiding pagination issues entirely. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue in the Ruby plugin's precompiled binary lookup mechanism. Previously, the system relied on listing all GitHub releases, which was limited to the first page of results. This limitation prevented older Ruby versions from finding their precompiled binaries, leading to slower source compilation. The updated approach directly fetches the specific release by its version tag, ensuring that all supported Ruby versions can leverage precompiled binaries for faster and more consistent installations. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Greptile SummaryThis PR fixes a bug where precompiled Ruby binaries for older versions (e.g. Key changes:
Confidence Score: 4/5
Sequence DiagramsequenceDiagram
participant User
participant mise
participant GitHub API
Note over mise,GitHub API: Before (broken for older versions)
User->>mise: mise x ruby@3.2.2
mise->>GitHub API: GET /repos/jdx/ruby/releases (page 1, 30 results)
GitHub API-->>mise: releases [3.4.x ... 3.3.x] (3.2.2 not in first page)
mise-->>User: Falls back to compiling from source ❌
Note over mise,GitHub API: After (this PR)
User->>mise: mise x ruby@3.2.2
mise->>GitHub API: GET /repos/jdx/ruby/releases/tags/3.2.2
GitHub API-->>mise: Release with assets for 3.2.2
mise-->>User: Downloads precompiled binary ✅
Last reviewed commit: fa003aa |
| let release = match github::get_release(repo, version).await { | ||
| Ok(r) => r, | ||
| Err(_) => return Ok(None), | ||
| }; |
There was a problem hiding this comment.
Silent swallowing of all errors
All errors from get_release — including transient network failures, GitHub API rate-limiting (HTTP 403), and authentication issues — are silently discarded and treated the same as "release not found", causing a silent fallback to compiling from source. Users could end up waiting for a lengthy source compilation without any indication that a network/rate-limit error occurred.
Consider at least logging the error at debug level before returning Ok(None), similar to how fetch_ruby_release_dates handles errors:
| let release = match github::get_release(repo, version).await { | |
| Ok(r) => r, | |
| Err(_) => return Ok(None), | |
| }; | |
| let release = match github::get_release(repo, version).await { | |
| Ok(r) => r, | |
| Err(err) => { | |
| debug!("No precompiled release found for ruby@{version}: {err}"); | |
| return Ok(None); | |
| } | |
| }; |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| let release = match github::get_release(repo, version).await { | ||
| Ok(r) => r, | ||
| Err(_) => return Ok(None), | ||
| }; |
There was a problem hiding this comment.
Missing draft/prerelease filtering on fetched release
Low Severity
The old list_releases path filtered out draft and prerelease releases via releases.retain(|r| !r.draft && !r.prerelease). The new get_release path returns whatever the GitHub API returns for the tag, including draft or prerelease releases. This could cause the code to serve assets from an incomplete or in-progress release.
There was a problem hiding this comment.
Code Review
This pull request aims to resolve an issue where precompiled Ruby binaries for older versions could not be found due to GitHub API pagination by fetching a specific release by its tag. However, it introduces a potential path traversal vulnerability as the version string is not URL-encoded or sanitized before being used to build the API URL, which could allow an attacker to redirect downloads to a malicious repository. Additionally, consider enhancing error handling by logging failures during the release fetch to prevent silent fallbacks and aid debugging.
| let release = match github::get_release(repo, version).await { | ||
| Ok(r) => r, | ||
| Err(_) => return Ok(None), | ||
| }; |
There was a problem hiding this comment.
The version string used in github::get_release(repo, version) is not URL-encoded or sanitized, creating a path traversal vulnerability. An attacker could craft a malicious version string (e.g., ruby = "3.3.0/../../attacker/repo/releases/tags/v1") to redirect the API call to an arbitrary GitHub repository, potentially leading to Server-Side Request Forgery (SSRF) or Remote Code Execution (RCE). While addressing this critical vulnerability, it's also beneficial to log errors from github::get_release for debugging, preventing silent fallbacks to source compilation for transient issues.
| let release = match github::get_release(repo, version).await { | |
| Ok(r) => r, | |
| Err(_) => return Ok(None), | |
| }; | |
| let release = match github::get_release(repo, version).await { | |
| Ok(r) => r, | |
| Err(err) => { | |
| debug!("Failed to get GitHub release for ruby@{version}: {err}"); | |
| return Ok(None); | |
| } | |
| }; |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.3 x -- echo |
24.7 ± 0.8 | 23.1 | 27.8 | 1.00 |
mise x -- echo |
25.0 ± 1.1 | 23.1 | 32.8 | 1.01 ± 0.06 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.3 env |
24.1 ± 0.8 | 22.4 | 26.3 | 1.00 |
mise env |
24.2 ± 1.1 | 22.6 | 31.4 | 1.01 ± 0.06 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.3 hook-env |
24.6 ± 1.1 | 23.0 | 29.7 | 1.00 |
mise hook-env |
24.7 ± 0.9 | 23.2 | 27.4 | 1.01 ± 0.06 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.3.3 ls |
23.8 ± 0.9 | 22.4 | 26.3 | 1.00 |
mise ls |
23.8 ± 0.9 | 22.5 | 27.1 | 1.00 ± 0.05 |
xtasks/test/perf
| Command | mise-2026.3.3 | mise | Variance |
|---|---|---|---|
| install (cached) | 157ms | 156ms | +0% |
| ls (cached) | 84ms | 85ms | -1% |
| bin-paths (cached) | 87ms | 88ms | -1% |
| task-ls (cached) | 850ms | 852ms | +0% |
### 🚀 Features - **(github)** keep exe extensions on Windows by @iki in [#8424](#8424) - **(task)** add `interactive` field for exclusive terminal access by @jdx in [#8491](#8491) - add header comment to generated lockfiles by @ivy in [#8481](#8481) - runtime musl/glibc detection for correct libc variant selection by @jdx in [#8490](#8490) ### 🐛 Bug Fixes - **(github)** use registry platform options during install by @jdx in [#8492](#8492) - **(http)** store tool opts as native TOML to fix platform switching by @jdx in [#8448](#8448) - **(installer)** error if MISE_INSTALL_PATH is a directory by @jdx in [#8468](#8468) - **(prepare)** resolve sources/outputs relative to `dir` when set by @jdx in [#8472](#8472) - **(ruby)** fetch precompiled binary by release tag instead of listing all releases by @jdx in [#8488](#8488) - **(schema)** support structured objects in task depends by @risu729 in [#8463](#8463) - **(task)** replace println!/eprintln! with calm_io in task output macros by @vmaleze in [#8485](#8485) - handle scoped npm package names without backend prefix by @jdx in [#8477](#8477) ### 📦️ Dependency Updates - update ghcr.io/jdx/mise:copr docker digest to c485c4c by @renovate[bot] in [#8484](#8484) - update ghcr.io/jdx/mise:alpine docker digest to 8118bc7 by @renovate[bot] in [#8483](#8483) ### 📦 Registry - disable sd version test by @jdx in [#8489](#8489) ### New Contributors - @ivy made their first contribution in [#8481](#8481) - @iki made their first contribution in [#8424](#8424) ## 📦 Aqua Registry Updates #### New Packages (5) - [`datadog-labs/pup`](https://github.com/datadog-labs/pup) - [`k1LoW/mo`](https://github.com/k1LoW/mo) - [`rtk-ai/rtk`](https://github.com/rtk-ai/rtk) - [`suzuki-shunsuke/docfresh`](https://github.com/suzuki-shunsuke/docfresh) - [`yashikota/exiftool-go`](https://github.com/yashikota/exiftool-go) #### Updated Packages (6) - [`cloudflare/cloudflared`](https://github.com/cloudflare/cloudflared) - [`mozilla/sccache`](https://github.com/mozilla/sccache) - [`owenlamont/ryl`](https://github.com/owenlamont/ryl) - [`spinel-coop/rv`](https://github.com/spinel-coop/rv) - [`technicalpickles/envsense`](https://github.com/technicalpickles/envsense) - [`weaviate/weaviate`](https://github.com/weaviate/weaviate)


Summary
list_releaseswhich only fetches the first page (30 releases) from GitHubget_release(repo, version)which fetches the specific release by tag directlyTest plan
mise x ruby@3.2.2 -- ruby -vnow downloads precompiled binary instead of compiling🤖 Generated with Claude Code
Note
Low Risk
Small, localized change to Ruby precompiled download lookup logic; main risk is incorrect tag/asset matching causing a fallback to source builds.
Overview
Fixes precompiled Ruby asset discovery to fetch the specific GitHub release by tag via
github::get_release(repo, version)instead of listing releases and scanning the first page.This prevents older Ruby versions (beyond GitHub’s default first-page results) from silently missing precompiled assets and falling back to compiling from source, while keeping the existing no-YJIT vs standard asset selection behavior.
Written by Cursor Bugbot for commit 48bfa11. This will update automatically on new commits. Configure here.