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.
ਮੰਜੂਰੀ (manzoori) : Let's you add an approval process on top of your models/objects. Assume you have an object which is in an approved
state, you want any subsequent changes to this model to go into a review queue and have someone review these changes until they are actually committed to the object.
Add manzoori
to your Gemfile
.
gem 'manzoori'
Generate a migration which will add a pending_approvals
table to your database.
bundle exec rails generate manzoori:install
Run the migration.
bundle exec rake db:migrate
Add requires_approval
to the models you want to track.
When you declare requires_approval
in your model, you get these methods:
class Article < ActiveRecord::Base
requires_approval # you can pass various options here
end
# check if this object requires any approval?
article.pending_approval?
# require approval when changed
article = Article.new(title: 'The Illuminati')
article.save
article.title = 'Title that should go through an approval process'
article.save
article.title
=> 'The Illuminate'
'The Illuminati'
article.pending_approval?
=> true
article.pending_approvals.last.object_changes
=> {"title"=>["The Illuminati", "Title that should go through an approval process"] }
article.pending_approvals.last.approve_changes
article.title
=> "Title that should go through an approval process"
article.pending_approvals.last.reject_changes
article.title
=> "The Illuminati"
article.pending_approvals?
=> false
class Article < ActiveRecord::Base
requires_approval skip_attributes: [:updated_at, :created_at]
end
article.touch
article.pending_approvals?
=> false
class Article < ActiveRecord::Base
requires_approval if: :author_is_reviewer?, skip_attributes: [:updated_at, :created_at]
def author_is_reviewer?
author.role == 'reviewer'
end
end
admin = Author.new(name: 'Jasdeep', role: 'admin')
article = Article.new(title: 'The Illuminati', author: admin)
article.save
article.title = 'Some New Title'
article.save
=> true
article.title
=> 'Some New Title'
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
You get extra attention, if your PR includes specs/tests.
$ git checkout -b my-new-feature
)$ bundle install
in the project directory.$ git commit -am 'Add some feature'
)$ git push origin my-new-feature
)Copyright (c) 2013 Jasdeep Singh (Metaware Labs Inc)
Licensed under the MIT license.
FAQs
Unknown package
We found that manzoori 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.
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.