pact-foundation/pact_broker-client

Pact broker client tries to load my whole home directory

konalegi opened this issue · 3 comments

On a recent release, I found that new code has been added
https://github.com/pact-foundation/pact_broker-client/blob/master/lib/pact_broker/client/pacticipants.rb#L1-L4

# New code
Dir.glob(File.join(__FILE__.gsub(".rb", "/**/*.rb"))).sort.each do | path |
  require path
end

That code I guess supposed to load all files in the folder with exact name.
But I'm using rbenv on osx and it has .rbenv in the path

/Users/jkonalegi/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/pact_broker-client-1.43.0/lib/pact_broker/client/pacticipants.rb

so the code above breaks the path completely and tries to load my home folder :(

/Users/jkonalegi//**/*.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/pact_broker-client-1.43.0/lib/pact_broker/client/pacticipants/**/*.rb

which results in a very cryptic error

Errno::EPERM:
  Operation not permitted - /Users/jkonalegi//Library/Application Support/CallHistoryTransactions

Ooh, unexpected! Ok, I'll make that code a bit smarter.

Or dumber! I've put out a release with normal, hardcoded requires.

@bethesque thanks for the quick fix 👍