grape-slack-bot 1.7.0 → 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: bf068ba32d5e7319a9e8d96710dfa364fcccedf1e0755b32305409455293b7cc
4
- data.tar.gz: 2c7bba45e4a549dcc1ac64b707349244b19dcbc6ef0a069504e192a350c4f10e
3
+ metadata.gz: 92616381f617b332e3c87bff1078c1039fa1fb15b9e6b6c1cc536be3e4a4d7fb
4
+ data.tar.gz: e9d7d54737d837adfde2df90d79446ba92a8db469c04156c9b16e608bd272b0c
5
5
  SHA512:
6
- metadata.gz: b362b4a0a379c2ff986fe11d554e1aaef10b3581190c7487833c2c69b503cc2f57d1e6b393e4afb19442176079bdc472a2717e57c8921d6dc0f51a92d64f0e9e
7
- data.tar.gz: f150f3b05dda3a59d8b818bd574dfd5fcb08f688ad2eb6d263bba31bc821351f858a5bb1e05a3ee17199fe1d7dd0c4bab628127251314cbb6d1d7a809bc46bff
6
+ metadata.gz: 3c6a8d172c58244862bd8724db7a329a827e13a57b527daaecb21545f63f2a8ea5003a3f4800bd63d014b2c4a4c60c0d34b729bcd84325e7541015e56db03b4f
7
+ data.tar.gz: da94c5ffcb89090fdc79addf066d24f7cbc5643e7e729556f660806b430781fb25a4086dc64aa4efbf1eb257e99e210d0199d626172638b6361a4143d99d7f65
@@ -52,7 +52,7 @@ module SlackBot
52
52
  config: self,
53
53
  handler_name: handler_name
54
54
  )
55
- endpoint.instance_eval(&) if block
55
+ endpoint.instance_eval(&) if block_given?
56
56
  endpoint
57
57
  end
58
58
  end
@@ -116,7 +116,7 @@ module SlackBot
116
116
  endpoint: self,
117
117
  handler_name: handler_name
118
118
  )
119
- command.instance_eval(&) if block
119
+ command.instance_eval(&) if block_given?
120
120
  command
121
121
  end
122
122
  end
@@ -166,7 +166,7 @@ module SlackBot
166
166
  )
167
167
 
168
168
  command_config = @argument_command_configs[argument_token.to_sym]
169
- command_config.instance_eval(&) if block
169
+ command_config.instance_eval(&) if block_given?
170
170
 
171
171
  command_config
172
172
  end
@@ -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.0".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.0
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov