puffing-billy 2.3.1 → 2.4.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +16 -3
- data/lib/billy/config.rb +2 -1
- data/lib/billy/handlers/proxy_handler.rb +4 -0
- data/lib/billy/ssl/certificate_helpers.rb +1 -1
- data/lib/billy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98ce893c9461f4f8c8eedd69eee46870634f789dd03a2007370bb7b03361bc26
|
4
|
+
data.tar.gz: 35f7939ff8eb3cbccd4bf4e91ccefbddd1b4b999fddfbc86ec0ff82885ae0dad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73d5bc111493abd8a2bf9157f9bc3b717f0d4bc2a9276a757280d6e6ad7b3e5a1acd90a30234e00bdd9245380f6d9c00aa9bb86c3ec6bd7eed46643af1b85451
|
7
|
+
data.tar.gz: a32ac78dec161016266bf1ac2d2cdedcb68247c03cea681f096dc1dd4eb73dd4d166f27173a9f8b0040df39fd168d97010960a074b8b23c49183bee6a737bd50
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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](
|
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
|
data/lib/billy/config.rb
CHANGED
@@ -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
|
data/lib/billy/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|