shipit-engine 0.43.4 → 0.44.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
  SHA256:
3
- metadata.gz: 7812fd5a848ac639a91c1d460deb46036e486d5b867c8944b22694fa36d11b80
4
- data.tar.gz: e41e95e8c766fd7e20461d21d5463fd37ab8cc2e9cfa2e6c38958e68bc48da32
3
+ metadata.gz: 66eab74ac8acc7bb806d26984fe9d221983da860661eff6d6ae7e263f71da2f4
4
+ data.tar.gz: 3b9b797b5bf0ea20278ad9d0145ab2c42e02a6053b0efdc7f30c9838ff81b382
5
5
  SHA512:
6
- metadata.gz: ba03564e83d57ff223597c80c14eb99b62ef8831cc3396f55a9def306905e996314699fed00f1a5ea04b1841535d980ff1fb87d9fc8fb05d8849e04e9414e0ee
7
- data.tar.gz: 17a7dbaffb9443dcf3b7e341af447f954c7e3fa2c931a4701d70a1747a4b815b0e7e7566d5e9686848887669cf3939b1ce05c560eb5dddc0487eebbafd80d652
6
+ metadata.gz: 23fbda676f424e7660165c46636901490b636645b1b51f9dc9755ff24c71ea5cd09f09ac4f734a9708bdc687affb5536a4aaf18849f9606998581aeef6b0b472
7
+ data.tar.gz: 89878c82e92b1b8780f7198800135fd18cc190ec5276b08bb48a7b1ffba65d4add8013f9e65b4e0af7910b8956c92dbb8b2f3043650e24c419eccdf825cce611
@@ -36,6 +36,16 @@ module Shipit
36
36
  "signature=#{request.headers['X-Hub-Signature']}",
37
37
  "status=#{status}"
38
38
  ].join(' '))
39
+ rescue Shipit::GithubOrganizationUnknown => e
40
+ head(422)
41
+ Rails.logger.warn([
42
+ 'WebhookController#verify_signature',
43
+ 'Webhook from unknown organization',
44
+ "event=#{event}",
45
+ "repository_owner=#{repository_owner}",
46
+ "unknown_organization=#{e.message}",
47
+ "status=#{status}"
48
+ ].join(' '))
39
49
  end
40
50
 
41
51
  def check_if_ping
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shipit
4
- VERSION = '0.43.4'
4
+ VERSION = '0.44.0'
5
5
  end
@@ -106,6 +106,26 @@ module Shipit
106
106
  assert_response :unprocessable_entity
107
107
  end
108
108
 
109
+ test "unknown github organization logs and returns unprocessable entity" do
110
+ @request.headers['X-Github-Event'] = 'push'
111
+
112
+ payload = JSON.parse(payload(:push_master))
113
+ payload["repository"]["owner"]["login"] = "unknown-org"
114
+
115
+ Shipit.stubs(:github).raises(Shipit::GithubOrganizationUnknown.new("unknown-org"))
116
+ Rails.logger.expects(:warn).with([
117
+ 'WebhookController#verify_signature',
118
+ 'Webhook from unknown organization',
119
+ "event=push",
120
+ "repository_owner=unknown-org",
121
+ "unknown_organization=unknown-org",
122
+ "status=422"
123
+ ].join(' '))
124
+
125
+ post :create, body: payload.to_json, as: :json
126
+ assert_response :unprocessable_entity
127
+ end
128
+
109
129
  test ":membership creates the mentioned team on the fly" do
110
130
  @request.headers['X-Github-Event'] = 'membership'
111
131
  assert_difference -> { Team.count }, 1 do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shipit-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.4
4
+ version: 0.44.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier