-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
after updating the version of rails and ruby, I am getting error #387
Comments
Had the same issue after upgrading gem from 3.0.0 to 3.1.0, had to rollback as it'd break my app |
I had the same issue, and it does seem to be related to fetching the key from ENV. |
If anyone with this issue is still having it, can you provide reproduction steps? |
I think this was when upgrading Rails and Ruby between minor versions, but I cannot find the commits from that time to give you exact reproduction steps. |
Ah, now I see. My problem was that I wanted to use it like this:
But that did not work and would always yield an empty string, ultimately resulting in the CipherError. Instead I had to use https://github.com/rubyconfig/config and fetch the env from there in
|
That is strange, I wonder if the key is being modified in some way when being fetched from |
Yeah, I also couldn't wrap my head around it at the time. Sorry for not being able to provide more information. |
No worries. Are you still seeing the issue, and do you know what Ruby and Rails version you were on? Interestingly you are mentioning the value is empty in I did a test locally, and in this test case the value was changed when set via irb(main):007:0> value = SecureRandom.random_bytes(32)
=> ",\xAA\xC1\x18\x1F\xB8\x8C\x05\xF4\x86\be\x8E\xDA\x87\xFE!x\xA4S\x1F\x18\xD8B\xA5s\x80\x9E\x9F\x8B\f\xC2"
irb(main):008:0> ENV['TEST'] = ",\xAA\xC1\x18\x1F\xB8\x8C\x05\xF4\x86\be\x8E\xDA\x87\xFE!x\xA4S\x1F\x18\xD8B\xA5s\x80\x9E\x9F\x8B\f\xC2"
=> ",\xAA\xC1\u0018\u001F\xB8\x8C\u0005\xF4\x86\be\x8Eڇ\xFE!x\xA4S\u001F\u0018\xD8B\xA5s\x80\x9E\x9F\x8B\f\xC2"
irb(main):009:0> value == ENV['TEST']
=> false |
This was a legacy app with Rails 4.2.10, attr_encrypted 3.0.3 and Ruby 2.4.3. |
I got this error OpenSSL::Cipher::CipherError
I am using attr_encrypted gem for encrypt/decrypt data.
When I use my secret key directly then it works fine. But when i am using key by ENV variable then I got above error.
Anyone faced the similar issue?
previous ruby version was 2.3.5, after updating 2.6.6
previous rails version was 4.1, after updating 5.2
The text was updated successfully, but these errors were encountered: