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.
= Alerts
Easily build timelines, much like GitHub's news feed.
== Usage
Alerts requires you to have a Alert model. The simplest way is to use the generator.
$ script/generate alerts && rake db:migrate exists db/migrate create db/migrate/20090333222034_create_alerts.rb create app/models/alert.rb
Next step is to determine what generates an event in your various models.
class Post < ActiveRecord::Base #... belongs_to :author, :class_name => 'Person' fires :new_post, :on => :create, :actor => :author end
You can add 'fires' statements to as many models as you want on as many models as you want.
They are hooked for you after standard ActiveRecord events. In the previous example, it's an after_create on Posts.
=== Parameters for #fires
You can supply a few parameters to fires, two of them are mandatory.
The rest all fit neatly in an options hash.
Here's another example:
class Comment < ActiveRecord::Base #... belongs_to :commenter, :class_name => 'Person' belongs_to :post fires :new_comment, :on => :create, :actor => :commenter, #implicit :subject => self, :secondary_subject => 'post', :if => lambda { |comment| comment.commenter != comment.post.author } end
=== Alert instantiation
The ActiveRecord event hook will automatically instantiate a Alert instance for you. It will receive the following parameters in #create!
The generated model stores most of its info as polymorphic relationships.
class Alert < ActiveRecord::Base belongs_to :actor, :polymorphic => true belongs_to :subject, :polymorphic => true belongs_to :secondary_subject, :polymorphic => true end
== How you actually get your timeline
To get your timeline you'll probably have to create your own finder SQL or scopes (if your situation is extremely simple).
Alerts is not currently providing anything to generate your timeline because different situations will have wildly different requirements. Like access control issues and actually just what crazy stuff you're cramming in that timeline.
We're not saying it can't be done, just that we haven't done it yet. Contributions are welcome :-)
== Get it
gem "alerts"
== License
Copyright (c) 2008 James Golick, released under the MIT license
FAQs
Unknown package
We found that alerts 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.