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.
express-errors-handler
Advanced tools
Some middleware for Express and Node that sets up Raven (or not as appropriate) depending on sensible environment variables.
Some middleware for Express and Node that sets up Raven (or not as appropriate) depending on sensible environment variables.
npm install --save express-errors-handler
var express = require('express');
var app = express();
var eeh = require('express-errors-handler')
var errorMiddleware = eeh.middleware;
var promiseEnabledApi = require('./my-promise-enabled-api');
// A typical route using Promises
app.get('/a-typical-route', function(req, res, next) {
promiseEnabledApi.getSomeThings()
.then(function(someThings) {
res.render(someThings);
})
// Make sure to end all Promise chains with a `catch`
// that passes the error to the next middleware
.catch(next);
});
// A typical route with an upstream dependency
app.get('/a-typical-route', function(req, res, next) {
fetch('http://a.url.i-like')
.then(function(someThings) {
res.render(someThings);
})
// chosse what status to send when an upstream service errors
.catch(eeh.upstreamErrorHandler(404))
// Make sure to end all Promise chains with a `catch`
// that passes the error to the next middleware
.catch(next);
});
// Make sure the middleware is added after your routes otherwise you'll lose the errors
app.use(errorMiddleware);
NODE_ENV
- mode to operate in, can be either PRODUCTION
(sends bugs to aggregator) or any another value (shows bugs to user)RAVEN_URL
- URL to report bugs captured in productionSPLUNK_URL
- URL to send non critical or upstream bugs tooThis software is published by the Financial Times under the MIT license.
FAQs
Some middleware for Express and Node that sets up Raven (or not as appropriate) depending on sensible environment variables.
We found that express-errors-handler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
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.