Skip to content

Commit 455306f

Browse files
committed
Use openssl implementation for secure_compare
1 parent 36d2d61 commit 455306f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/slack/events/request.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# frozen_string_literal: true
2+
3+
require 'openssl'
4+
25
module Slack
36
module Events
47
class Request
@@ -75,12 +78,7 @@ def verify!
7578
def secure_compare(computed_signature, signature)
7679
return false if computed_signature.bytesize != signature.bytesize
7780

78-
l = computed_signature.unpack "C#{computed_signature.bytesize}"
79-
80-
result = 0
81-
signature.each_byte { |byte| result |= byte ^ l.shift }
82-
83-
result.zero?
81+
OpenSSL.fixed_length_secure_compare(computed_signature, signature)
8482
end
8583
end
8684
end

0 commit comments

Comments
 (0)