
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
= blogrpc
BlogRPC is a set of XML RPC server facilities which allow you to easily create a blogging XML-RPC backend in your Ruby web application. Your application can then be used with blog clients like BlogJet and MarsEdit.
== Quickly defining a blog RPC handler
Define your blog handler right in the rackup file:
rpc_endpoint = BlogRPC.generate_endpoint do | handler |
handler.rpc "mt.publishPost", :in => [:int, :string, :string], :out => :bool do | postid, user, pw |
login!(user, pw)
get_entry(postid).update_attributes :draft => false
true
end
end
run rpc_endpoint
or as a separate class:
class MyHandler < BlogRPC::BasicHandler
rpc "mt.publishPost", :in => [:int, :string, :string], :out => :bool do | postid, user, pw |
login!(user, pw)
get_entry(postid).update_attributes :draft => false
true
end
end
rpc_endpoint = BlogRPC::RackApp.new(MyHandler.new)
run rpc_endpoint
== More involved examples
The gem consists of two parts. The first part is a Rack application that will handle XML-RPC requests and respond to them. It's primary role is an adapter between the old Ruby's XML-RPC library that ships with Ruby and the more modern Rack infrastructure.
It handles things like wrapping exceptions properly, detecting the needed parameters and configuring all of the IO so that Ruby's XML-RPC facilities can get at it. You use it like this:
rpc_endpoint = BlogRPC::RackApp.new(MyBlogHandler.new)
rpc_endpoint.blog_url = "http://site.com"
rpc_endpoint.rpc_endpoint_url = "/secret-rpc-url.xml"
rpc_endpoint.call(env)
The BlogHandler object should be a more or less complete subclass of BlogHandler that you provide. When the RPC application receives a GET request it will respond with the RSD fragment that will auto-configure your blogging client (like MarsEdit or BlogJet).
The second part of the solution is a blog handler. The handler is responsible for saving and loading entries and images, creating pages and categories and so on. Unfortunately, you have to write this handler yourself since no two blogging systems are alike. However, we provide a SampleHandler to get you started.
IMPORTANT: It is absolutely imperative that you review the sample handler very thoroughly and rewrite and double-check it ad nauseam. We do not recommend that you inherit from the SampleHandler. Instead, make your own copy and define your methods there, and inherit your handler class from BlogRPC::BasicHandler
== Contributing to blogrpc
== Copyright
Copyright (c) 2012 Julik Tarkhanov. See LICENSE.txt for further details.
FAQs
Unknown package
We found that blogrpc 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.