Skip to content

Support YAML !binary tag in YAMLSerializer#9393

Merged
hsbt merged 2 commits intofix-binary-gemfrom
copilot/sub-pr-9388
Mar 12, 2026
Merged

Support YAML !binary tag in YAMLSerializer#9393
hsbt merged 2 commits intofix-binary-gemfrom
copilot/sub-pr-9388

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

What was the end-user or developer problem that led to this PR?

Gems packaged with older RubyGems encode checksums.yaml.gz values using YAML 1.1 !binary tags (base64). When Psych is disabled/unavailable, Gem::YAMLSerializer failed to parse these, causing gem install failures.

What is your fix for the problem, implemented in this PR?

Extended Gem::YAMLSerializer::Parser to base64-decode scalars tagged with !binary in:

  • Mapping keys and values (inline and block scalar)
  • Sequence items (inline)

Also adds test coverage for the sequence item code path (- !binary "..."), which was missing from the initial implementation.

Make sure the following tasks are checked


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: hsbt <12301+hsbt@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for YAML !binary tag in YAMLSerializer Support YAML !binary tag in YAMLSerializer Mar 12, 2026
Copilot finished work on behalf of hsbt March 12, 2026 03:01
@hsbt hsbt marked this pull request as ready for review March 12, 2026 03:14
Copilot AI review requested due to automatic review settings March 12, 2026 03:15
@hsbt hsbt merged commit bba62cf into fix-binary-gem Mar 12, 2026
1 check passed
@hsbt hsbt deleted the copilot/sub-pr-9388 branch March 12, 2026 03:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves RubyGems’ Psych-less YAML parsing path by teaching Gem::YAMLSerializer to handle YAML 1.1 !binary (base64) scalars, which appear in older gems’ checksums.yaml.gz and can otherwise break installs.

Changes:

  • Add support in Gem::YAMLSerializer::Parser for base64-decoding !binary scalars across mappings (keys/values) and sequences.
  • Add a regression test covering the inline sequence-item !binary case (- !binary "...").

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

File Description
lib/rubygems/yaml_serializer.rb Extends the YAMLSerializer parser to recognize and decode !binary-tagged scalars via base64.
test/rubygems/test_gem_safe_yaml.rb Adds coverage for decoding !binary used as an inline sequence item.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants