Remove base64 gem and add Homebrew/NoBase64 cop - #23410
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes Homebrew鈥檚 direct dependency on the base64 gem (now that affected formulae have migrated to native String#unpack1/Array#pack) and adds a RuboCop cop to prevent Base64 usage from reappearing in formulae/casks across taps.
Changes:
- Remove
base64fromLibrary/Homebrew/Gemfiledependencies and delete the vendoredbase64gem files. - Add
Homebrew/NoBase64RuboCop cop (with autocorrections for commonencode64/decode64patterns) and accompanying spec. - Wire the cop into RuboCop loading/config, and ignore vendored
base64-*gem directories in.gitignore.
Reviewed changes
Copilot reviewed 5 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/base64-0.3.0/lib/base64.rb |
Removes vendored base64 implementation file. |
Library/Homebrew/vendor/bundle/ruby/4.0.0/gems/base64-0.3.0/COPYING |
Removes vendored base64 licensing file. |
Library/Homebrew/test/rubocops/no_base64_spec.rb |
Adds tests for the new Homebrew/NoBase64 cop. |
Library/Homebrew/rubocops/no_base64.rb |
Introduces the Homebrew/NoBase64 cop and autocorrection logic. |
Library/Homebrew/rubocops/all.rb |
Ensures the new cop file is required/registered. |
Library/Homebrew/Gemfile.lock |
Drops base64 from direct dependency list. |
Library/Homebrew/Gemfile |
Removes gem "base64" from vendored gem set. |
Library/.rubocop.yml |
Configures Homebrew/NoBase64 include/exclude patterns and description. |
.gitignore |
Adds base64-* to the list of vendored gems not committed. |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- This reverts commit 10bdd6b. - All formulae that needed `base64` now use native `String#unpack1`/`Array#pack` after Homebrew/homebrew-core#296594 so the vendored gem is no longer needed. - Bump `VENDOR_VERSION` as the vendored gem set changed again.
- The `base64` gem is no longer vendored so formulae and casks must not use it; flag `require "base64"` and any `Base64` usage in `Formula`/`Casks` files. - Autocorrect `decode64`/`strict_decode64` to `String#unpack1` and `encode64`/`strict_encode64` to `Array#pack`, matching the migration in Homebrew/homebrew-core#296594.
MikeMcQuaid
force-pushed
the
base64-unpack-migration
branch
from
August 4, 2026 08:37
9ff3db0 to
3dc3470
Compare
MikeMcQuaid
enabled auto-merge
August 4, 2026 09:57
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.
This can now be done as all formulae which required
base64have been switched to nativeString#unpack1/Array#packin Homebrew/homebrew-core#296594.Revert "Restore
base64gem" (Restorebase64gem聽#23344): removes the gem from theGemfileand the vendored bundle again. The autogenerated RBI commit from Restorebase64gem聽#23344 is not reverted as it was unrelated stanza drift.base64 (0.3.0)stays inGemfile.lockspecs/checksums as a transitive dependency of the optionalruby-profgem, matching the state before Restorebase64gem聽#23344.Add a
Homebrew/NoBase64cop so usage cannot creep back into formulae or casks. It flagsrequire "base64"and anyBase64usage inFormula/Casksfiles in any tap (scoped with the same globs asHomebrew/NoFileutilsRmrf) and autocorrects simple cases to the same replacements used in Remove base64 gem requirement聽homebrew-core#296594:require "base64"is removedBase64.decode64(x)becomesx.unpack1("m")Base64.strict_decode64(x)becomesx.unpack1("m0")Base64.encode64(x)becomes[x].pack("m")Base64.strict_encode64(x)becomes[x].pack("m0")Base64.urlsafe_*calls and compound expressions that would need parenthesising are flagged without autocorrection. Verified end to end on a scratch core formula:brew stylereports the offences andbrew style --fixapplies the conversions above.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code Fable 5 with local review and testing.