pact_broker-client 1.72.0 → 1.73.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: 95192c76cf2b56651bb52de5cd2c5f1bea45d966e5dfa4e8ef78d1e11a3a2a51
4
- data.tar.gz: 1a095144bc411e428556f47da77160d5c7a182e4eb2201d75f30075adb1cb009
3
+ metadata.gz: bfeaaf44e2dc8a19f90bd55795542da931dec46853371ea5a51955ccb1f3a39f
4
+ data.tar.gz: c9d00e81e65a20bc6f8a0b38c5c2af2c135e05266906f3b7bd45207a8f7e7b07
5
5
  SHA512:
6
- metadata.gz: 3553d23ad0bdae6e6f460a6a85dd3ab46789bf3cfe6241881c1f126642b73cf6ee9714f60e830c7108f8e0a0a188a7a2a6b1a42dda55be7ae2339b9ccfd3552b
7
- data.tar.gz: 3c039eb65e3f4f02c9f32ebf52936535ccb125e8105c4b1681aeafa90de007c7dc032824d20facf6e023c61e3b32147e188312b8a8244b506627fe69e8f414c0
6
+ metadata.gz: 521599522cf724dd5f0f28becbcc7faf2695c45e1050892ae0494573dc220d22427712548d4a1c5395d7caf9d59263405ff4b8158fdc2634ba8416292afc3447
7
+ data.tar.gz: 987e4569edfac0db3e0bc81483b67cee1d73803422e4dea145456dd61dd7afdad2ad632190cba28eb91501069fce9aa6a49b661cb6398be8a865a6dd681a81aa
@@ -10,7 +10,7 @@ jobs:
10
10
  test:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v3
13
+ - uses: actions/checkout@v4
14
14
  - uses: ruby/setup-ruby@v1
15
15
  - run: |
16
16
  gem install bundler -v 2.4
@@ -26,7 +26,7 @@ jobs:
26
26
  version: ${{ steps.release.outputs.version }}
27
27
  increment: ${{ steps.release.outputs.increment }}
28
28
  steps:
29
- - uses: actions/checkout@v3
29
+ - uses: actions/checkout@v4
30
30
  with:
31
31
  fetch-depth: 0
32
32
  - uses: pact-foundation/release-gem@v0.0.14
@@ -40,7 +40,7 @@ jobs:
40
40
  needs: release
41
41
  runs-on: ubuntu-latest
42
42
  steps:
43
- - uses: actions/checkout@v3
43
+ - uses: actions/checkout@v4
44
44
  - uses: ruby/setup-ruby@v1
45
45
  - name: Bundle install
46
46
  run: |
@@ -11,7 +11,7 @@ jobs:
11
11
  ruby_version: ["2.7", "3.0", "3.1", "3.2"]
12
12
  os: ["ubuntu-latest","windows-latest","macos-latest"]
13
13
  steps:
14
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v4
15
15
  - uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: ${{ matrix.ruby_version }}
@@ -25,7 +25,7 @@ jobs:
25
25
  matrix:
26
26
  feature: [""]
27
27
  steps:
28
- - uses: actions/checkout@v3
28
+ - uses: actions/checkout@v4
29
29
  - uses: ruby/setup-ruby@v1
30
30
  with:
31
31
  ruby-version: "3.2"
@@ -47,11 +47,11 @@ jobs:
47
47
  steps:
48
48
  - run: |
49
49
  docker run --rm \
50
- -e PACT_BROKER_BASE_URL=https://pact-oss.pactflow.io \
50
+ -e PACT_BROKER_BASE_URL=https://pact-foundation.pactflow.io \
51
51
  -e PACT_BROKER_TOKEN \
52
52
  pactfoundation/pact-cli:latest \
53
53
  broker can-i-deploy \
54
54
  --pacticipant "Pact Broker Client" --version ${GITHUB_SHA} \
55
- --pacticipant "Pact Broker" --latest master
55
+ --pacticipant "Pact Broker" --branch master
56
56
  env:
57
- PACT_BROKER_TOKEN: ${{ secrets.PACTFLOW_PACT_OSS_TOKEN }}
57
+ PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN_PACT_FOUNDATION }}
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ <a name="v1.73.0"></a>
2
+ ### v1.73.0 (2023-10-13)
3
+
4
+ #### Features
5
+
6
+ * print warnings and allow error to be raised when unknown option is used ([5412121](/../../commit/5412121))
7
+ * raise an error when an em dash is used instead of a normal dash ([0e8e773](/../../commit/0e8e773))
8
+ * support --help and -h flags ([a6458ab](/../../commit/a6458ab))
9
+ * handle x509 certs in HTTP Client (#142) ([c3aa8dc](/../../commit/c3aa8dc))
10
+
1
11
  <a name="v1.72.0"></a>
2
12
  ### v1.72.0 (2023-09-11)
3
13
 
data/DEVELOPING.md ADDED
@@ -0,0 +1,17 @@
1
+ # Developing
2
+
3
+ ## Testing pact_broker-client locally
4
+
5
+ 1. Make sure you have `ruby` available on the command line
6
+ 2. Install with `bundle install`
7
+ 3. Run tests with `bundle exec rake`
8
+ 4. Run individual test with `rspec <path to test>`
9
+ 5. Run one of the scripts in `./example/scripts`, see the readme for more detail, and scripts
10
+
11
+ ##  Available Rake tasks
12
+
13
+ 1. check `bundle exec rake --tasks`
14
+
15
+ ## Generating docs
16
+
17
+ If you change the CLI commands, run `bundle exec script/update-cli-usage-in-readme.rb` to update the `README.md` automatically.
data/Gemfile CHANGED
@@ -21,3 +21,8 @@ group :development do
21
21
  gem 'rspec-its', '~> 1.3'
22
22
  gem 'pry-byebug'
23
23
  end
24
+
25
+ group :test do
26
+ gem 'faraday', '~>2.0'
27
+ gem 'faraday-retry', '~>2.0'
28
+ end
data/README.md CHANGED
@@ -42,6 +42,14 @@ Basic auth parameters can be specified using the `$PACT_BROKER_USERNAME` and `$P
42
42
 
43
43
  Authentication using a bearer token can be specified using the environment variable `$PACT_BROKER_TOKEN` or the `-k` or `--broker-token` parameters. This bearer token authentication is used by [PactFlow](https://pactflow.io) and is not available in the [OSS Pact Broker](https://docs.pact.io/pact_broker/), which only supports basic auth.
44
44
 
45
+ ### Handling unknown options
46
+
47
+ By default, the underlying library used for the Pact Broker CLI (Thor) does not raise an error in every situation where there is an unknown option used.
48
+ This can allow invalid commands to be executed that do not perform as expected.
49
+
50
+ From version 1.73.0, warnings will be printed for unknown options, and if the environment variable `PACT_BROKER_ERROR_ON_UNKNOWN_OPTION=true` is set, an error will be raised when an unknown option is used.
51
+
52
+ In the next major version, an error will be raised by default.
45
53
 
46
54
  <!-- start-autogenerated-docs -->
47
55
 
@@ -680,7 +688,9 @@ Options:
680
688
  -H, [--header=one two three]
681
689
  # Webhook Header
682
690
  -d, [--data=DATA]
683
- # Webhook payload (file or string)
691
+ # Webhook payload. Provide a JSON string (remember to escape
692
+ characters appropriately for the shell) or a file path prefixed
693
+ with the @ symbol, as per the curl usage for this flag.
684
694
  -u, [--user=USER]
685
695
  # Webhook basic auth username and password eg. username:password
686
696
  [--consumer=CONSUMER]
@@ -743,7 +753,9 @@ Options:
743
753
  -H, [--header=one two three]
744
754
  # Webhook Header
745
755
  -d, [--data=DATA]
746
- # Webhook payload (file or string)
756
+ # Webhook payload. Provide a JSON string (remember to escape
757
+ characters appropriately for the shell) or a file path prefixed
758
+ with the @ symbol, as per the curl usage for this flag.
747
759
  -u, [--user=USER]
748
760
  # Webhook basic auth username and password eg. username:password
749
761
  [--consumer=CONSUMER]
@@ -2305,8 +2305,7 @@ Pact Broker will respond with:
2305
2305
  "name": "Foo"
2306
2306
  },
2307
2307
  "version": {
2308
- "number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
2309
- "buildUrl": "http://build"
2308
+ "number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30"
2310
2309
  }
2311
2310
  },
2312
2311
  "logs": [
@@ -1,30 +1,41 @@
1
1
  require 'thor'
2
+ require 'pact_broker/client/cli/thor_unknown_options_monkey_patch'
2
3
  require 'pact_broker/client/hash_refinements'
3
4
 
4
5
  module PactBroker
5
6
  module Client
6
7
  module CLI
7
8
  class AuthError < ::Thor::Error; end
8
-
9
9
  ##
10
10
  # Custom Thor task allows the following:
11
11
  #
12
12
  # `--option 1 --option 2` to be interpreted as `--option 1 2` (the standard Thor format for multiple value options)
13
13
  #
14
+
14
15
  class CustomThor < ::Thor
15
16
  using PactBroker::Client::HashRefinements
16
17
 
18
+ EM_DASH = "\u2014"
19
+
20
+ check_unknown_options!
21
+
17
22
  no_commands do
18
23
  def self.exit_on_failure?
19
24
  true
20
25
  end
21
26
 
27
+ # Provide a wrapper method that can be stubbed in tests
28
+ def self.exit_with_error_code
29
+ exit(1)
30
+ end
31
+
22
32
  def self.start given_args = ARGV, config = {}
33
+ check_for_mdash!(given_args)
23
34
  super(massage_args(given_args))
24
35
  end
25
36
 
26
37
  def self.massage_args argv
27
- add_broker_config_from_environment_variables(turn_muliple_tag_options_into_array(argv))
38
+ add_broker_config_from_environment_variables(turn_muliple_tag_options_into_array(handle_help(argv)))
28
39
  end
29
40
 
30
41
  def self.add_broker_config_from_environment_variables argv
@@ -42,6 +53,25 @@ module PactBroker
42
53
  end
43
54
  end
44
55
 
56
+ # Thor expects help to be invoked by typing `help <command>`, which is very odd.
57
+ # Add support for `command --help|-h` by massaging the arguments into the format that Thor expects.
58
+ def self.handle_help(argv)
59
+ if argv.last == "--help" || argv.last == "-h"
60
+ argv[0..-3] + ["help", argv[-2]].compact
61
+ else
62
+ argv
63
+ end
64
+ end
65
+
66
+ def self.check_for_mdash!(argv)
67
+ if (word_with_mdash = argv.find{ |arg | arg.include?(EM_DASH) })
68
+ # Can't use the `raise Thor::Error` approach here (which is designed to show the error without a backtrace)
69
+ # because the exception is not handled within the Thor code, and will show an ugly backtrace.
70
+ $stdout.puts "The argument '#{word_with_mdash}' contains an em dash (the long dash you get in Microsoft Word when you type two short dashes in a row). Please replace it with a normal dash and try again."
71
+ exit_with_error_code
72
+ end
73
+ end
74
+
45
75
  # other task names, help, and the help shortcuts
46
76
  def self.known_first_arguments
47
77
  @known_first_arguments ||= tasks.keys + ::Thor::HELP_MAPPINGS + ['help']
@@ -0,0 +1,38 @@
1
+ require "thor"
2
+ require "term/ansicolor"
3
+
4
+ # Monkey patch Thor so we can print out a warning when there are unknown options, rather than raising an error.
5
+ # If PACT_BROKER_ERROR_ON_UNKNOWN_OPTION=true, raise the error, as the user will have opted in to this behaviour.
6
+ # This is for backwards compatibility reasons, and in the next major version, the flag will be removed.
7
+
8
+ class Thor
9
+ class Options < Arguments
10
+
11
+ alias_method :original_check_unknown!, :check_unknown!
12
+
13
+ # Replace the original check_unknown! method with an implementation
14
+ # that will print a warning rather than raising an error
15
+ # unless PACT_BROKER_ERROR_ON_UNKNOWN_OPTION=true is set.
16
+ def check_unknown!
17
+ if raise_error_on_unknown_options?
18
+ original_check_unknown!
19
+ else
20
+ check_unknown_and_warn
21
+ end
22
+ end
23
+
24
+ def raise_error_on_unknown_options?
25
+ ENV["PACT_BROKER_ERROR_ON_UNKNOWN_OPTION"] == "true"
26
+ end
27
+
28
+ def check_unknown_and_warn
29
+ begin
30
+ original_check_unknown!
31
+ rescue UnknownArgumentError => e
32
+ $stderr.puts(::Term::ANSIColor.yellow(e.message))
33
+ $stderr.puts(::Term::ANSIColor.yellow("This is a warning rather than an error so as not to break backwards compatibility. To raise an error for unknown options set PACT_BROKER_ERROR_ON_UNKNOWN_OPTION=true"))
34
+ $stderr.puts("\n")
35
+ end
36
+ end
37
+ end
38
+ end
@@ -12,7 +12,7 @@ module PactBroker
12
12
  def self.shared_options_for_webhook_commands
13
13
  method_option :request, banner: "METHOD", aliases: "-X", desc: "Webhook HTTP method", required: true
14
14
  method_option :header, aliases: "-H", type: :array, desc: "Webhook Header"
15
- method_option :data, aliases: "-d", desc: "Webhook payload (file or string)"
15
+ method_option :data, aliases: "-d", desc: "Webhook payload. Provide a JSON string (remember to escape characters appropriately for the shell) or a file path prefixed with the @ symbol, as per the curl usage for this flag."
16
16
  method_option :user, aliases: "-u", desc: "Webhook basic auth username and password eg. username:password"
17
17
  method_option :consumer, desc: "Consumer name"
18
18
  method_option :consumer_label, desc: "Consumer label, mutually exclusive with consumer name"
@@ -71,6 +71,12 @@ module PactBroker
71
71
  # See https://github.com/pact-foundation/pact-ruby-standalone/issues/57
72
72
  http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
73
73
  http.ca_path = ENV['SSL_CERT_DIR'] if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != ''
74
+
75
+ if x509_certificate?
76
+ http.cert = OpenSSL::X509::Certificate.new(x509_client_cert_file)
77
+ http.key = OpenSSL::PKey::RSA.new(x509_client_key_file)
78
+ end
79
+
74
80
  if disable_ssl_verification?
75
81
  if verbose?
76
82
  $stdout.puts("SSL verification is disabled")
@@ -127,6 +133,19 @@ module PactBroker
127
133
  verbose || ENV["VERBOSE"] == "true"
128
134
  end
129
135
 
136
+ def x509_certificate?
137
+ ENV['X509_CLIENT_CERT_FILE'] && ENV['X509_CLIENT_CERT_FILE'] != '' &&
138
+ ENV['X509_CLIENT_KEY_FILE'] && ENV['X509_CLIENT_KEY_FILE'] != ''
139
+ end
140
+
141
+ def x509_client_cert_file
142
+ File.read(ENV['X509_CLIENT_CERT_FILE'])
143
+ end
144
+
145
+ def x509_client_key_file
146
+ File.read(ENV['X509_CLIENT_KEY_FILE'])
147
+ end
148
+
130
149
  def disable_ssl_verification?
131
150
  ENV['PACT_DISABLE_SSL_VERIFICATION'] == 'true' || ENV['PACT_BROKER_DISABLE_SSL_VERIFICATION'] == 'true'
132
151
  end
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.72.0'
3
+ VERSION = '1.73.0'
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
- set -Eeuxo pipefail
3
+ set -eu
4
4
 
5
- bundle exec bin/pact-broker record-deployment \
5
+ bundle exec bin/pact-broker record-release \
6
6
  --pacticipant "Pact Broker Client" --version $GITHUB_SHA \
7
7
  --environment production
@@ -29,7 +29,7 @@ export PACT_BROKER_TOKEN=${PACT_BROKER_TOKEN:-"localhost"}
29
29
  # --contract-published
30
30
 
31
31
 
32
- bundle exec bin/pact-broker publish scripts/foo-bar.json \
32
+ bundle exec bin/pact-broker publish script/foo-bar.json \
33
33
  --consumer-app-version 1.2.26 \
34
34
  --auto-detect-version-properties \
35
35
  --build-url http://mybuild \
@@ -1,4 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
+ require "bundler/inline"
3
+
4
+ gemfile do
5
+ source "https://rubygems.org"
6
+ gem "pact_broker-client", path: "."
7
+ end
8
+
2
9
  require "stringio"
3
10
  require "pact_broker/client/cli/broker"
4
11
  require "pactflow/client/cli/pactflow"
@@ -0,0 +1,19 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDATCCAemgAwIBAgIUWfQF2Mh+eFd3q+cSVgekpaMTh9MwDQYJKoZIhvcNAQEL
3
+ BQAwDzENMAsGA1UEAwwETXlDQTAgFw0yMzA5MTkxMTA2MjZaGA8yMTIzMDgyNjEx
4
+ MDYyNlowDzENMAsGA1UEAwwETXlDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
5
+ AQoCggEBAK9Qha2OdeFrSCUqiYRUBngNLn8PRGDaKPWmjd+3WOWJNM1RNgFfGpKY
6
+ nxYJp4J6eW7aeQ6o94Q+QOZp+Yxm6thrtvjRbcEafAore4EwC4tjXvoFoy+mKwzm
7
+ njlJw+ha3TsMAqD3GGDLF7uDnmliURRo8TOmJ++Mwss9Uhb5p9LArjWXa3sV8da+
8
+ gsxP2aTgBZfznUhNKDGUfezYa5UEbHQ869rA1PAqL3tOC2M5LTX08C2PlzzLOF5S
9
+ gBzicV1PPDkmkbxKmFV+D8LmkwWNsRhrzZ6TIxYoXIRhziS7JuYOGU7G0+6ZKpIP
10
+ mo7WXSoSrd7GL5PQJzlHKCsTckd4so0CAwEAAaNTMFEwHQYDVR0OBBYEFCeovNXs
11
+ r1mcbprFaLyll+LrBJmQMB8GA1UdIwQYMBaAFCeovNXsr1mcbprFaLyll+LrBJmQ
12
+ MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHOsbZ0iDiKiRU8Q
13
+ hIAav056dboPjTK19Q736DUD6oCbTbvecfxMv/wu9LmYGW5jt/DWP6s+jDYhcPpj
14
+ c3U03pPKCnvsG5z60ZgmN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eTcOKGhECQHQKBgAlM
22
+ A29J+BuBZMzK87CJIjbeRaVrmvSjXdeMzd+o+01ratn9bjwO14SRTfvhlbRzLLLO
23
+ y78YmutZbuZuWY5p5pUjJ9uv2o/INr3vnV0NqM4yVx8Vr/YoOnCkHGAKf4iVs8bw
24
+ E/b/8RHmOOvgSjjbvIKY8E1jMH8Az2e0CfqYyOBdAoGAOlhTefyBGgAWFHqH/l4p
25
+ ThbWupIMsw1ZXlArwBnTfsUFuz0Yq7B+0tqrV8lhS3P4/0jI2yWnzhluDk62clwz
26
+ Xg187V85Ylagshsjv60mP5qBEF4N7Nf5fP2w6+GjMU+YiHEBsgGGt+2jPgKeCGQW
27
+ IlV3ym59oL+wGyN9OK3z+aw=
28
+ -----END PRIVATE KEY-----
@@ -0,0 +1,39 @@
1
+ require "open3"
2
+ require "pact_broker/client/cli/broker"
3
+
4
+ # This is not the ideal way to write a test, but I tried to write it with an in memory invocation,
5
+ # and I couldn't get the capture to work, and it became super complicated.
6
+
7
+ RSpec.describe "using unknown options", skip_windows: true do
8
+ let(:unknown_switches_text) { "Unknown switches" }
9
+ let(:warning_text) { "This is a warning"}
10
+ let(:command) { "bundle exec bin/pact-broker can-i-deploy --pacticipant Foo --foo --broker-base-url http://example.org" }
11
+
12
+ it "prints an 'unknown switches' warning to stderr and also includes the normal output of the command" do
13
+ stderr_lines = nil
14
+
15
+ Open3.popen3(command) do |stdin, stdout, stderr, thread|
16
+ stderr_lines = stderr.readlines
17
+ end
18
+
19
+ expect(stderr_lines.join("\n")).to include(unknown_switches_text)
20
+ expect(stderr_lines.join("\n")).to include(warning_text)
21
+
22
+ expect(stderr_lines.size).to be > 2
23
+ end
24
+
25
+
26
+ context "with PACT_BROKER_ERROR_ON_UNKNOWN_OPTION=true" do
27
+ it "prints an 'unknown switches' message to stderr and does NOT include the normal output of the command as it exits straight after" do
28
+ stderr_lines = nil
29
+
30
+ Open3.popen3({ "PACT_BROKER_ERROR_ON_UNKNOWN_OPTION" => "true" }, command) do |stdin, stdout, stderr, thread|
31
+ stderr_lines = stderr.readlines
32
+ end
33
+
34
+ expect(stderr_lines.first).to include(unknown_switches_text)
35
+ expect(stderr_lines.join("\n")).to_not include(warning_text)
36
+ expect(stderr_lines.size).to eq 1
37
+ end
38
+ end
39
+ end
@@ -7,6 +7,10 @@ module PactBroker::Client::CLI
7
7
  end
8
8
 
9
9
  class TestThor < CustomThor
10
+ def self.exit_on_failure?
11
+ false
12
+ end
13
+
10
14
  desc 'ARGUMENT', 'This is the description'
11
15
  def test_default(argument)
12
16
  Delegate.call(argument: argument)
@@ -96,6 +100,29 @@ module PactBroker::Client::CLI
96
100
  TestThor.start(%w{test_pact_broker_client_options})
97
101
  end
98
102
 
103
+ describe "when someone copy pastes from Word and uses an em dash instead of a normal dash" do
104
+ before do
105
+ allow(TestThor).to receive(:exit_with_error_code)
106
+ end
107
+
108
+ it "exits with an error message" do
109
+ expect($stdout).to receive(:puts).with(/contains an em dash/)
110
+ expect(TestThor).to receive(:exit_with_error_code)
111
+ TestThor.start(["test_default", "\u2014\u2014bar"])
112
+ end
113
+ end
114
+
115
+ describe ".handle_help" do
116
+ context "when the last argument is --help or -h" do
117
+ it "turns it into the form that Thor expects, which is a really odd one" do
118
+ expect(TestThor.handle_help(["foo", "--help"])).to eq ["help", "foo"]
119
+ expect(TestThor.handle_help(["foo", "-h"])).to eq ["help", "foo"]
120
+ expect(TestThor.handle_help(["-h"])).to eq ["help"]
121
+ expect(TestThor.handle_help(["--help"])).to eq ["help"]
122
+ end
123
+ end
124
+ end
125
+
99
126
  describe ".turn_muliple_tag_options_into_array" do
100
127
  it "turns '--tag foo --tag bar' into '--tag foo bar'" do
101
128
  input = %w{--ignore this --tag foo --tag bar --wiffle --that}
@@ -1,4 +1,6 @@
1
1
  require 'pact_broker/client/hal/http_client'
2
+ require "faraday"
3
+ require "faraday/retry"
2
4
 
3
5
  module PactBroker::Client
4
6
  module Hal
@@ -157,6 +159,80 @@ module PactBroker::Client
157
159
  end
158
160
  end
159
161
  end
162
+
163
+ describe "x509 certificate" do
164
+ FAKE_SERVER_URL = 'https://localhost:4444'
165
+ X509_CERT_FILE_PATH = './spec/fixtures/certificates/client_cert.pem'
166
+ X509_KEY_FILE_PATH = './spec/fixtures/certificates/key.pem'
167
+ UNSIGNED_X509_CERT_FILE_PATH = './spec/fixtures/certificates/unsigned_cert.pem'
168
+ UNSIGNED_X509_KEY_FILE_PATH = './spec/fixtures/certificates/unsigned_key.pem'
169
+
170
+ def wait_for_server_to_start
171
+ Faraday.new(
172
+ url: FAKE_SERVER_URL,
173
+ ssl: {
174
+ verify: false,
175
+ client_cert: OpenSSL::X509::Certificate.new(File.read(X509_CERT_FILE_PATH)),
176
+ client_key: OpenSSL::PKey::RSA.new(File.read(X509_KEY_FILE_PATH))
177
+ }
178
+ ) do |builder|
179
+ builder.request :retry, max: 20, interval: 0.5, exceptions: [StandardError]
180
+ builder.adapter :net_http
181
+ end.get
182
+ end
183
+
184
+ let(:do_get) { subject.get(FAKE_SERVER_URL) }
185
+
186
+ before(:all) do
187
+ @pipe = IO.popen("bundle exec ruby ./spec/support/ssl_server.rb")
188
+ ENV['SSL_CERT_FILE'] = "./spec/fixtures/certificates/ca_cert.pem"
189
+
190
+ wait_for_server_to_start()
191
+ end
192
+
193
+ context "with valid x509 client certificates" do
194
+ before do
195
+ ENV['X509_CLIENT_CERT_FILE'] = X509_CERT_FILE_PATH
196
+ ENV['X509_CLIENT_KEY_FILE'] = X509_KEY_FILE_PATH
197
+ end
198
+
199
+ it "succeeds" do
200
+ expect(do_get.status).to eq 200
201
+ end
202
+ end
203
+
204
+ context "when invalid x509 certificates are set" do
205
+ before do
206
+ ENV['X509_CLIENT_CERT_FILE'] = UNSIGNED_X509_CERT_FILE_PATH
207
+ ENV['X509_CLIENT_KEY_FILE'] = UNSIGNED_X509_KEY_FILE_PATH
208
+ end
209
+
210
+ it "fails raising SSL error" do
211
+ expect { do_get }
212
+ .to raise_error { |error|
213
+ expect([OpenSSL::SSL::SSLError, Errno::ECONNRESET]).to include(error.class)
214
+ }
215
+ end
216
+ end
217
+
218
+ context "when no x509 certificates are set" do
219
+ before do
220
+ ENV['X509_CLIENT_CERT_FILE'] = nil
221
+ ENV['X509_CLIENT_KEY_FILE'] = nil
222
+ end
223
+
224
+ it "fails raising SSL error" do
225
+ expect { do_get }
226
+ .to raise_error { |error|
227
+ expect([OpenSSL::SSL::SSLError, Errno::ECONNRESET]).to include(error.class)
228
+ }
229
+ end
230
+ end
231
+
232
+ after(:all) do
233
+ Process.kill "KILL", @pipe.pid
234
+ end
235
+ end
160
236
  end
161
237
  end
162
238
  end
@@ -1602,8 +1602,7 @@
1602
1602
  "name": "Foo"
1603
1603
  },
1604
1604
  "version": {
1605
- "number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1606
- "buildUrl": "http://build"
1605
+ "number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30"
1607
1606
  }
1608
1607
  },
1609
1608
  "logs": [
@@ -88,8 +88,7 @@ RSpec.describe "publishing contracts", pact: true do
88
88
  name: pacticipant_name
89
89
  },
90
90
  version: {
91
- number: version_number,
92
- buildUrl: build_url
91
+ number: version_number
93
92
  }
94
93
  },
95
94
  logs: Pact.each_like(level: "info", message: "some message"),
@@ -0,0 +1,42 @@
1
+ if __FILE__ == $0
2
+
3
+ SSL_KEY = "spec/fixtures/certificates/key.pem"
4
+ SSL_CERT = "spec/fixtures/certificates/client_cert.pem"
5
+ SSL_CA_CERT = "spec/fixtures/certificates/ca_cert.pem"
6
+
7
+ trap(:INT) do
8
+ @server.shutdown
9
+ exit
10
+ end
11
+
12
+ def webrick_opts port
13
+ certificate = OpenSSL::X509::Certificate.new(File.read(SSL_CERT))
14
+ cert_name = certificate.subject.to_a.collect{|a| a[0..1] }
15
+ logger_stream = ENV["DEBUG"] ? $stderr : StringIO.new
16
+ {
17
+ Port: port,
18
+ Host: "0.0.0.0",
19
+ AccessLog: [],
20
+ Logger: WEBrick::Log.new(logger_stream,WEBrick::Log::INFO),
21
+ SSLVerifyClient: OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT | OpenSSL::SSL::VERIFY_PEER,
22
+ SSLCACertificateFile: SSL_CA_CERT,
23
+ SSLCertificate: certificate,
24
+ SSLPrivateKey: OpenSSL::PKey::RSA.new(File.read(SSL_KEY)),
25
+ SSLEnable: true,
26
+ SSLCertName: cert_name,
27
+ }
28
+ end
29
+
30
+ app = ->(_env) { puts "hello"; [200, {}, ["Hello world" + "\n"]] }
31
+
32
+ require "webrick"
33
+ require "webrick/https"
34
+ require "rack"
35
+ require "rack/handler/webrick"
36
+
37
+ opts = webrick_opts(4444)
38
+
39
+ Rack::Handler::WEBrick.run(app, **opts) do |server|
40
+ @server = server
41
+ end
42
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.72.0
4
+ version: 1.73.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beth Skurrie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-11 00:00:00.000000000 Z
11
+ date: 2023-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -126,6 +126,7 @@ files:
126
126
  - ".rspec"
127
127
  - ".ruby-version"
128
128
  - CHANGELOG.md
129
+ - DEVELOPING.md
129
130
  - Dockerfile
130
131
  - Gemfile
131
132
  - LICENSE.txt
@@ -165,6 +166,7 @@ files:
165
166
  - lib/pact_broker/client/cli/pact_commands.rb
166
167
  - lib/pact_broker/client/cli/pacticipant_commands.rb
167
168
  - lib/pact_broker/client/cli/record_deployment_long_desc.txt
169
+ - lib/pact_broker/client/cli/thor_unknown_options_monkey_patch.rb
168
170
  - lib/pact_broker/client/cli/version_commands.rb
169
171
  - lib/pact_broker/client/cli/version_selector_options_parser.rb
170
172
  - lib/pact_broker/client/cli/webhook_commands.rb
@@ -260,12 +262,21 @@ files:
260
262
  - spec/fixtures/approvals/describe_pacticipant.approved.txt
261
263
  - spec/fixtures/approvals/list_environments.approved.txt
262
264
  - spec/fixtures/approvals/publish_provider_contract.approved.txt
265
+ - spec/fixtures/certificates/ca_cert.pem
266
+ - spec/fixtures/certificates/ca_cert.srl
267
+ - spec/fixtures/certificates/ca_key.pem
268
+ - spec/fixtures/certificates/client_cert.pem
269
+ - spec/fixtures/certificates/key.pem
270
+ - spec/fixtures/certificates/server.csr
271
+ - spec/fixtures/certificates/unsigned_cert.pem
272
+ - spec/fixtures/certificates/unsigned_key.pem
263
273
  - spec/fixtures/foo-bar.json
264
274
  - spec/integration/can_i_deploy_spec.rb
265
275
  - spec/integration/can_i_merge_spec.rb
266
276
  - spec/integration/create_version_tag_spec.rb
267
277
  - spec/integration/describe_environment_spec.rb
268
278
  - spec/integration/publish_provider_contract_spec.rb
279
+ - spec/integration/unknown_options_spec.rb
269
280
  - spec/lib/pact_broker/client/base_client_spec.rb
270
281
  - spec/lib/pact_broker/client/can_i_deploy_spec.rb
271
282
  - spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
@@ -342,6 +353,7 @@ files:
342
353
  - spec/support/pacticipants_list.json
343
354
  - spec/support/pacts_latest_list.json
344
355
  - spec/support/shared_context.rb
356
+ - spec/support/ssl_server.rb
345
357
  - tasks/pact.rake
346
358
  homepage: https://github.com/pact-foundation/pact_broker-client.git
347
359
  licenses:
@@ -362,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
374
  - !ruby/object:Gem::Version
363
375
  version: '0'
364
376
  requirements: []
365
- rubygems_version: 3.4.19
377
+ rubygems_version: 3.4.20
366
378
  signing_key:
367
379
  specification_version: 4
368
380
  summary: See description
@@ -374,12 +386,21 @@ test_files:
374
386
  - spec/fixtures/approvals/describe_pacticipant.approved.txt
375
387
  - spec/fixtures/approvals/list_environments.approved.txt
376
388
  - spec/fixtures/approvals/publish_provider_contract.approved.txt
389
+ - spec/fixtures/certificates/ca_cert.pem
390
+ - spec/fixtures/certificates/ca_cert.srl
391
+ - spec/fixtures/certificates/ca_key.pem
392
+ - spec/fixtures/certificates/client_cert.pem
393
+ - spec/fixtures/certificates/key.pem
394
+ - spec/fixtures/certificates/server.csr
395
+ - spec/fixtures/certificates/unsigned_cert.pem
396
+ - spec/fixtures/certificates/unsigned_key.pem
377
397
  - spec/fixtures/foo-bar.json
378
398
  - spec/integration/can_i_deploy_spec.rb
379
399
  - spec/integration/can_i_merge_spec.rb
380
400
  - spec/integration/create_version_tag_spec.rb
381
401
  - spec/integration/describe_environment_spec.rb
382
402
  - spec/integration/publish_provider_contract_spec.rb
403
+ - spec/integration/unknown_options_spec.rb
383
404
  - spec/lib/pact_broker/client/base_client_spec.rb
384
405
  - spec/lib/pact_broker/client/can_i_deploy_spec.rb
385
406
  - spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
@@ -456,3 +477,4 @@ test_files:
456
477
  - spec/support/pacticipants_list.json
457
478
  - spec/support/pacts_latest_list.json
458
479
  - spec/support/shared_context.rb
480
+ - spec/support/ssl_server.rb