Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
demingfactor-paper_trail_manager
Advanced tools
Browse, subscribe, view and revert changes to records when using Ruby on Rails 3 and the paper_trail
gem.
This software has been in use for a year at http://calagator.org and http://epdx.org. It works well. It has reasonable tests. However, it could definitely use more work.
If you have a Ruby on Rails 3 or 4 application where you're using the paper_trail
gem to track changes to your records, you can make use of this like:
Add the following line to your Gemfile
:
gem 'demingfactor-paper_trail_manager'
PaperTrailManager will use your existing paging library (will_paginate or Kaminari). If you don't currently use one in your app, add one of the following lines to your Gemfile
:
gem 'kaminari'
#or
gem 'will_paginate'
Install the libary:
bundle install
Add the following line to your config/routes.rb
:
resources :changes, :controller => 'paper_trail_manager/changes'
Restart the server and go to the /changes
URI to browse, subscribe, view and revert your changes. The top-level URL will look something like this:
http://localhost:3000/changes
Several aspects of PaperTrailManager may be optionally configured
by creating an initializer in your application
(e.g. config/initializers/paper_trail_manager.rb
).
To specify when reverts are allowed:
PaperTrailManager.allow_revert_when do |controller, version|
controller.current_user and controller.current_user.admin?
end
To specify how to look up users/memebers/etc specified in Paper Trail's 'whodunnit' column:
PaperTrailManager.whodunnit_class = User
PaperTrailManager.whodunnit_name_method = :nicename # defaults to :name
To specify a method to call to identify an item on an index page:
PaperTrailManager.item_name_method = :nicename
And for linking (or not) to the user with a custom path helper:
PaperTrailManager.user_path_method = :admin_path # defaults to :user_path
PaperTrailManager.user_path_method = nil # no "show user" page in app
When including PaperTrailManager within another Rails engine, you may need to override PaperTrailManager::ChangesController's parent class to reference the engine's ApplicationController configure it to use your engine's url helpers:
PaperTrailManager.base_controller = "MyEngine::ApplicationController"
PaperTrailManager.route_helpers = MyEngine::Engine.routes.url_helpers
You can also specify the layout:
PaperTrailManager.layout = 'my_engine/application'
Setup:
bundle
to install the development dependenciesRunning tests:
appraisal rake
to run the tests against all supported gem combinations. Note that the first time tests are run, gems will need to be downloaded for each individual version of Rails this app is tested against, which may take a while.Adding support for new Rails versions:
appraise "rails-5.0-will-paginate" do
gem "rails", "5.0.0"
gem "will_paginate", "~> 3.0"
end
appraise "rails-5.0-will-kaminari" do
gem "rails", "5.0.0"
gem "kaminari", "~> 0.16"
end
appraisal generate
appraisal install
This program is provided under an MIT open source license, read the LICENSE.txt file for details.
This project was originally devloped by Igal Koshevoy. Unfortunately @igal passed away on April 9th, 2013 and I took over the project afterwords.
FAQs
Unknown package
We found that demingfactor-paper_trail_manager demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.