Fix record encryptor trying to decrypt empty strings#7542
Conversation
|
@ahukkanen care to check this out? 🙏 |
|
This needs to be backported to 0.24. |
|
Looks good @mrcasals, your fix works fine! I think this could've also been solved just by changing the order of these lines: decidim/decidim-core/lib/decidim/record_encryptor.rb Lines 123 to 125 in b40411b To: decrypted_value = decrypt_value(value)
next decrypted_value unless decrypted_value.is_a?(String)This actually originates from this line which returns I was actually thinking whether it's safe to return |
I tried that, but then I get an error in the specs: And I didn't want the signature to change, that's why I left it as a |
|
I think in this case it is fine to change the expectation if we want the values to be changed to Or you could just return an empty string here but I'm not sure if it has some other consequences as I mentioned above... Either way is fine, your solution is also good! |
* develop: Fix infinite loop when impersonated session time runs out (#7221) New Crowdin updates (#7543) Migrate Admin menus to Menu Registry Part 2 (#7382) Replace xls with xlsx (#7421) Use cache_key_with_version instead of cache version (#7532) Add support for ElectionGuard voting scheme (#7454) Fix record encryptor trying to decrypt empty strings (#7542) Revert "Don't schedule CI jobs for locales PRs (#7534)" (#7546) New Crowdin updates (#7540) New Crowdin updates (#7539)
🎩 What? Why?
When an authorization has a Hash with an empty string, the decryption process fails. This Pr fixes it.
📌 Related Issues
Testing
Probably same as in #7488.