Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
contentful-webhook-tunnel
Advanced tools
An HTTP server for listening to Contentful API Webhooks with secure tunnels to localhost.
A simple HTTP server for listening to Contentful API Webhooks with secure tunnels to localhost by ngrok.
This module extends contentful-webhook-listener.js to automatically start up ngrok with a tunnel to the same port and registers a webhook for the ngrok URL with Contentful.
This is very useful for local development and/or servers behind firewalls to create a script with custom callbacks for any or all actions that occur in Contentful.
npm install contentful-webhook-tunnel
Require this module and then create a new server. The createServer
function expects the first argument to be an object with the spaces
key and an array of space IDs to register the webhook with.
Then listen for one or more of Contentful webhook events, create
, save
, autoSave
, archive
, unarchive
, delete
, publish
or unpublish
on the server object and setup a custom callback. See contentful-webhook-listener.js for details on the payload for each event.
Lastly, instruct the server to start listening.
var tunnel = require("contentful-webhook-tunnel");
var server = tunnel.createServer({
"spaces": [ "cfexampleapi" ]
});
server.on("publish", function (payload) {
console.log("Received webhook for Publish event in Contentful");
// see payload for details
console.log(payload);
});
server.listen();
To register the webhooks via the Contentful Content Management API requires an access token. Vist the Contentful Developer Center to acquire an access token for a local script. Then, save that token to an environment variable named CONTENTFUL_MANAGEMENT_ACCESS_TOKEN
.
Ngrok defaults to using tunnel servers in the US. To use a tunnel server outside the US then set the NGORK_REGION
environment variable to another region. See the ngrok documentation for the list of supported regions.
To have your tunnel protected with HTTP Basic Auth, you must create an account with ngrok, get your access token, and set the NGROK_AUTH_TOKEN
environment variable. If that environment variable is present, then a random username and a random password will be created and registered with Contentful each and every time the script is run.
Node.js is used to create a HTTP server that listens for requests and processes them as requests from Contentful Webhooks. When this server starts listening, then ngrok is started up and connected to the same port as the server and requires the same authentication, if any. Once ngork is connected and provides an ngrok URL, then the ngrok URL is registered with Contentful via the Contentful Content Management API. If the server is interrupted or terminated, then the registered webhook will be removed from Contentful.
Deploying and running this server on a publicly accessible system does not require ngrok and, therefore, should use the contentful-webhook-listener.js server, that this is based on, instead.
In addition to the Contentful webhook events, this server also emits the following events.
Emitted when an error occurs. The server will be closed directly following this event.
Emitted after ngork connects.
Emitted after ngrok disconnects.
Emitted after a webhook record is created via the Contentful Content Management API.
Emitted after a webhook record is deleted via the Contentful Content Management API.
To proxy HTTP(S) requests, then set the appropriate npm config variables.
npm config set https-proxy http://proxy.example.com:3128/
npm config set proxy http://proxy.example.com:3128/
If the npm config variables are not found, then these environment variables will be used.
HTTPS_PROXY=http://proxy.example.com:3128/
HTTP_PROXY=http://proxy.example.com:3128/
2.0.6 — October 21, 2019
2.0.5 — May 24, 2019
2.0.4 — May 23, 2019
2.0.3 — May 23, 2019
2.0.2 — February 19, 2018
2.0.1 — June 19, 2018
2.0.0 — June 19, 2018
1.6.1 — November 21, 2017
1.6.0 — November 21, 2017
1.5.4 — June 13, 2017
1.5.3 — June 13, 2017
1.5.2 — June 12, 2017
1.5.1 — June 12, 2017
1.5.0 — March 17, 2017
1.4.0 — March 16, 2017
1.3.0 — February 7, 2017
NGROK_ACCESS_TOKEN
is found in the process environment1.2.0 — January 31, 2017
ngrokConnect
event in addition to the public ngork URL1.1.0 — November 4, 2016
1.0.0 — November 3, 2016
contentful-webhook-tunnel is available under the MIT License.
FAQs
An HTTP server for listening to Contentful API Webhooks with secure tunnels to localhost.
We found that contentful-webhook-tunnel 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.