mirror of https://github.com/rails/rails
d0f3b007b2
It is the role of the underlying serializer to accept or reject the data to decrypt depending on its type. This behavior mirrors what is done at encryption, where the serializer asserts that the input is an ActiveRecord::Encryption::Message. This change allows for a wider variety of custom serializers, but does not change the behavior when using the default MessageSerializer class. Indeed, the default message serializer will raise a TypeError when invoking JSON.parse on any non-String input. This error will subsequently be translated into an ActiveRecord::Encryption::Errors::Encoding error by the encryptor, which does not change the current behavior at the encryptor level. A new test asserts that the default MessageSerializer is able to reject unexpected data types on its own at decryption time, just as it does at encryption time (test already present). The test also asserts that an exception is translated into an ActiveRecord::Encryption::Error::Encoding error at the encryptor level. |
||
---|---|---|
.. | ||
active_record/connection_adapters | ||
activejob | ||
assets | ||
cases | ||
fixtures | ||
migrations | ||
models | ||
schema | ||
support | ||
config.example.yml | ||
config.rb |