pact 1.40.0 → 1.41.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: ee129d01fa73fcb91d659aa33cae62309053e0af
4
- data.tar.gz: 9bb48533af443d5fec321152d45712d84159bf14
3
+ metadata.gz: 96a4c13319a6a73992c90671ac2bd8534c5cc8b7
4
+ data.tar.gz: 635cd37e9d7dfb4e0e96df05ed6f04fe5950d715
5
5
  SHA512:
6
- metadata.gz: 3b0b467e0dabd5394e9206a0f74261b528870a5a54edc69b9de6be511100631c85bb9a0aed3b3738ce05f0a9c640ad92654220a6da2b51b2984cd3351831000d
7
- data.tar.gz: cc95aefba6827fd507fcf9366462a8035acc5027b12221b5801036412e9161fb968d44795e33494c0f21a0a75b6b038820d12dc0511430cb8b68d063d2f77dce
6
+ metadata.gz: e7e439fab1aa8e5ac7213bdd07b3253477c15c5f134bb85587569e20aaf78b474121b1979ec97deb699af37e510a9a140b5cceb2a7ab83aa841ad861792ee8e4
7
+ data.tar.gz: 2fe5aff283d9aa665ae86612d37cf39e1472b9c38120d8d5caf6ce1239e57b29e899576c7cbc9c48d38a511266c3e926c5589b9b5999b43f69effb1ace20ef29
@@ -1,3 +1,12 @@
1
+ <a name="v1.41.0"></a>
2
+ ### v1.41.0 (2019-05-22)
3
+
4
+
5
+ #### Features
6
+
7
+ * redact Authorization header from HTTP client debug output ([c48c991](/../../commit/c48c991))
8
+
9
+
1
10
  <a name="v1.40.0"></a>
2
11
  ### v1.40.0 (2019-02-22)
3
12
 
@@ -0,0 +1,32 @@
1
+ require 'delegate'
2
+
3
+ module Pact
4
+ module Hal
5
+ class AuthorizationHeaderRedactor < SimpleDelegator
6
+ def puts(*args)
7
+ __getobj__().puts(*redact_args(args))
8
+ end
9
+
10
+ def print(*args)
11
+ __getobj__().puts(*redact_args(args))
12
+ end
13
+
14
+ def <<(*args)
15
+ __getobj__().send(:<<, *redact_args(args))
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :redactions
21
+
22
+ def redact_args(args)
23
+ args.collect{ | s| redact(s) }
24
+ end
25
+
26
+ def redact(string)
27
+ return string unless string.is_a?(String)
28
+ string.gsub(/Authorization: .*\\r\\n/, "Authorization: [redacted]\\r\\n")
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,4 +1,5 @@
1
1
  require 'pact/retry'
2
+ require 'pact/hal/authorization_header_redactor'
2
3
  require 'net/http'
3
4
 
4
5
  module Pact
@@ -47,7 +48,7 @@ module Pact
47
48
  def perform_request request, uri
48
49
  response = Retry.until_true do
49
50
  http = Net::HTTP.new(uri.host, uri.port, :ENV)
50
- http.set_debug_output(Pact.configuration.output_stream) if verbose
51
+ http.set_debug_output(output_stream) if verbose
51
52
  http.use_ssl = (uri.scheme == 'https')
52
53
  http.start do |http|
53
54
  http.request request
@@ -56,6 +57,10 @@ module Pact
56
57
  Response.new(response)
57
58
  end
58
59
 
60
+ def output_stream
61
+ AuthorizationHeaderRedactor.new(Pact.configuration.output_stream)
62
+ end
63
+
59
64
  class Response < SimpleDelegator
60
65
  def body
61
66
  bod = raw_body
@@ -1,4 +1,4 @@
1
1
  # Remember to bump pact-provider-proxy when this changes major version
2
2
  module Pact
3
- VERSION = "1.40.0"
3
+ VERSION = "1.41.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.40.0
4
+ version: 1.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Fraser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2019-03-04 00:00:00.000000000 Z
15
+ date: 2019-05-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: randexp
@@ -318,6 +318,7 @@ files:
318
318
  - lib/pact/doc/markdown/interaction.erb
319
319
  - lib/pact/doc/markdown/interaction_renderer.rb
320
320
  - lib/pact/doc/sort_interactions.rb
321
+ - lib/pact/hal/authorization_header_redactor.rb
321
322
  - lib/pact/hal/entity.rb
322
323
  - lib/pact/hal/http_client.rb
323
324
  - lib/pact/hal/link.rb