oesmith / puffing-billy

A rewriting web proxy for testing interactions between your browser and external sites. Works with ruby + rspec.
MIT License
656 stars 170 forks source link

Ignore certificate errors in Chrome #280

Closed sidonath closed 4 years ago

sidonath commented 4 years ago

After upgrading Chrome to version 79, our app's test suite started producing a steady stream of warnings like the following one:

140361933186816:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:s3_pkt.c:1487:SSL alert number 46

Additionally, all actual HTTPS requests fail, which, in turn, fails our tests expecting those requests to be successful.

I'm not sure what exact change in Chrome triggered the warning that wasn't showing before, but the only two ways to remove it are:

Since not using Puffing Billy is not really an option, we can only ask Chrome to ignore all certificate errors. This clears the warnings and makes the tests expecting HTTPS requests to succeed to pass.

Also added a spec that fails on the current master branch without ignoring client certificates:

$ bundle exec rspec spec/lib/billy/browsers/capybara_spec.rb                                                                                                                                            -- INSERT --
I, [2019-12-11T21:11:23.806160 #19316]  INFO -- : puffing-billy: Proxy listening on http://localhost:61104
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 46748
123145571295404:error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown:s3_pkt.c:1498:SSL alert number 46
F

Failures:

  1) Capybara drivers allows HTTPS calls
     Failure/Error: expect(page).to have_link('News Item 1', href: 'http://example.com/news/1')
       expected to find link "News Item 1" with href "http://example.com/news/1" but there were no matches
     # ./spec/lib/billy/browsers/capybara_spec.rb:23:in `block (2 levels) in <top (required)>'

Finished in 3.39 seconds (files took 1.43 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/lib/billy/browsers/capybara_spec.rb:4 # Capybara drivers allows HTTPS calls
ronwsmith commented 4 years ago

Looks good, thanks for the contribution! Will try to get it in soon.

sidonath commented 4 years ago

@ronwsmith thanks!

ronwsmith commented 4 years ago

@sidonath released in v2.3.0

sidonath commented 4 years ago

@ronwsmith awesome, thanks!