sinatra-github_webhooks 0.1.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56010d2a9cbff41596e593d634adbed94fe02088
4
- data.tar.gz: f5da5c357924b92044f9d84f88f3d337f7c18483
3
+ metadata.gz: 95672e1171e1f3205042fca7f7ff8a6de76a71b1
4
+ data.tar.gz: f0a285d54e3a6d5e496f21e0c29809c1915b3f7b
5
5
  SHA512:
6
- metadata.gz: 6e079d957e8078f40c0e75dcb47f2fff990147f28eb13abaaef21eed4dcf7d7e8a71edbde7515ea4c1ac58ac62971111eb0da430701a7df17715b5f8f4a83170
7
- data.tar.gz: c2c3fcd954ddfe92756678d8a9ca86eca37443b7acb1f019af2e2fd45af5e22ade24ed9bf30ed7e85bdd8899393c7489ab2d92da4e40c9546078ba319ce67930
6
+ metadata.gz: a7a62b8579cccb4add386d7bfa847fdf033aefe9ba478d0d56e35dbac8da517433b4eea7614d76e5f2feccda49e4baa9fcba12d81d88f23977cc5e38961238dd
7
+ data.tar.gz: 0001659f2e011ca76535efdd8472e2459ee43443935809d38acf32580face50a57db41a8f97ce4bff167bb7ea452c6453901f12680186e2e3a7edf5fb5fb7156
data/CHANGELOG.md CHANGED
@@ -3,9 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
- ## 0.0.1 - 2015-11-29
6
+ ## [0.2.0] - 2015-11-29
7
+
8
+ ### Changed
9
+
10
+ - Internal refactor to use signature verification logic from `rack-github_webhooks`
11
+
12
+ ## 0.1.0 - 2015-11-29
7
13
 
8
14
  ### Added
9
15
 
10
16
  - `github_event` method for getting the value of the `X-Github-Event`
11
17
  - `payload` method which returns a Hash of the request body after verifying the request signature.
18
+
19
+ [0.2.0]: https://github.com/chrismytton/rack-github_webhooks/compare/v0.1.0...v0.2.0
@@ -1,13 +1,11 @@
1
1
  require 'sinatra/github_webhooks/version'
2
2
 
3
3
  require 'sinatra/base'
4
- require 'openssl'
4
+ require 'rack/github_webhooks'
5
5
  require 'json'
6
6
 
7
7
  module Sinatra
8
8
  module GithubWebhooks
9
- HMAC_DIGEST = OpenSSL::Digest.new('sha1')
10
-
11
9
  def github_event
12
10
  request.env['HTTP_X_GITHUB_EVENT']
13
11
  end
@@ -31,16 +29,12 @@ module Sinatra
31
29
  logger.warn "No :github_webhook_secret setting found, skipping signature verification"
32
30
  return
33
31
  end
34
- signature = 'sha1=' + OpenSSL::HMAC.hexdigest(
35
- HMAC_DIGEST,
32
+ signature = Rack::GithubWebhooks::Signature.new(
36
33
  settings.github_webhook_secret,
34
+ request.env['HTTP_X_HUB_SIGNATURE'],
37
35
  payload_body
38
36
  )
39
- signatures_match = Rack::Utils.secure_compare(
40
- signature,
41
- request.env['HTTP_X_HUB_SIGNATURE']
42
- )
43
- return halt 500, "Signatures didn't match!" unless signatures_match
37
+ return halt 500, "Signatures didn't match!" unless signature.valid?
44
38
  end
45
39
  end
46
40
 
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module GithubWebhooks
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'sinatra'
22
+ spec.add_dependency 'rack-github_webhooks', '>= 0.3.0'
22
23
 
23
24
  spec.add_development_dependency 'bundler', '~> 1.10'
24
25
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-github_webhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Mytton
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack-github_webhooks
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement