github / hackerone-client

An unofficial wrapper for the HackerOne API
https://rubygems.org/gems/hackerone-client
MIT License
13 stars 3 forks source link

Updating client.rb to use new Faraday basic auth syntax #2

Closed maclarel closed 8 months ago

maclarel commented 1 year ago

This pull request updates client.rb to use the new syntax for basic authentication as specified by the Faraday docs - https://lostisland.github.io/faraday/#/middleware/included/authentication?id=basic-authentication.

Without this change, we're using a deprecated format which is no longer valid:

/home/runner/work/bounty/bounty/vendor/gems/ruby/3.1.0/gems/hackerone-client-0.21.0/lib/hackerone/client.rb:204:in `block in hackerone_api_connection': undefined method `basic_auth' for #<Faraday::Connection:0x00007f137bd85078 @parallel_manager=nil, @headers={}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @manual_proxy=false, @builder=#<Faraday::RackBuilder:0x00007f137bd84240 @adapter=Faraday::Adapter::NetHttp, @handlers=[]>, @url_prefix=#<URI::HTTPS https://api.hackerone.com/v1>, @proxy=nil> (NoMethodError)

Looks like we don't have CI testing for this, and I'm a bit of a Ruby n00b, but bundle exec rake has all tests passing (vs failures prior to update) so I'm assuming all is well 😅

leila-alderman commented 1 year ago

@rzhade3 Have you updated the rubygem to point to this new repository? Are you also able to release a new version of the gem after this fix is merged?

rzhade3 commented 1 year ago

@leila-alderman Doing some testing, it looks like the CI install is failing at the Ruby 2.4.0 install step, see my testing here vs here. If you look closely at the logs for the 2.4.0 install, it looks like we're running into some seg faults.

We could try to fix the seg fault, but considering that Ruby 2.4.0 was end of life'd 3 years ago, it might be easiest to just remove support for 2.4.0. I'll also note that this PR will probably break Ruby 2.5.0, since that uses the old syntax for Faraday, so we should consider what to do about that version as well.

If we do decide to not support those versions of Ruby, we should document this in the Gemfile.

Have you updated the rubygem to point to this new repository?

That'll update itself automatically when a new version is released. The values for that come from here: https://github.com/github/hackerone-client/blob/07f41e9174e5bce4e3f6d281fe8a4ede8810c841/hackerone-client.gemspec#L15. To release the Gem, we just need to mint a new API token from Rubygems and then publish it.