grape-slack-bot 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2af9ee1dcca9101aaf2fb823f45ce1609c591024ab1e9084d3add79fad87d243
4
- data.tar.gz: d83d3790de38c03b5f0cf6757ac7fc66334793a76d07fc9e0d82b2cb110306a5
3
+ metadata.gz: 92616381f617b332e3c87bff1078c1039fa1fb15b9e6b6c1cc536be3e4a4d7fb
4
+ data.tar.gz: e9d7d54737d837adfde2df90d79446ba92a8db469c04156c9b16e608bd272b0c
5
5
  SHA512:
6
- metadata.gz: 26b539c209daf44688511578754ebc222a919728a2694bca0d11a737cc0222d219bc61b382974cd10d8ff9d0f31222d0b97e61074ae5a7210516f3a003806dd9
7
- data.tar.gz: '04719c66bec6569d1cf2dc99351bffc55cb6826d53fb3e07678e803bda60c5f69f590b952f6a7468b795777a2c6c79fcff48f9ec1f03241574f5b6ce7598d6ac'
6
+ metadata.gz: 3c6a8d172c58244862bd8724db7a329a827e13a57b527daaecb21545f63f2a8ea5003a3f4800bd63d014b2c4a4c60c0d34b729bcd84325e7541015e56db03b4f
7
+ data.tar.gz: da94c5ffcb89090fdc79addf066d24f7cbc5643e7e729556f660806b430781fb25a4086dc64aa4efbf1eb257e99e210d0199d626172638b6361a4143d99d7f65
@@ -12,8 +12,13 @@ module SlackBot
12
12
  end
13
13
 
14
14
  def verify_slack_signature!
15
- slack_signing_secret = ENV.fetch("SLACK_SIGNING_SECRET")
16
- timestamp = request.headers.fetch("x-slack-request-timestamp")
15
+ slack_signing_secret = ENV["SLACK_SIGNING_SECRET"]
16
+ timestamp = request.headers["x-slack-request-timestamp"] || request.headers["X-Slack-Request-Timestamp"]
17
+ slack_signature = request.headers["x-slack-signature"] || request.headers["X-Slack-Signature"]
18
+ if slack_signing_secret.blank? || timestamp.blank? || slack_signature.blank?
19
+ raise SlackBot::Errors::SignatureAuthenticationError.new("Missing signature headers")
20
+ end
21
+
17
22
  request_body = request.body.read
18
23
  sig_basestring = "v0:#{timestamp}:#{request_body}"
19
24
  my_signature =
@@ -23,7 +28,6 @@ module SlackBot
23
28
  slack_signing_secret,
24
29
  sig_basestring
25
30
  )
26
- slack_signature = request.headers.fetch("x-slack-signature")
27
31
  if ActiveSupport::SecurityUtils.secure_compare(
28
32
  my_signature,
29
33
  slack_signature
data/lib/slack_bot.rb CHANGED
@@ -22,5 +22,5 @@ require "slack_bot/pager"
22
22
  require "slack_bot/grape_extension"
23
23
 
24
24
  module SlackBot
25
- VERSION = "1.7.1".freeze
25
+ VERSION = "1.7.2".freeze
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-slack-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov