diff --git a/lib/signature.rb b/lib/signature.rb index 57b5867..19d16da 100644 --- a/lib/signature.rb +++ b/lib/signature.rb @@ -223,6 +223,8 @@ def validate_signature!(token) # Constant time string comparison def identical?(a, b) + return true if a.nil? && b.nil? + return false if a.nil? || b.nil? return false unless a.bytesize == b.bytesize a.bytes.zip(b.bytes).reduce(0) { |memo, (a, b)| memo += a ^ b } == 0 end