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.
Easily build timelines, much like GitHub's news feed. But, on Mongoid tho. This project is a port of TimelineFu on Mongoid.
MongoidTimelineFu requires you to have a TimelineEvent model. The simplest way is to use the generator.
$ rails generate mongoid_timeline_fu
create app/models/timeline_event.rb
Next step is to determine what generates an event in your various models.
class Post
#...
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 Mongoid events. In the previous example, it's an after_create on Posts.
You can supply a few parameters to fires, two of them are mandatory. The first param is a custom name for the event type. It'll be your way of figuring out what events your reading back from the timeline_events table later. new_post
in the example above.
The rest all fit neatly in an options hash.
Here's another example:
class Comment
#...
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
The Mongoid event hook will automatically instantiate a TimelineEvent instance for you. It will receive the following parameters in #create!
The generated model stores most of its info as polymorphic relationships.
class TimelineEvent
include Mongoid::Document
field :event_type, :type => String
belongs_to :actor, :polymorphic => true
belongs_to :subject, :polymorphic => true
belongs_to :secondary_subject, :polymorphic => true
end
To get your timeline you'll probably have to create your own finder or scopes (if your situation is extremely simple).
MongoidTimelineFu 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 :-)
# Gemfile
gem "mongoid_timeline_fu"
Copyright (c) 2011 Teng Siong Ong, released under the MIT license
FAQs
Unknown package
We found that mongoid_timeline_fu 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.