Skip to content

Commit

Permalink
🚑️ [SECURITY] Fix unsafe string comparison
Browse files Browse the repository at this point in the history
- Closes #156

Signed-off-by: Peter Boling <peter.boling@gmail.com>
  • Loading branch information
pboling committed Oct 31, 2021
1 parent 3925b6f commit 9839886
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/oauth/signature/base.rb
Expand Up @@ -51,7 +51,9 @@ def signature
end

def ==(cmp_signature)
signature == cmp_signature
check = signature.bytesize ^ cmp_signature.bytesize
signature.bytes.zip(cmp_signature.bytes) { |x, y| check |= x ^ y.to_i }
check.zero?
end

def verify
Expand Down

0 comments on commit 9839886

Please sign in to comment.