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.
Easily add webhooks to your Rails app.
Add this line to your application's Gemfile:
gem 'metova-webhooks'
And then execute:
$ bundle
Or install it yourself as:
$ gem install metova-webhooks
Then install the migrations:
$ rake metova-webhooks:install:migrations
And migrate:
$ rake db:migrate
Webhooks requires a 'User' model and ActiveJob, so make sure you have those things.
In your webhookable model, include Metova::Webhookable
:
class MyModel
include Metova::Webhookable
# the following overrides are optional and can be used to customize your events
# override namespace to provide a namespace for your events (ex: a parent class and id)
def namespace
''
end
# override hook_name to change the base event name
def hook_name
self.class.to_s.underscore
end
# override webhook_event to change how event names are constructed
def webhook_event(event)
[namespace, hook_name, event].reject(&:empty?).join(':')
end
# override webhook_serialize to change how the model is serialized for sending
def webhook_serialize
self.to_json
end
# ...
end
Include Metova::WebhooksBase
in a controller:
class MyWebhooksController < ActionController::Base
include Metova::WebhooksBase
# override create to change the create behavior
def create
# create takes a block, and the webhook will not save if there are any errors, so you can do custom validations
super do |webhook|
webhook.errors.add :user, "is not allowed to make webhooks" if some_condition
end
end
protected
# your controller needs to respond to current_user (for example, if you are using devise)
def current_user
nil
end
end
Add routes to your config/routes.rb
:
resources :webhooks, only: [:index, :create, :destroy]
Bug reports and pull requests are welcome on GitHub at https://github.com/metova/metova-webhooks.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that metova-webhooks 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.