Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
-note, this version is not backwards compatiable
Decorate all your favorite methods with ActiveSupport::Notifications.instrument
This gem allows you to wrap methods on your classes for use with AS::N without having to put AS::N.instrument do blocks around everything. You can customize the payload sent with the event, and in addition all of the method args(if any) are sent as well
Add this line to your application's Gemfile:
gem "instrumentable", "~> 1.1.0"
And then execute:
$ bundle
Or install it yourself as:
$ gem install instrumentable
include the gem in your class
include Instrumentable
to instrument an instance method
instrument_method :method_name, 'event.to.fire', :payload_key => :payload_value
:method_name
Is the name of the method you want to instrument
'event.to.fire'
Is the name of the event you'll setup your subscriber for This can be any string
:payload_key => :payload_value
The last part is the payload, which consists of a key and a value. What is sent to the subscriber depends on what is passed in as the value
'static_string'
:method_name
Proc.new { Time.now }
All payloads will recieve a list of the arguments called with the method under
:_method_args
, this will be an empty array if the method was called with no args
If you want to instrument a class method, you must use a separate method
class_instrument_method self, :method_name, 'event.to.fire', :payload_key => :payload_value
You must use class_instrument_method
instead and pass the first argument in as self
require "instrumentable"
class WidgetRenderer
include Instrumentable
attr_reader :id, :name
def render
# do crazy render here
end
def load(options)
# make call here
end
def self.add(location)
# ...
end
private
def valid?
# returns if call is valid
end
instrument_method :render, 'render.widget', :widget_id => :id, :widget_name => :name
instrument_method :load, 'load.widget', :status => 'loading', :valid => :valid?
class_instrument_method :add, 'add.widget'
end
rake test
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that instrumentable 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.