Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
node-github-webhook
Advanced tools
Github Webhooks handler based on Node.js. Support multiple handlers.
Github Webhooks handler based on Node.js. Support multiple handlers.
This library is inspired by github-webhook-handler, and it allows you set multiple handlers for different repositories.
It is a small tool based on Node.js to help you handler all the logic for receiving and verifying webhook requests from GitHub.
If you want to know the events of Github, please see: events.
Notice: Github Webhooks setting: Content-type
must be application/json
.
npm install node-github-webhook --save
var http = require('http')
var createHandler = require('node-github-webhook')
var handler = createHandler([ // multiple handlers
{ path: '/webhook1', secret: 'secret1' },
{ path: '/webhook2', secret: 'secret2' }
])
// var handler = createHandler({ path: '/webhook1', secret: 'secret1' }) // single handler
http.createServer(function (req, res) {
handler(req, res, function (err) {
res.statusCode = 404
res.end('no such location')
})
}).listen(7777)
handler.on('error', function (err) {
console.error('Error:', err.message)
})
handler.on('push', function (event) {
console.log(
'Received a push event for %s to %s',
event.payload.repository.name,
event.payload.ref
)
switch(event.path) {
case '/webhook1':
// do sth about webhook1
break
case '/webhook2':
// do sth about webhook2
break
default:
// do sth else or nothing
break
}
})
FAQs
Github Webhooks handler based on Node.js. Support multiple handlers.
We found that node-github-webhook 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.