mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Merge pull request #5274 from dominikb/main
Use Base64.urlsafe_* like Rake::Protection::AuthenticityToken
This commit is contained in:
commit
d0a4b1fdc8
1 changed files with 2 additions and 2 deletions
|
@ -143,7 +143,7 @@ module Sidekiq
|
||||||
one_time_pad = SecureRandom.random_bytes(token.length)
|
one_time_pad = SecureRandom.random_bytes(token.length)
|
||||||
encrypted_token = xor_byte_strings(one_time_pad, token)
|
encrypted_token = xor_byte_strings(one_time_pad, token)
|
||||||
masked_token = one_time_pad + encrypted_token
|
masked_token = one_time_pad + encrypted_token
|
||||||
Base64.strict_encode64(masked_token)
|
Base64.urlsafe_encode64(masked_token)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Essentially the inverse of +mask_token+.
|
# Essentially the inverse of +mask_token+.
|
||||||
|
@ -169,7 +169,7 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def decode_token(token)
|
def decode_token(token)
|
||||||
Base64.strict_decode64(token)
|
Base64.urlsafe_decode64(token)
|
||||||
end
|
end
|
||||||
|
|
||||||
def xor_byte_strings(s1, s2)
|
def xor_byte_strings(s1, s2)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue