Skip to content

Commit 9839886

Browse files
committed
🚑️ [SECURITY] Fix unsafe string comparison
- Closes #156 Signed-off-by: Peter Boling <peter.boling@gmail.com>
1 parent 3925b6f commit 9839886

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/oauth/signature/base.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def signature
5151
end
5252

5353
def ==(cmp_signature)
54-
signature == cmp_signature
54+
check = signature.bytesize ^ cmp_signature.bytesize
55+
signature.bytes.zip(cmp_signature.bytes) { |x, y| check |= x ^ y.to_i }
56+
check.zero?
5557
end
5658

5759
def verify

0 commit comments

Comments
 (0)