Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
= rufus-decision
== getting it
gem install rufus-decision
== blog posts
http://jmettraux.wordpress.com/2009/04/25/rufus-decision-11-ruby-decision-tables/
http://jmettraux.wordpress.com/2010/02/17/ruote-and-decision-tables/
== usage
More info at http://rufus.rubyforge.org/rufus-decision/Rufus/Decision/Table.html but here is a recap.
An example where a few rules determine which salesperson should interact with a customer with given characteristics.
require 'rubygems' require 'rufus/decision'
TABLE = Rufus::Decision::Table.new(%{ in:age,in:trait,out:salesperson
18..35,,adeslky
25..35,,bronco
36..50,,espadas
51..78,,thorsten
44..120,,ojiisan
25..35,rich,kerfelden
,cheerful,swanson
,maniac,korolev
})
def determine_salesperson (customer)
TABLE.transform(customer)["salesperson"]
end
puts determine_salesperson( "age" => 72) # => thorsten
puts determine_salesperson( "age" => 25, "trait" => "rich") # => adeslky
puts determine_salesperson( "age" => 23, "trait" => "cheerful") # => adeslky
puts determine_salesperson( "age" => 25, "trait" => "maniac") # => adeslky
puts determine_salesperson( "age" => 44, "trait" => "maniac") # => espadas
More at Rufus::Decision::Table
Note that you can use a CSV table served over HTTP like in :
require 'rubygems' require 'rufus/decision'
TABLE = Rufus::DecisionTable.new( 'http://spreadsheets.google.com/pub?key=pCkopoeZwCNsMWOVeDjR1TQ&output=csv')
def take_umbrella? (weather, month=nil) h = TABLE.transform('weather' => weather, 'month' => month) h['take_umbrella?'] == 'yes' end
puts take_umbrella?('cloudy', 'june') # => true
puts take_umbrella?('sunny', 'june') # => false
In this example, the CSV table is the direction CSV representation of the Google spreadsheet at : http://spreadsheets.google.com/pub?key=pCkopoeZwCNsMWOVeDjR1TQ
WARNING though : use at your own risk. CSV loaded from untrusted locations may contain harmful code. The rufus-decision gem has an abstract tree checker integrated, it will check all the CSVs that contain calls in Ruby and raise a security error when possibly harmful code is spotted. Bullet vs Armor. Be warned.
== web demo
There is a small demo of an input table + a decision table. You can run it by doing :
gem install sinatra git clone git://github.com/jmettraux/rufus-decision.git cd rufus-decision ruby demo/start.rb
and then point your browser to http://localost:4567/
== uninstalling it
gem uninstall rufus-decision
== dependencies
The gem 'rufus-dollar' (http://rufus.rubyforge.org/rufus-dollar) and the 'rufus-treechecker' gem (http://rufus.rubyforge.org/rufus-treechecker).
== mailing list
On the rufus-ruby list :
http://groups.google.com/group/rufus-ruby
== irc
irc.freenode.net #ruote
== issue tracker
http://github.com/jmettraux/rufus-decision/issues
== source
http://github.com/jmettraux/rufus-decision
git clone git://github.com/jmettraux/rufus-decision.git
== author
John Mettraux, jmettraux@gmail.com http://jmettraux.wordpress.com
== the rest of Rufus
== license
MIT
FAQs
Unknown package
We found that rufus-decision 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.