mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 12:47:29 +02:00
Fix issues raising from upgrade to Ruby 2.4
This commit is contained in:
parent
646fb76007
commit
4a6742692a
5 changed files with 11 additions and 5 deletions
|
@ -1 +1 @@
|
|||
2.3.7
|
||||
2.4.3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM internetee/ruby:2.3
|
||||
FROM internetee/ruby:2.4
|
||||
MAINTAINER maciej.szlosarczyk@internet.ee
|
||||
|
||||
RUN mkdir -p /opt/webapps/app/tmp/pids
|
||||
|
|
|
@ -26,7 +26,10 @@ class AuthTokenCreator
|
|||
def encrypted_token
|
||||
encryptor = OpenSSL::Cipher::AES.new(256, :CBC)
|
||||
encryptor.encrypt
|
||||
encryptor.key = key
|
||||
|
||||
# OpenSSL used to automatically shrink oversized keys, it does not do that any longer.
|
||||
# See: https://github.com/ruby/openssl/issues/116
|
||||
encryptor.key = key[0..31]
|
||||
encrypted_bytes = encryptor.update(hashable) + encryptor.final
|
||||
Base64.urlsafe_encode64(encrypted_bytes)
|
||||
end
|
||||
|
|
|
@ -16,7 +16,10 @@ class AuthTokenDecryptor
|
|||
def decrypt_token
|
||||
decipher = OpenSSL::Cipher::AES.new(256, :CBC)
|
||||
decipher.decrypt
|
||||
decipher.key = key
|
||||
|
||||
# OpenSSL used to automatically shrink oversized keys, it does not do that any longer.
|
||||
# See: https://github.com/ruby/openssl/issues/116
|
||||
decipher.key = key[0..31]
|
||||
|
||||
base64_decoded = Base64.urlsafe_decode64(token.to_s)
|
||||
plain = decipher.update(base64_decoded) + decipher.final
|
||||
|
|
|
@ -8,7 +8,7 @@ class AuthTokenCreatorTest < ActiveSupport::TestCase
|
|||
|
||||
@user = users(:registrant)
|
||||
time = Time.zone.parse('2010-07-05 00:30:00 +0000')
|
||||
@random_bytes = SecureRandom.random_bytes(64)
|
||||
@random_bytes = SecureRandom.random_bytes(32)
|
||||
@token_creator = AuthTokenCreator.new(@user, @random_bytes, time)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue