
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@venndr/express-webhook-verifier
Advanced tools
Use this middleware to verify webhook payloads against their signature, before handing over control to your handler.
npm install --save @venndr/express-webhook-verifier
This middleware requires a key fetcher – a function that receives the key version as argument and should return a Promise<crypto.KeyObject>
.
A key fetcher that satisfies basic use cases is available in the Venndr Node SDK. See @venndr/public-key-fetcher for more detailed information.
Important! This middleware must be preceded by the express.raw()
, or an equivalent, middleware. Our recommendation is to not install a global body decoder and only decode payloads for those handlers that expect one.
On successful verification the parsed payload is assigned to request.body
. On failed verification request.body
is set to null
and an error will be passed to next()
.
import express from "express";
import { keyFetcher } from "@venndr/public-key-fetcher";
import { verifyWebhookSignature } from "@venndr/express-webhook-verifier";
const app = express();
const slurpBody = express.raw({ type: "application/json" });
const checkSignature = verifyWebhookSignature(keyFetcher());
const verifyPayload = [slurpBody, checkSignature];
app.post("/webhooks", ...verifyPayload, (req, res) => {
console.log(`received valid webhook with payload ${req.body}`);
res.sendStatus(202);
});
app.listen(process.env.PORT ?? "8080")
To skip the signature verification the UNSAFE_SKIP_WEBHOOK_VERIFY
environment variable can be set to any non-empty value. This should only be used during development and never in production.
FAQs
Express middleware for verifying Venndr webhook signatures
We found that @venndr/express-webhook-verifier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.