Skip to content

Commit

Permalink
Revert "Fix "Exception: ActionView::Template::Error: wrong number of …
Browse files Browse the repository at this point in the history
…arguments (2 for 1)""

This reverts commit 08edf16.
  • Loading branch information
kamipo committed Mar 30, 2021
1 parent 1b14b24 commit a39e3e5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ def masked_authenticity_token(session, form_options: {}) # :doc:
global_csrf_token(session)
end

one_time_pad = SecureRandom.random_bytes(AUTHENTICITY_TOKEN_LENGTH)
encrypted_csrf_token = xor_byte_strings(one_time_pad, raw_token)
masked_token = one_time_pad + encrypted_csrf_token
Base64.urlsafe_encode64(masked_token, padding: false)

mask_token(raw_token)
end

Expand Down Expand Up @@ -371,7 +376,7 @@ def mask_token(raw_token) # :doc:
one_time_pad = SecureRandom.random_bytes(AUTHENTICITY_TOKEN_LENGTH)
encrypted_csrf_token = xor_byte_strings(one_time_pad, raw_token)
masked_token = one_time_pad + encrypted_csrf_token
Base64.urlsafe_encode64(masked_token).delete("=")
Base64.strict_encode64(masked_token)
end

def compare_with_real_token(token, session) # :doc:
Expand Down

0 comments on commit a39e3e5

Please sign in to comment.