puffing-billy 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88b7f294336c78d57a65c5145d0d8b55a2d1bbdf0c52742b1b57b73a90e8f0dd
4
- data.tar.gz: f7ec6e75042f4260026478db19026f03a3c145579496f97aa76fce3eaa726cd5
3
+ metadata.gz: 98ce893c9461f4f8c8eedd69eee46870634f789dd03a2007370bb7b03361bc26
4
+ data.tar.gz: 35f7939ff8eb3cbccd4bf4e91ccefbddd1b4b999fddfbc86ec0ff82885ae0dad
5
5
  SHA512:
6
- metadata.gz: 3a094a3f80d81392fcd400b64bd70490f2fafc207ec925c23ab00a9c3184890dc113a5423609cf867c96a1416232c651710507526dfb94a4e7d13f7bd800c90e
7
- data.tar.gz: 8a7d6b8a64c48d40200b9f15196bf4a2ef5be6736f9a4bad0780c731d56905e7f4eead8d640161a1cc999a4b339b0e51697f79a06e533af602a35d782ba24a9a
6
+ metadata.gz: 73d5bc111493abd8a2bf9157f9bc3b717f0d4bc2a9276a757280d6e6ad7b3e5a1acd90a30234e00bdd9245380f6d9c00aa9bb86c3ec6bd7eed46643af1b85451
7
+ data.tar.gz: a32ac78dec161016266bf1ac2d2cdedcb68247c03cea681f096dc1dd4eb73dd4d166f27173a9f8b0040df39fd168d97010960a074b8b23c49183bee6a737bd50
@@ -1,3 +1,8 @@
1
+ v2.4.0, 2020-08-26
2
+ -------------------
3
+ * Make verify_peer configurable and default it to false [#294](https://github.com/oesmith/puffing-billy/pull/294)
4
+ * Include pid in names of temporary files [#290](https://github.com/oesmith/puffing-billy/pull/290)
5
+
1
6
  v2.3.1, 2020-03-19
2
7
  -------------------
3
8
  * Update min 'faraday' gem version required [#285](https://github.com/oesmith/puffing-billy/pull/285)
data/README.md CHANGED
@@ -551,7 +551,7 @@ Before('@javascript') do |scenario, block|
551
551
  feature_name = scenario.feature.name.underscore
552
552
  scenario_name = scenario.name.underscore
553
553
  c.cache_path = "features/support/fixtures/req_cache/#{feature_name}/#{scenario_name}/"
554
- Dir.mkdir_p(Billy.config.cache_path) unless File.exist?(Billy.config.cache_path)
554
+ FileUtils.mkdir_p(Billy.config.cache_path) unless File.exist?(Billy.config.cache_path)
555
555
  end
556
556
  end
557
557
  ```
@@ -740,10 +740,23 @@ the system store. So after a run of your the suite only one certificate will be
740
740
  left over. If this is not enough you can handling the cleanup again with a
741
741
  custom on-after hook.
742
742
 
743
+ ### TLS hostname validation
744
+
745
+ em-http-request was modified to emit a warning if being used without the TLS
746
+ ``verify_peer`` option. Puffing Billy defaults to specifying ``verify_peer: false``
747
+ but you can now modify configuration to do peer verification. So if you've
748
+ gone to the trouble of setting up your own certificate authority and self-signed
749
+ certs you can enable it like so:
750
+
751
+ ```ruby
752
+ Billy.configure do |c|
753
+ c.verify_peer = true
754
+ end
755
+ ```
756
+
743
757
  ## Resources
744
758
 
745
- * [Bring Ruby VCR to Javascript testing with Capybara and puffing-billy](http://architects.dzone.com/articles/bring-ruby-vcr-javascript)
746
- * [Integration Testing Stripe.js With Mocked Network Requests](http://dev.contractual.ly/testing-stripe-js-with-mocked-network/)
759
+ * [Bring Ruby VCR to Javascript testing with Capybara and puffing-billy](https://dzone.com/articles/bring-ruby-vcr-javascript)
747
760
  * [Clean-up unused cache files periodically with this config](https://github.com/oesmith/puffing-billy/pull/26#issuecomment-29905030)
748
761
 
749
762
  ## Contributing
@@ -8,7 +8,7 @@ module Billy
8
8
 
9
9
  attr_accessor :logger, :cache, :cache_request_headers, :whitelist, :cache_whitelist, :path_blacklist, :ignore_params, :allow_params,
10
10
  :persist_cache, :ignore_cache_port, :non_successful_cache_disabled, :non_successful_error_level,
11
- :non_whitelisted_requests_disabled, :cache_path, :certs_path, :proxy_host, :proxy_port, :proxied_request_inactivity_timeout,
11
+ :non_whitelisted_requests_disabled, :cache_path, :certs_path, :verify_peer, :proxy_host, :proxy_port, :proxied_request_inactivity_timeout,
12
12
  :proxied_request_connect_timeout, :dynamic_jsonp, :dynamic_jsonp_keys, :dynamic_jsonp_callback_name, :merge_cached_responses_whitelist,
13
13
  :strip_query_params, :proxied_request_host, :proxied_request_port, :cache_request_body_methods, :after_cache_handles_request,
14
14
  :cache_simulates_network_delays, :cache_simulates_network_delay_time, :record_requests, :record_stub_requests, :use_ignore_params, :before_handle_request
@@ -37,6 +37,7 @@ module Billy
37
37
  @non_whitelisted_requests_disabled = false
38
38
  @cache_path = File.join(Dir.tmpdir, 'puffing-billy')
39
39
  @certs_path = File.join(Dir.tmpdir, 'puffing-billy', 'certs')
40
+ @verify_peer = false
40
41
  @proxy_host = 'localhost'
41
42
  @proxy_port = RANDOM_AVAILABLE_PORT
42
43
  @proxied_request_inactivity_timeout = 10 # defaults from https://github.com/igrigorik/em-http-request/wiki/Redirects-and-Timeouts
@@ -16,6 +16,10 @@ module Billy
16
16
  opts = { inactivity_timeout: Billy.config.proxied_request_inactivity_timeout,
17
17
  connect_timeout: Billy.config.proxied_request_connect_timeout }
18
18
 
19
+ if url =~ /^https/
20
+ opts.merge!({tls: {verify_peer: Billy.config.verify_peer}})
21
+ end
22
+
19
23
  if Billy.config.proxied_request_host && !bypass_internal_proxy?(url)
20
24
  opts.merge!({ proxy: { host: Billy.config.proxied_request_host,
21
25
  port: Billy.config.proxied_request_port }} )
@@ -27,7 +27,7 @@ module Billy
27
27
  # and ensure the location is safely created. Pass
28
28
  # back the resulting path.
29
29
  def write_file(name, contents)
30
- path = File.join(Billy.config.certs_path, name)
30
+ path = File.join(Billy.config.certs_path, "#{Process.pid}-#{name}")
31
31
  FileUtils.mkdir_p(File.dirname(path))
32
32
  File.write(path, contents)
33
33
  path
@@ -1,3 +1,3 @@
1
1
  module Billy
2
- VERSION = '2.3.1'
2
+ VERSION = '2.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puffing-billy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olly Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-19 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec