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.
Ruby language implementation of Informed, an event-logging library that helps you understand what's happening in your application.
Add this line to your application's Gemfile:
gem 'informed', '~> 1.0'
And then execute:
$ bundle
Or install it yourself as:
$ gem install informed
class FancyService
attr_accessor :fanciness
include Informed
def initialize(fanciness:)
self.fanciness = fanciness
end
def do_something(force: false)
if fancy? || force
do_it_fancy
else
do_it_plain
end
end
inform_on :do_something, level: :info,
also_log: { result: true, values: [:fancy?, :force, :fanciness]}
def fancy?
fanciness > 10
end
def do_it_plain
"so plain"
end
def do_it_fancy
"so fancy"
end
end
FancyService.new(fanciness: 12).do_something
# I, [2017-07-05T18:27:13.431695 #3297] INFO -- : {:method=>:do_something, :class=>"FancyService", :values=>{:fancy?=>true, :fanciness=>12}, :status=>:starting}
# I, [2017-07-05T18:27:13.431780 #3297] INFO -- : {:method=>:do_something, :class=>"FancyService", :values=>{:fancy?=>true, :fanciness=>12}, :status=>:done, :result=>"so fancy"}
# => "so fancy"
FancyService.new(fanciness: 12).do_something(force: true)
# I, [2017-07-05T18:27:57.612778 #3297] INFO -- : {:method=>:do_something, :class=>"FancyService", :values=>{:fancy?=>true, :force=>true, :fanciness=>12}, :status=>:starting}
# I, [2017-07-05T18:27:57.612853 #3297] INFO -- : {:method=>:do_something, :class=>"FancyService", :values=>{:fancy?=>true, :force=>true, :fanciness=>12}, :status=>:done, :result=>"so fancy"}
# => "so fancy"
FancyService.new(fanciness: 8).do_something(force: true)
# I, [2017-07-05T18:28:35.282196 #3297] INFO -- : {:method=>:do_something, :class=>"FancyService", :values=>{:fancy?=>false, :force=>true, :fanciness=>8}, :status=>:starting}
# I, [2017-07-05T18:28:35.282272 #3297] INFO -- : {:method=>:do_something, :class=>"FancyService", :values=>{:fancy?=>false, :force=>true, :fanciness=>8}, :status=>:done, :result=>"so fancy"}
# => "so fancy"
FancyService.new(fanciness: 8).do_something(force: false)
# I, [2017-07-05T18:29:13.319488 #3297] INFO -- : {:method=>:do_something, :class=>"FancyService", :values=>{:fancy?=>false, :force=>false, :fanciness=>8}, :status=>:starting}
# I, [2017-07-05T18:29:13.319560 #3297] INFO -- : {:method=>:do_something, :class=>"FancyService", :values=>{:fancy?=>false, :force=>false, :fanciness=>8}, :status=>:done, :result=>"so plain"}
# => "so plain"
While we default to logging to standard out, Informed is Logger-agnostic. You may provide a logger to informed that is interface compatible with the Logger class in the Ruby standard library.
To do so either:
Informed.logger
to your application logger. (Rails Example:
Informed.logger = Rails.logger
)logger
on the informed upon class and have it
return whatever logger you want.See the informed-ruby CONTRIBUTING.md for details.
FAQs
Unknown package
We found that informed 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.