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.
contentful-webhook-listener
Advanced tools
A Simple HTTP Webserver with pluggable behavior for listening to API Webhooks
Contentful is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.
contentful-webhook-listener
do?The aim of contentful-webhook-listener
is to have developers setting up their Contentful
Webhooks for triggering background jobs.
Add this line to your application's Gemfile:
gem 'contentful-webhook-listener'
And then execute:
$ bundle
Or install it yourself as:
$ gem install contentful-webhook-listener
require 'contentful/webhook/listener'
class MyController < Contentful::Webhook::Listener::Controllers::Base
def perform(request, response)
"do your process..." # This will run on a brackground Thread
end
end
require 'logger'
Contentful::Webhook::Listener::Server.start do |config|
config[:port] = 5678 # Optional
config[:address] = "0.0.0.0" # Optional
config[:logger] = Logger.new(STDOUT) # Optional, will use a NullLogger by default
config[:endpoints] = [
{
endpoint: "/receive", # Where your server will listen
controller: MyController, # The controller that will process the endpoint
timeout: 15 # If using Wait, will wait `X` seconds before executing
}
]
end
You can add multiple endpoints, each with it's own Controller.
You can create controllers that can respond on specific Webhook events.
class MyController < Contentful::Webhook::Listener::Controllers::WebhookAware
def publish
# Do stuff on publish
if webhook.entry?
logger.info "published Entry ID: #{webhook.id} for Space: #{webhook.space_id}"
end
end
def unpublish
# Do stuff on unpublish
end
def archive
# Do stuff on archive
end
def unarchive
# Do stuff on unarchive
end
def create
# Do stuff on create
end
def save
# Do stuff on save
end
def delete
# Do stuff on delete
end
end
The controller has a webhook
object bound when invoked, that has a few helpers:
webhook.entry?
will return if the webhook was fired for an Entry
webhook.asset?
will return if the webhook was fired for an Asset
webhook.content_type?
will return if the webhook was fired for a Content Type
webhook.id
will return the Resource (Entry/Asset/Content Type) ID
webhook.space_id
will return the Space ID
webhook.sys
will include the metadata for the resource
webhook.fields
will include the resource fields (not included on Unpublish)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that contentful-webhook-listener 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.