reidmorrison / symmetric-encryption

Symmetric Encryption for Ruby Projects using OpenSSL
https://logger.rocketjob.github.io/
Apache License 2.0
475 stars 92 forks source link

Support ruby 3.1 #155

Closed hieuk09 closed 2 years ago

hieuk09 commented 2 years ago

Issue

When upgrading my project to ruby 3.1, I got this error:

Psych::BadAlias:
  Unknown alias: local
# ./vendor/bundle/ruby/3.1.0/gems/symmetric-encryption-4.4.0/lib/symmetric_encryption/config.rb:78:in `config'
# ./vendor/bundle/ruby/3.1.0/gems/symmetric-encryption-4.4.0/lib/symmetric_encryption/config.rb:88:in `ciphers'
# ./vendor/bundle/ruby/3.1.0/gems/symmetric-encryption-4.4.0/lib/symmetric_encryption/config.rb:22:in `load!'
# ./vendor/bundle/ruby/3.1.0/gems/symmetric-encryption-4.4.0/lib/symmetric_encryption/symmetric_encryption.rb:294:in `load!'
# ./config/initializers/symmetric_encryption.rb:1:in `<top (required)>'

Description of changes

In release note of ruby 3.1, it mentioned that safe_load is now the default behavior of Yaml.load, which doesn't load aliases. I updated the code to include aliases: true by when loading the configuration to retain the existing logic of the gem.