pact_broker 2.23.0 → 2.23.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/lib/pact_broker/api/resources/all_webhooks.rb +1 -1
  4. data/lib/pact_broker/api/resources/badge.rb +1 -1
  5. data/lib/pact_broker/api/resources/base_resource.rb +4 -0
  6. data/lib/pact_broker/api/resources/dashboard.rb +1 -1
  7. data/lib/pact_broker/api/resources/error_test.rb +1 -1
  8. data/lib/pact_broker/api/resources/group.rb +1 -1
  9. data/lib/pact_broker/api/resources/index.rb +1 -1
  10. data/lib/pact_broker/api/resources/label.rb +1 -1
  11. data/lib/pact_broker/api/resources/latest_pact.rb +1 -1
  12. data/lib/pact_broker/api/resources/latest_pacts.rb +1 -1
  13. data/lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb +1 -1
  14. data/lib/pact_broker/api/resources/matrix.rb +1 -1
  15. data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +1 -1
  16. data/lib/pact_broker/api/resources/pact.rb +1 -1
  17. data/lib/pact_broker/api/resources/pact_content_diff.rb +1 -1
  18. data/lib/pact_broker/api/resources/pact_triggered_webhooks.rb +2 -1
  19. data/lib/pact_broker/api/resources/pact_version.rb +1 -1
  20. data/lib/pact_broker/api/resources/pact_versions.rb +1 -1
  21. data/lib/pact_broker/api/resources/pact_webhooks.rb +1 -1
  22. data/lib/pact_broker/api/resources/pact_webhooks_status.rb +1 -1
  23. data/lib/pact_broker/api/resources/pacticipant.rb +1 -1
  24. data/lib/pact_broker/api/resources/pacticipants.rb +1 -1
  25. data/lib/pact_broker/api/resources/pacticipants_for_label.rb +1 -1
  26. data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +1 -1
  27. data/lib/pact_broker/api/resources/provider_pacts.rb +1 -1
  28. data/lib/pact_broker/api/resources/relationships.rb +1 -1
  29. data/lib/pact_broker/api/resources/tag.rb +1 -1
  30. data/lib/pact_broker/api/resources/triggered_webhook_logs.rb +1 -1
  31. data/lib/pact_broker/api/resources/verification.rb +1 -1
  32. data/lib/pact_broker/api/resources/verification_triggered_webhooks.rb +1 -1
  33. data/lib/pact_broker/api/resources/verifications.rb +1 -1
  34. data/lib/pact_broker/api/resources/version.rb +1 -1
  35. data/lib/pact_broker/api/resources/versions.rb +1 -1
  36. data/lib/pact_broker/api/resources/webhook.rb +1 -1
  37. data/lib/pact_broker/api/resources/webhook_execution.rb +1 -1
  38. data/lib/pact_broker/api/resources/webhooks.rb +1 -1
  39. data/lib/pact_broker/doc/views/webhooks.markdown +1 -1
  40. data/lib/pact_broker/version.rb +1 -1
  41. data/spec/lib/pact_broker/api/resources/base_resource_spec.rb +21 -0
  42. data/spec/service_consumers/hal_relation_proxy_app.rb +3 -1
  43. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8781ad53ce4869d80b5c2ad87288cd6d6e1561da
4
- data.tar.gz: e83f9bc9fd4b337ac1d28a210402db80af340a5f
3
+ metadata.gz: af5e56af0fcb01af75c45a0f2d0377795c2d57b8
4
+ data.tar.gz: 90dd47be6e7aa273e7f5f7d50e381f3968bde7b3
5
5
  SHA512:
6
- metadata.gz: 3c424033d9cb8fa602a2344d11eea58722001df6fc6555e10d51a4af28b29e92f660156650da1b7fd511a7496e5e9b9d01afdec1b4d288569cf49a567ef9a818
7
- data.tar.gz: f746b17398c51084398b6c4197a4c42b61ea91b7f8b95c210234cb00102fff4f82e9f4ac5e4c26136ee1b375c1147d23909e137ee40e7ec8a21eefbd30432994
6
+ metadata.gz: 3aca8efd6e49da134e00322211e084ebb9696db70c7dc92cfdb6f09b342a8d48e1e7a6d5831315c2463dddd5b53b873576a527f57195495b3e2c78cb46e613f2
7
+ data.tar.gz: 84feaf4b1641bab2293d9b2f332ba8b5e9a92e9fe6afbd8270ad9618de90e58d5e34b5f2496c7ade4d91451ce8049c0df17e269468ab631ac08e3a38d74405b3
@@ -1,3 +1,17 @@
1
+ <a name="v2.23.1"></a>
2
+ ### v2.23.1 (2018-06-23)
3
+
4
+
5
+ #### Features
6
+
7
+ * respond correctly to OPTIONS requests ([c5d3937](/../../commit/c5d3937))
8
+
9
+
10
+ #### Bug Fixes
11
+
12
+ * add missing require to pact_triggered_webhooks ([aaf1755](/../../commit/aaf1755))
13
+
14
+
1
15
  <a name="v2.23.0"></a>
2
16
  ### v2.23.0 (2018-06-20)
3
17
 
@@ -18,7 +18,7 @@ module PactBroker
18
18
  end
19
19
 
20
20
  def allowed_methods
21
- ["GET", "POST"]
21
+ ["GET", "POST", "OPTIONS", "OPTIONS"]
22
22
  end
23
23
 
24
24
  def create_path
@@ -9,7 +9,7 @@ module PactBroker
9
9
  class Badge < BaseResource
10
10
 
11
11
  def allowed_methods
12
- ['GET']
12
+ ["GET", "OPTIONS", "OPTIONS"]
13
13
  end
14
14
 
15
15
  def content_types_provided
@@ -30,6 +30,10 @@ module PactBroker
30
30
  PactBroker.configuration.before_resource.call(self)
31
31
  end
32
32
 
33
+ def options
34
+ { 'Access-Control-Allow-Methods' => allowed_methods.join(", ")}
35
+ end
36
+
33
37
  def update_matrix_after_request?
34
38
  false
35
39
  end
@@ -16,7 +16,7 @@ module PactBroker
16
16
  end
17
17
 
18
18
  def allowed_methods
19
- ["GET"]
19
+ ["GET", "OPTIONS"]
20
20
  end
21
21
 
22
22
  def to_json
@@ -20,7 +20,7 @@ module PactBroker
20
20
  end
21
21
 
22
22
  def allowed_methods
23
- ["GET", "POST"]
23
+ ["GET", "POST", "OPTIONS"]
24
24
  end
25
25
 
26
26
  def to_json
@@ -13,7 +13,7 @@ module PactBroker
13
13
  end
14
14
 
15
15
  def allowed_methods
16
- ["GET"]
16
+ ["GET", "OPTIONS"]
17
17
  end
18
18
 
19
19
  def resource_exists?
@@ -12,7 +12,7 @@ module PactBroker
12
12
  end
13
13
 
14
14
  def allowed_methods
15
- ["GET"]
15
+ ["GET", "OPTIONS"]
16
16
  end
17
17
 
18
18
  def to_json
@@ -15,7 +15,7 @@ module PactBroker
15
15
  end
16
16
 
17
17
  def allowed_methods
18
- ["GET","PUT","DELETE"]
18
+ ["GET", "PUT", "DELETE", "OPTIONS"]
19
19
  end
20
20
 
21
21
  def from_json
@@ -14,7 +14,7 @@ module PactBroker
14
14
  end
15
15
 
16
16
  def allowed_methods
17
- ["GET"]
17
+ ["GET", "OPTIONS"]
18
18
  end
19
19
 
20
20
  def resource_exists?
@@ -11,7 +11,7 @@ module PactBroker
11
11
  end
12
12
 
13
13
  def allowed_methods
14
- ["GET"]
14
+ ["GET", "OPTIONS"]
15
15
  end
16
16
 
17
17
  def to_json
@@ -11,7 +11,7 @@ module PactBroker
11
11
  class LatestVerificationsForConsumerVersion < BaseResource
12
12
 
13
13
  def allowed_methods
14
- ["GET"]
14
+ ["GET", "OPTIONS"]
15
15
  end
16
16
 
17
17
  def content_types_provided
@@ -20,7 +20,7 @@ module PactBroker
20
20
  end
21
21
 
22
22
  def allowed_methods
23
- ["GET"]
23
+ ["GET", "OPTIONS"]
24
24
  end
25
25
 
26
26
  def malformed_request?
@@ -11,7 +11,7 @@ module PactBroker
11
11
  end
12
12
 
13
13
  def allowed_methods
14
- ["GET"]
14
+ ["GET", "OPTIONS"]
15
15
  end
16
16
 
17
17
  def resource_exists?
@@ -34,7 +34,7 @@ module PactBroker
34
34
  end
35
35
 
36
36
  def allowed_methods
37
- ["GET", "PUT", "DELETE", "PATCH"]
37
+ ["GET", "PUT", "DELETE", "PATCH", "OPTIONS"]
38
38
  end
39
39
 
40
40
  def known_methods
@@ -11,7 +11,7 @@ module PactBroker
11
11
  end
12
12
 
13
13
  def allowed_methods
14
- ["GET"]
14
+ ["GET", "OPTIONS"]
15
15
  end
16
16
 
17
17
  def resource_exists?
@@ -1,3 +1,4 @@
1
+ require 'pact_broker/api/resources/base_resource'
1
2
  require 'pact_broker/api/decorators/triggered_webhooks_decorator'
2
3
 
3
4
  module PactBroker
@@ -5,7 +6,7 @@ module PactBroker
5
6
  module Resources
6
7
  class PactTriggeredWebhooks < BaseResource
7
8
  def allowed_methods
8
- ["GET"]
9
+ ["GET", "OPTIONS"]
9
10
  end
10
11
 
11
12
  def content_types_provided
@@ -5,7 +5,7 @@ module PactBroker
5
5
  module Resources
6
6
  class PactVersion < Pact
7
7
  def allowed_methods
8
- ["GET"]
8
+ ["GET", "OPTIONS"]
9
9
  end
10
10
  end
11
11
  end
@@ -13,7 +13,7 @@ module PactBroker
13
13
  end
14
14
 
15
15
  def allowed_methods
16
- ["GET"]
16
+ ["GET", "OPTIONS"]
17
17
  end
18
18
 
19
19
  def resource_exists?
@@ -11,7 +11,7 @@ module PactBroker
11
11
  class PactWebhooks < BaseResource
12
12
 
13
13
  def allowed_methods
14
- ["POST", "GET"]
14
+ ["POST", "GET", "OPTIONS"]
15
15
  end
16
16
 
17
17
  def content_types_provided
@@ -9,7 +9,7 @@ module PactBroker
9
9
  class PactWebhooksStatus < BaseResource
10
10
 
11
11
  def allowed_methods
12
- ["GET"]
12
+ ["GET", "OPTIONS"]
13
13
  end
14
14
 
15
15
  def content_types_provided
@@ -23,7 +23,7 @@ module PactBroker
23
23
  end
24
24
 
25
25
  def allowed_methods
26
- ["GET", "PATCH", "DELETE"]
26
+ ["GET", "PATCH", "DELETE", "OPTIONS"]
27
27
  end
28
28
 
29
29
  def known_methods
@@ -17,7 +17,7 @@ module PactBroker
17
17
  end
18
18
 
19
19
  def allowed_methods
20
- ["GET", "POST"]
20
+ ["GET", "POST", "OPTIONS"]
21
21
  end
22
22
 
23
23
  def malformed_request?
@@ -11,7 +11,7 @@ module PactBroker
11
11
  end
12
12
 
13
13
  def allowed_methods
14
- ["GET"]
14
+ ["GET", "OPTIONS"]
15
15
  end
16
16
 
17
17
  def to_json
@@ -14,7 +14,7 @@ module PactBroker
14
14
  end
15
15
 
16
16
  def allowed_methods
17
- ["GET"]
17
+ ["GET", "OPTIONS"]
18
18
  end
19
19
 
20
20
  def resource_exists?
@@ -12,7 +12,7 @@ module PactBroker
12
12
  end
13
13
 
14
14
  def allowed_methods
15
- ["GET"]
15
+ ["GET", "OPTIONS"]
16
16
  end
17
17
 
18
18
  def resource_exists?
@@ -12,7 +12,7 @@ module PactBroker
12
12
  end
13
13
 
14
14
  def allowed_methods
15
- ["GET"]
15
+ ["GET", "OPTIONS"]
16
16
  end
17
17
 
18
18
  def to_csv
@@ -14,7 +14,7 @@ module PactBroker
14
14
  end
15
15
 
16
16
  def allowed_methods
17
- ["GET","PUT","DELETE"]
17
+ ["GET","PUT","DELETE", "OPTIONS"]
18
18
  end
19
19
 
20
20
  def from_json
@@ -12,7 +12,7 @@ module PactBroker
12
12
  end
13
13
 
14
14
  def allowed_methods
15
- ["GET"]
15
+ ["GET", "OPTIONS"]
16
16
  end
17
17
 
18
18
  def resource_exists?
@@ -15,7 +15,7 @@ module PactBroker
15
15
  end
16
16
 
17
17
  def allowed_methods
18
- ["GET"]
18
+ ["GET", "OPTIONS"]
19
19
  end
20
20
 
21
21
  def resource_exists?
@@ -5,7 +5,7 @@ module PactBroker
5
5
  module Resources
6
6
  class VerificationTriggeredWebhooks < BaseResource
7
7
  def allowed_methods
8
- ["GET"]
8
+ ["GET", "OPTIONS"]
9
9
  end
10
10
 
11
11
  def content_types_provided
@@ -19,7 +19,7 @@ module PactBroker
19
19
  end
20
20
 
21
21
  def allowed_methods
22
- ["POST"]
22
+ ["POST", "OPTIONS"]
23
23
  end
24
24
 
25
25
  def post_is_create?
@@ -13,7 +13,7 @@ module PactBroker
13
13
  end
14
14
 
15
15
  def allowed_methods
16
- ["GET", "DELETE"]
16
+ ["GET", "DELETE", "OPTIONS"]
17
17
  end
18
18
 
19
19
  def resource_exists?
@@ -13,7 +13,7 @@ module PactBroker
13
13
  end
14
14
 
15
15
  def allowed_methods
16
- ["GET"]
16
+ ["GET", "OPTIONS"]
17
17
  end
18
18
 
19
19
  def resource_exists?
@@ -17,7 +17,7 @@ module PactBroker
17
17
  end
18
18
 
19
19
  def allowed_methods
20
- ["GET", "PUT", "DELETE"]
20
+ ["GET", "PUT", "DELETE", "OPTIONS"]
21
21
  end
22
22
 
23
23
  def resource_exists?
@@ -10,7 +10,7 @@ module PactBroker
10
10
  class WebhookExecution < BaseResource
11
11
 
12
12
  def allowed_methods
13
- ["POST"]
13
+ ["POST", "OPTIONS"]
14
14
  end
15
15
 
16
16
  def process_post
@@ -9,7 +9,7 @@ module PactBroker
9
9
  class Webhooks < BaseResource
10
10
 
11
11
  def allowed_methods
12
- ["POST", "GET"]
12
+ ["POST", "GET", "OPTIONS"]
13
13
  end
14
14
 
15
15
  def content_types_provided
@@ -112,7 +112,7 @@ Example usage:
112
112
  <a name="whitelist"></a>
113
113
  ### Webhook Whitelist
114
114
 
115
- To ensure that webhooks cannot be used maliciously to expose either data about your contracts or your internal network, the following validation rules are applied to webhooks via the Pact Broker configuration settings.
115
+ To ensure that webhooks cannot be used maliciously to expose either data about your contracts or your internal network, the following validation rules are applied to webhooks via the Pact Broker [webhook whitelist configuration settings](https://github.com/pact-foundation/pact_broker/wiki/Configuration#webhook-whitelists) .
116
116
 
117
117
  * **Scheme**: Must be included in the `webhook_scheme_whitelist`, which by default only includes `https`. You can change this to include `http` if absolutely necessary, however, keep in mind that the body of any http traffic is visible to the network. You can load a self signed certificate into the Pact Broker to be used for https connections using [script/insert-self-signed-certificate-from-url.rb](https://github.com/pact-foundation/pact_broker/blob/master/script/insert-self-signed-certificate-from-url.rb) in the
118
118
  Pact Broker Github repository.
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = '2.23.0'
2
+ VERSION = '2.23.1'
3
3
  end
@@ -11,6 +11,27 @@ module PactBroker
11
11
  subject { BaseResource.new(request, response) }
12
12
 
13
13
  its(:resource_url) { is_expected.to eq 'http://example.org/path' }
14
+
15
+ describe "options" do
16
+ subject { options "/"; last_response }
17
+
18
+ it "returns a list of allowed methods" do
19
+ expect(subject.headers['Access-Control-Allow-Methods']).to eq "GET, OPTIONS"
20
+ end
21
+ end
22
+ end
23
+
24
+ ALL_RESOURCES = ObjectSpace.each_object(::Class).select {|klass| klass < BaseResource }
25
+
26
+ ALL_RESOURCES.each do | resource |
27
+ describe resource do
28
+ let(:request) { double('request', uri: URI("http://example.org")) }
29
+ let(:response) { double('response') }
30
+
31
+ it "includes OPTIONS in the list of allowed_methods" do
32
+ expect(resource.new(request, response).allowed_methods).to include "OPTIONS"
33
+ end
34
+ end
14
35
  end
15
36
  end
16
37
  end
@@ -7,7 +7,9 @@ class HalRelationProxyApp
7
7
  '/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-TAGGED-VERSION-Condor-production' =>
8
8
  '/pacticipants/Condor/latest-version/production',
9
9
  '/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor' =>
10
- '/pacticipants/Condor/latest-version'
10
+ '/pacticipants/Condor/latest-version',
11
+ '/HAL-REL-PLACEHOLDER-PB-WEBHOOKS' =>
12
+ '/webhooks'
11
13
  }
12
14
 
13
15
  RESPONSE_BODY_REPLACEMENTS = {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.23.0
4
+ version: 2.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-06-20 00:00:00.000000000 Z
13
+ date: 2018-06-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty