Skip to content
RubyGems Blog

RubyGems Blog

News and updates from the RubyGems team — releases, security advisories, and project announcements.

blog.rubygems.org
RubyGems BlogRubyGems Blog
SOFTWARE AND DATA ENGINEERING

4.1.1 Released

RubyGems and Bundler 4.1.1 include enhancements, bug fixes and documentation. To update to the latest RubyGems you can run: gem update --system [--pre] To update to the latest Bundler you can run: gem install bundler [--pre] bundle update --bundler=4.1.1 ## Release Notes ### RubyGems #### Enhancements: - Installs bundler 4.1.1 as a default gem. #### Bug fixes: - Fix file permissions during gem extraction. Pull request #10128 by Hiroshi SHIBATA - Resolve chained symlink targets before creating them during extraction. Pull request #10119 by Hiroshi SHIBATA - Keep negative any terms when PubGrub resolves conflicts. Pull request #10112 by Hiroshi SHIBATA - Serialize concurrent installs of the same gem. Pull request #10107 by Hiroshi SHIBATA - Keep resolved prereleases when sorting install requests. Pull request #10100 by Hiroshi SHIBATA - Forward keyword arguments in the IPv4 fallback TCPSocket#initialize. Pull request #10098 by Hiroshi SHIBATA - Push attestations with non-ASCII bytes on Ruby 3.2 and 3.3. Pull request #10097 by Hiroshi SHIBATA - Gem::YAMLSerializer::Parser only reads the first document of a YAML stream. Pull request #10088 by Ben Sheldon and Hiroshi SHIBATA ### Bundler #### Bug fixes: - Assign the specs missing from the shard list to shard_d. Pull request #10127 by Hiroshi SHIBATA - Require a digest on every content-addressed row of a checksummed lockfile. Pull request #10122 by Hiroshi SHIBATA - Keep frozen installs to gems the lockfile covers for content-addressed rows. Pull request #10120 by Hiroshi SHIBATA - Stop shipping the URI and YAML serializer entry files in the Bundler gem. Pull request #10113 by Hiroshi SHIBATA - Keep negative any terms when PubGrub resolves conflicts. Pull request #10112 by Hiroshi SHIBATA - Check gem requirements when locking from legacy indexes. Pull request #10111 by Hiroshi SHIBATA - Retry resolution with transitive prereleases. Pull request #10110 by Hiroshi SHIBATA - Explain activation conflicts caused by a Gemfile require. Pull request #10109 by Hiroshi SHIBATA - Allow full updates to downgrade a yanked gem. Pull request #10106 by Hiroshi SHIBATA - Honor --prefer-local when locking platform variants. Pull request #10108 by Hiroshi SHIBATA - Honor --jobs when installing from vendor/cache. Pull request #10102 by Hiroshi SHIBATA - Allow bundle lock --add-platform to add native platforms from JRuby. Pull request #10105 by Hiroshi SHIBATA - Show fourth-segment and prerelease updates in bundle outdated --filter-patch. Pull request #10103 by Hiroshi SHIBATA - Preserve inline settings after a forked install. Pull request #10099 by Hiroshi SHIBATA - Resolve dependencies before bundle add updates the Gemfile. Pull request #10101 by Hiroshi SHIBATA - Keep mirror settings readable by Bundler 4.0. Pull request #10075 by Paul Wille - Fix Gem::URI redefinition warnings on older RubyGems. Pull request #10074 by Paul Wille and Hiroshi SHIBATA - Read plugin index sections that are not hashes as empty. Pull request #10076 by Hiroshi SHIBATA #### Documentation: - Document that bundle lock –add-checksums leaves entries for uninstalled gems empty. Pull request #10121 by Hiroshi SHIBATA ## Manual Installation To install RubyGems by hand see the Download RubyGems page. SHA256 Checksums: - rubygems-4.1.1.tgz fac638221256dfef477c98bbe955f10908a7f9fc046ba4de9ed13595e6181a51 - rubygems-4.1.1.zip a4145eba60c3a504be9c67d0ebe0f4889762d1303913142ccba9348259e05719 - rubygems-update-4.1.1.gem 5e134b57c8998efdb4684da6ee30f348617196329e2ab9435a75e2b67450e9c2
BEN SHELDONRUBY GEMS
RubyGems BlogRubyGems Blog
SOFTWARE AND DATA ENGINEERING

4.0.25 Released

RubyGems 4.0.25 includes bug fixes and Bundler 4.0.25 includes bug fixes. To update to the latest RubyGems you can run: gem update --system [--pre] To update to the latest Bundler you can run: gem install bundler [--pre] bundle update --bundler=4.0.25 ## RubyGems Release Notes ### Bug fixes: - Fix file permissions during gem extraction. Pull request #10128 by Hiroshi SHIBATA - Resolve chained symlink targets before creating them during extraction. Pull request #10119 by Hiroshi SHIBATA - Forward keyword arguments in the IPv4 fallback TCPSocket#initialize. Pull request #10098 by Hiroshi SHIBATA ## Bundler Release Notes ### Bug fixes: - Retry resolution with transitive prereleases. Pull request #10110 by Hiroshi SHIBATA - Allow full updates to downgrade a yanked gem. Pull request #10106 by Hiroshi SHIBATA - Allow bundle lock --add-platform to add native platforms from JRuby. Pull request #10105 by Hiroshi SHIBATA - Show fourth-segment and prerelease updates in bundle outdated --filter-patch. Pull request #10103 by Hiroshi SHIBATA - Resolve dependencies before bundle add updates the Gemfile. Pull request #10101 by Hiroshi SHIBATA - Read plugin index files that Bundler 4.1 writes. Pull request #10077 by Hiroshi SHIBATA - Preload git sources that share a cache one after another: 4.0.x. Pull request #10069 by Hiroshi SHIBATA - Fix Bundler mirror probing with fallback_timeout. Pull request #10046 by Hiroshi SHIBATA ## Manual Installation To install RubyGems by hand see the Download RubyGems page. SHA256 Checksums: - rubygems-4.0.25.tgz ac6483970bbf0cf443315a9f34f4bbafd68efaee42658f0ef7ce4334ae001750 - rubygems-4.0.25.zip 372ee09acbb8dfc8f33ee20eb9c31bd06f74733db8f885e3f1a97a977175b12d - rubygems-update-4.0.25.gem 8e2a29f3efe00dbe5114b2e8b1cec8659a696b7ed59aaaf62f7706888ff68a49
BUNDLER 4025HIROSHI SHIBATA
RubyGems BlogRubyGems Blog
SOFTWARE AND DATA ENGINEERING

Content-Addressable Gems: the new way of packaging precompiled binaries

RubyGems 4.1 introduces content-addressable gems: precompiled gems built for a single Ruby ABI, which makes them smaller and lets maintainers support new Rubies without a new release. ### Where we are today A gem with a native extension that ships precompiled, such as nokogiri-1.18.9-x86_64-linux.gem, skips compilation entirely, which speeds up bundle install. But precompiled gems are larger than they need to be. A compiled extension only loads on the Ruby ABI it was built against, meaning the major and minor version of Ruby, such as 3.4. Since a .gem file is identified only by its name, version, and platform, one file per platform has to bundle a copy of the extension for every supported Ruby. We’ll call this a multi-ABI platform gem: nokogiri-1.18.9-x86_64-linux.gem └── lib/nokogiri/ ├── 3.1/nokogiri.so ├── 3.2/nokogiri.so ├── 3.3/nokogiri.so └── 3.4/nokogiri.so Most people run one Ruby, so they download four binaries to use one. Maintainers ship code to pick the right binary at load time. And when a new Ruby comes out, there is no way to add a binary for it to an existing release. ### Content-addressable gems Content-addressable gems publish one precompiled gem per Ruby ABI. Since those files would all share the same name-version-platform name, each is named after a prefix of its SHA-256 checksum instead. For example, rubydex 0.4.4 publishes both kinds: rubydex-0.4.4-x86_64-linux.gem # multi-ABI platform gem, every Ruby ABI rubydex-0.4.4-aff68219.gem # content-addressable gem, one Ruby ABI The platform and Ruby ABI live in the gem’s metadata instead. Each gem is smaller, and when a new Ruby is released, a maintainer can publish a build for it without cutting a new version. Content-addressable gems are supported in RubyGems and Bundler 4.1 and later, and on RubyGems.org. Older clients skip them and keep installing multi-ABI platform gems. This work would not have happened without Aaron Patterson, who proposed the idea, Harriet Oughton and Gira Chawda, who contributed to this feature, and friends on the RubyGems and RubyGems.org teams, who guided it through to release. ### Publishing content-addressable gems Building content-addressable gems requires RubyGems 4.1 or later: $ gem update --system If you precompile with rake-compiler, update to 1.3.2 or later and set content_addressable on your extension task: Rake::ExtensionTask.new "my_gem", spec do |ext| ext.cross_compile = true ext.cross_platform = "x86_64-linux" ext.content_addressable = true end rake cross native gem then produces a content-addressable gem for each Ruby in RUBY_CC_VERSION, alongside the usual multi-ABI platform gem and the ruby gem: $ rake cross native gem RUBY_CC_VERSION=3.3.11:3.4.9 $ ls pkg my_gem-1.0.gem my_gem-1.0-x86_64-linux.gem my_gem-1.0-5d0c19a7.gem my_gem-1.0-e3f86b21.gem Push all of them: older clients keep installing the multi-ABI platform gem, and RubyGems and Bundler 4.1 install the content-addressable one. Without rake-compiler, use gem build --content-addressable. The gemspec needs a platform and a required_ruby_version of ~> X.Y.0, which --ruby-abi can set for you: $ gem build my_gem.gemspec --platform x86_64-linux --ruby-abi 3.4 --content-addressable If your gem doesn’t ship precompiled yet, now is a good time to start. cibuildgem generates a GitHub Actions workflow that compiles your gem on each target platform, using rake-compiler under the hood, and pushes the results to RubyGems.org. Set include-single-abi: true on its action to build content-addressable gems as well. The Publishing Ruby ABI-specific builds section of the guides has the full details. ### Installing content-addressable gems Once you are on RubyGems and Bundler 4.1, there is nothing to do. gem install and bundle install prefer a content-addressable gem that matches your platform and Ruby ABI, then fall back to a multi-ABI platform gem, then to the ruby gem. Bundler uses the version under BUNDLED WITH in your Gemfile.lock, so switch an app to 4.1 with: $ bundle update --bundler Lockfiles with content-addressable gems gain two sections. The gem stays listed under its platform in GEM, and CONTENT ADDRESSES records the file and checksum to install for each Ruby ABI: CONTENT ADDRESSES rubydex (0.4.4-x86_64-linux) 2e4d66c7 abi=3.3 sha256=2e4d66c76a4b55673e93af2d336aa7b0dcd2cb35d124a3307f2a0c7f70cc7dc1 rubydex (0.4.4-x86_64-linux) aff68219 abi=3.4 sha256=aff682198ca8f6eabce3413c45da7c6429ed78b1414bb426a5c074cd6092c904 Bundler installs the row that matches the running Ruby. RUBY ABIS lists the Ruby ABIs the lockfile covers, much like PLATFORMS does for platforms: RUBY ABIS 3.3 3.4 Running bundle install under a new Ruby adds its ABI. With a frozen lockfile, Bundler falls back to the multi-ABI platform gem if it supports that Ruby, or to the ruby gem if ruby is in PLATFORMS. Otherwise the install fails. To add or remove an ABI by hand: $ bundle lock --add-ruby-abi 4.0 $ bundle lock --remove-ruby-abi 3.3 ### Looking ahead If you maintain a gem with native extensions, try publishing content-addressable gems alongside your next release. Users on RubyGems and Bundler 4.1 and later install the content-addressable gem right away. As more users move to 4.1 and later, gems will be able to rely on content-addressable gems alone and stop publishing a multi-ABI platform gem. We hope they become the default way to ship precompiled gems.
AARON PATTERSONGIRA CHAWDA
RubyGems BlogRubyGems Blog
CYBERSECURITY AND PRIVACY

Gemstash 2.9.0 security release, and the end of Gemstash

Today the RubyGems team released Gemstash 2.9.0, which fixes 8 security vulnerabilities affecting earlier versions. The most serious one is an unauthenticated remote code execution bug, rated Critical with a CVSS v4.0 score of 10.0. If you run Gemstash anywhere, please upgrade to 2.9.0 right away, or turn the service off until you can. ## What is Gemstash and how does it relate to the RubyGems CLI and RubyGems.org? Gemstash is a small Ruby server that sits between RubyGems and Bundler clients and an upstream gem source, which is RubyGems.org by default. It caches gems so installs are faster and keep working when the upstream can’t be reached, and it can host private gems too. Older versions let clients pick which upstream Gemstash fetches from, and that’s where several of these vulnerabilities start. RubyGems.org and the RubyGems CLI are not affected by any of the vulnerabilities we’re disclosing today. ## The advisories - Critical: Remote code execution through unsafe loading of upstream data (GHSA-27cp-f4p8-8qwv) - High: Server-side request forgery and open redirect through client-chosen upstreams (GHSA-xfw4-3v4j-82mr) - High: Memory exhaustion from oversized upstream responses (GHSA-c927-fwqw-cm2g) - Medium: Stored cross-site scripting through upstream content served from Gemstash (GHSA-v438-gm7r-2pgf) - Medium: Unvalidated dependency data cached from upstreams (GHSA-xg28-cqw2-pggq) - Medium: Pushes could overwrite yanked private gems (GHSA-m64f-hhmc-w7qr) - Medium: The private dependencies API ignored protected fetch (GHSA-7frx-567x-v3r6) - Medium: Unauthenticated memory use when receiving gem pushes (GHSA-wgrc-4g2v-9qxv) All advisories are listed at https://github.com/rubygems/gemstash/security/advisories. ## Before you upgrade 2.9.0 makes some changes to close these issues: - It requires Ruby 3.3 or newer. - Clients can no longer choose arbitrary upstream sources. Gemstash only fetches from upstreams on its allowed list, which is RubyGems.org by default. If your clients use other upstreams, add them to :allowed_upstreams before upgrading. See the configuration docs. - If an upstream redirects downloads to another host, such as a CDN, add that host to :allowed_redirects. - Upstreams that only serve the old Marshal dependency format are no longer supported. - Responses from upstreams now have size and time limits: 64 MiB per response (:max_upstream_bytes), and 300 seconds per request (:max_upstream_duration), with a minimum transfer rate after :fetch_timeout. Raise them if you fetch very large gems or have a slow link to your upstream. - gemstash start now checks these settings and refuses to start if :allowed_upstreams, :allowed_redirects, or the new upstream limits are invalid. - Cached dependency data is fetched again after the upgrade. ## Sunsetting Gemstash Most of these reports are in how Gemstash fetches and caches gems from an upstream server, which is its core job, and keeping that safe takes ongoing security work. These days, many teams that need a private gem server or a RubyGems.org cache use a general-purpose artifact registry or package proxy instead, one that handles gems alongside all their other packages. For these reasons, the RubyGems team has decided to sunset Gemstash. 2.9.0 is the last feature release. The RubyGems team will continue to work on reported vulnerabilities and bug fix contributions. We recommend that anyone running Gemstash plan a move to one of these alternatives: - JFrog Artifactory: hosts private gems and proxies and caches RubyGems.org, self-hosted or as a service. - Sonatype Nexus Repository: hosted, proxy, and group gem repositories, which combine private gems and a RubyGems.org cache behind one URL. - Cloudsmith: a managed private gem registry that can proxy and cache RubyGems.org. - AWS CodeArtifact: managed gem repositories with an external connection to RubyGems.org. - GitHub Packages: hosts private gems next to your GitHub repositories, but does not proxy RubyGems.org. - An S3 bucket or S3-compatible endpoint: serves private gems without running a server, but does not proxy RubyGems.org. ## Thanks Thank you to fuzzyrichie for reporting the numerous issues responsibly. The Security Engineer in Residence program also found several of them. Thanks also to dkw-oss for developing many of the fixes. To report a security issue in Gemstash, see https://github.com/rubygems/gemstash/security/policy or email security@rubygems.org.
DKW OSSGEMSTASH
RubyGems BlogRubyGems Blog
SOFTWARE AND DATA ENGINEERING

What's New in RubyGems/Bundler 4.1

RubyGems and Bundler 4.1.0 are out. I covered the release in a three-part series on dev.to, and this post picks two changes from each part that you are most likely to use. ## override and prune override in the Gemfile rewrites version constraints that your dependencies declare, transitive ones included. When a gem caps required_ruby_version below the Ruby you just installed, override "foo", required_ruby_version: :ignore_upper gets you going without a fork. It can also drop or replace a dependency with with: and in:. prune deletes Bundler’s download cache and the .git directories of git gems after install. bundle config set --local prune cache:git replaces the rm -rf line in your Dockerfile. Details are in Part 1. ## Defenses against supply chain attacks The credential store keeps the API key for gem push and Bundler’s per-host credentials in the OS keychain instead of plain text files. Turn it on with :credential_store: true in your gemrc or bundle config set credential_store true. Cooldown now works in the gem command too. gem install --cooldown 7 skips versions published in the last seven days, and the gem command reads Bundler’s cooldown setting as well. Details are in Part 2. ## One codebase, fewer round trips gem install no longer fetches a gemspec for every gem it installs, so gem install activesupport makes 25 requests instead of 40. The compact index is cached with ETags, so a repeated resolve downloads nothing. RubyGems and Bundler now share one HTTP stack and one compact index client instead of keeping two copies, so a fix lands once. Details are in Part 3. Beyond these six, 4.1.0 brings many other changes that make RubyGems and Bundler nicer to use today, such as support for content addressable gems. It also has a few breaking changes. For example, bundle clean now exits with an error when it cannot delete a file, where it used to report success. The full changelog, breaking changes included, is in the 4.1.0 release post. To try it, run: gem update --system bundle update --bundler The second command records Bundler 4.1.0 in your lockfile. Without it, Bundler switches back to the version your lockfile was generated with, and override and prune are not available. Feedback is welcome, from things you notice to ideas for improving the new features. Please send it to ruby/rubygems.
GEM INSTALLRUBY GEMS