
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Route Guide is a gem that helps you to find the route to your destination.
Install the gem and add to the application's Gemfile by executing:
$ bundle add route_guide
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install route_guide
You need to implement a server and a client. Then you can use this gem to connect between
the two. Check the examples
folder for a working example.
Gemfile
below then run bundle
install:# frozen_string_literal: true
source "https://rubygems.org"
gem "grpc"
gem "route_guide"
server.rb
:#!/usr/bin/env ruby
require 'grpc'
require 'route_guide'
class DirectionsService < RouteGuide::DirectionsService::Service
def direct_it(direction_req, _unused_call)
puts "Received direction request for #{direction_req}"
# build response from object
RouteGuide::DirectionsResponse.new(
directions: 'response',
approximate_time_of_travel_in_hrs: 4,
approximate_distance_in_kms: 30
)
end
end
class RouteGuideServer
class << self
def start
start_grpc_server
end
private
def start_grpc_server
# create server
@server = GRPC::RpcServer.new
@server.add_http2_port("0.0.0.0:50052", :this_port_is_insecure)
# assign server to a grpc handler
@server.handle(DirectionsService)
@server.run_till_terminated
end
end
end
RouteGuideServer.start
ruby server.rb
#!/usr/bin/env ruby
require 'grpc'
require 'route_guide'
def test_single_call
# 1. connect to server service
stub = RouteGuide::DirectionsService::Stub.new('0.0.0.0:50052', :this_channel_is_insecure)
# 2. build request object
req = RouteGuide::DirectionsRequest.new(
current_location: 'current_location',
target_location: 'travel_location',
means_of_travel: 'means_of_travel'
)
# 3. call the remote method with request object as parameter
resp_obj = stub.direct_it(req)
puts "Response: #{resp_obj}"
end
test_single_call
ruby client.rb
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
https://medium.com/@shiladitya16/building-micro-services-using-grpc-on-ruby-41acb755ee06
Bug reports and pull requests are welcome on GitHub at https://github.com/Sylvance/route_guide.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that route_guide demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.