Actions
Bug #18735
closedEncryptable unit tests fail under Ruby 2.4: key must be 32 bytes
Description
Under Ruby 2.4.0, encryptable unit tests and those that depend on the concern all fail:
10) Error: EncryptableTest#test_0008_string is re-encrypted upon save if password changed: ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage app/models/concerns/encrypt_value.rb:60:in `decrypt_field' app/models/concerns/encryptable.rb:33:in `block (2 levels) in define_auto_decrypt_getter' test/unit/encryptable_test.rb:71:in `block in <class:EncryptableTest>' 11) Failure: EncryptableTest#test_0010_encrypt successfully [/home/dcleal/code/foreman/foreman/test/unit/encryptable_test.rb:95]: Expected "secretpassword" to not be equal to "secretpassword". 12) Error: EncryptableTest#test_0007_string is NOT encrypted AGAIN upon save if it is not changed: ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage app/models/concerns/encrypt_value.rb:60:in `decrypt_field' app/models/concerns/encryptable.rb:33:in `block (2 levels) in define_auto_decrypt_getter' test/unit/encryptable_test.rb:56:in `block in <class:EncryptableTest>' 13) Failure: EncryptableTest#test_0011_decrypt successfully [/home/dcleal/code/foreman/foreman/test/unit/encryptable_test.rb:105]: Expected "secretpassword" to not be equal to "secretpassword".
The encrypt_str routine is catching an exception raised by Ruby through AS::MessageEncryptor:
> encryptor.encrypt_and_sign(str) ArgumentError: key must be 32 bytes
The standard key length used in Foreman is 40 bytes (Foreman::Util#secure_encryption_key).
Updated by The Foreman Bot almost 8 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/4350 added
Updated by Dominic Cleal almost 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 1d75969e0782e6bb5d76b250d5e0d467c9bf924f.
Updated by Dominic Cleal almost 8 years ago
- Translation missing: en.field_release set to 209
Actions