github_webhook 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/README.md +8 -3
- data/lib/github_webhook/processor.rb +3 -2
- data/lib/github_webhook/version.rb +1 -1
- data/spec/github_webhook/processor_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 285de73545052ef08df5f6196afbc7f8518c0623
|
4
|
+
data.tar.gz: 5cb6d51070167f9b52273bfef55bbd4f2a669240
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fb9d9ab34f1938decb04a19e37229a1a0e614cea6857b419f9fabb0db2d4d979945276b7873165158433533a65510a729f18fed0311123e7a0c231c263e9de5
|
7
|
+
data.tar.gz: 7e64a43a655c9773cf524dd28783a0cb3967a0518d7439a8dbdd4a75e0e59c84b79aff9eeaaa5ce2d43fca0fac95f8f0725c3084e00c73bc9a1d9c398409c25c
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
github_webhook (0.
|
4
|
+
github_webhook (0.2.0)
|
5
5
|
activesupport (~> 4)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (4.1.
|
10
|
+
activesupport (4.1.1)
|
11
11
|
i18n (~> 0.6, >= 0.6.9)
|
12
12
|
json (~> 1.7, >= 1.7.7)
|
13
13
|
minitest (~> 5.1)
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
diff-lcs (1.2.5)
|
17
17
|
i18n (0.6.9)
|
18
18
|
json (1.8.1)
|
19
|
-
minitest (5.3.
|
19
|
+
minitest (5.3.5)
|
20
20
|
rake (10.3.1)
|
21
21
|
rspec (2.14.1)
|
22
22
|
rspec-core (~> 2.14.0)
|
@@ -26,8 +26,8 @@ GEM
|
|
26
26
|
rspec-expectations (2.14.5)
|
27
27
|
diff-lcs (>= 1.1.3, < 2.0)
|
28
28
|
rspec-mocks (2.14.6)
|
29
|
-
thread_safe (0.3.
|
30
|
-
tzinfo (1.1
|
29
|
+
thread_safe (0.3.4)
|
30
|
+
tzinfo (1.2.1)
|
31
31
|
thread_safe (~> 0.1)
|
32
32
|
|
33
33
|
PLATFORMS
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
[](https://travis-ci.org/ssaunier/github_webhook)
|
2
|
+
[](http://badge.fury.io/rb/github_webhook)
|
3
3
|
|
4
4
|
|
5
5
|
# GithubWebhook
|
@@ -34,11 +34,16 @@ Then create a new controller:
|
|
34
34
|
# app/controllers/github_webhooks_controller.rb
|
35
35
|
class GithubWebhooksController < ActionController::Base
|
36
36
|
include GithubWebhook::Processor
|
37
|
-
WEBHOOK_SECRET = ENV['GITHUB_WEBHOOK_SECRET']
|
38
37
|
|
39
38
|
def push(payload)
|
40
39
|
# TODO: handle push webhook
|
41
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def webhook_secret(payload)
|
45
|
+
ENV['GITHUB_WEBHOOK_SECRET']
|
46
|
+
end
|
42
47
|
end
|
43
48
|
```
|
44
49
|
|
@@ -26,9 +26,10 @@ module GithubWebhook::Processor
|
|
26
26
|
HMAC_DIGEST = OpenSSL::Digest.new('sha1')
|
27
27
|
|
28
28
|
def authenticate_github_request!
|
29
|
-
raise UnspecifiedWebhookSecretError.new unless
|
29
|
+
raise UnspecifiedWebhookSecretError.new unless respond_to?(:webhook_secret)
|
30
|
+
secret = webhook_secret(json_body)
|
30
31
|
|
31
|
-
expected_signature = "sha1=#{OpenSSL::HMAC.hexdigest(HMAC_DIGEST,
|
32
|
+
expected_signature = "sha1=#{OpenSSL::HMAC.hexdigest(HMAC_DIGEST, secret, request_body)}"
|
32
33
|
if signature_header != expected_signature
|
33
34
|
raise SignatureError.new "Actual: #{signature_header}, Expected: #{expected_signature}"
|
34
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_webhook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Saunier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|