Repository navigation
fix: declare bigdecimal and logger, drop the need for base64 and the full cgi library - #224
Merged
Merged
Conversation
The wrapper requires base64, bigdecimal and logger. Ruby stopped installing base64 and bigdecimal by default in 3.4, and logger in 4.0, so on those versions a bundle that does not otherwise include them - such as an app using pg or mysql2 without Active Record - raised LoadError when it required the wrapper. On Ruby 3.3 the same bundle loaded but printed deprecation warnings. Declaring them in the gemspec makes Bundler install them wherever they are needed. On older Rubies Bundler uses the copies Ruby already ships.
The AD FS and Okta plugins use only CGI.escape and CGI.unescapeHTML, which cgi/escape provides. Ruby 4.0 no longer ships the rest of the cgi library, so require cgi/escape instead of cgi.
The KMS key manager only used Base64.strict_encode64 and strict_decode64,
which are thin wrappers over Array#pack('m0') and String#unpack1('m0').
Using those directly removes the wrapper's need for the base64 gem, so it
no longer has to be declared as a dependency.
sophia-bq
approved these changes
Oct 27, 2026
5 tasks done
5 tasks done
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.
Summary
Make the wrapper load on Ruby 3.4 and 4.0 in bundles that don't include the gems Ruby stopped installing by default.
Description
The wrapper requires
base64,bigdecimal,loggerandcgibut declared none of them. Ruby stopped installingbase64andbigdecimalby default in 3.4, andloggerin 4.0, and 4.0 also removed thecgilibrary except forcgi/escape. So on Ruby 3.4+ a bundle that doesn't pull these in some other way raisesLoadErroras soon as it requires the wrapper (confirmed on Ruby 4.0.9), and on Ruby 3.3 it loads but prints deprecation warnings. Active Record apps are mostly unaffected, because ActiveSupport already depends onbase64,bigdecimalandlogger; apps usingpgormysql2directly are not.bigdecimalandloggeras runtime dependencies, unconstrained. On Ruby 3.3 Bundler uses the copies Ruby already ships. Both are needed:bigdecimalis how Active Record represents decimal values, which the KMS plugin round-trips, andloggeris the default logger.Array#pack('m0')/String#unpack1('m0')instead ofBase64.strict_encode64/strict_decode64, which are thin wrappers over them. The output and theArgumentErroron invalid input are identical, and the wrapper no longer needs thebase64gem.require 'cgi/escape'instead ofrequire 'cgi'. They only useCGI.escapeandCGI.unescapeHTML, whichcgi/escapeprovides on every supported Ruby. On 4.0,require 'cgi'still loads but prints a removal warning.fiddleis not added: the wrapper never requires it.mysql2does, but only on Windows and without declaring it; that belongs in the docs (aws/aws-advanced-wrapper-docs#46), not in our gemspec.Testing
ruby:4.0image (Ruby 4.0.9), with a bundle of only the wrapper andpg: the PG and MySQL clients, the KMS key manager and both federated plugins load with no warnings (-W), data key base64 round-trips through the new helpers, andBase64is never loaded. Without this change,base64,bigdecimalandloggereach raiseLoadErrorthere.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.