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.
@curveball/problem
Advanced tools
This package is a middleware for the Curveball framework that catches any
exception and turns them into application/problem+json
responses, as defined
in RFC7807.
By default any exception turns into a non-descript 500 Internal Server Error. To create a more specific error, use an exception from the @curveball/http-errors package or implement one of the interfaces.
npm install @curveball/problem
import problemMw from '@curveball/problem';
import { Application } from '@curveball/core';
const app = new Application();
app.use(problemMw());
Typically you will want the problem middleware to be one of the first middlewares you add to the server. Only exceptions from midddlewares that come after the problem middleware can be caught.
You can throw the following kinds of errors.
httpStatus
property. Any error that's thrown that has a
httpStatus
property will automatically use that http status. The error
message will be used as a title.By default the middleware will emit a detailed error for any exception that implements the http-errors interfaces, because the assumption is that if these errors were emitted, they were intended for the user of the server.
Any exceptions that are thrown that don't implement these interfaces are stripped from their message and detail and converted to a 500 error to avoid potential security issues.
It's possible to turn this off during development in two ways. You can set the debug setting to true as such:
app.use(problemMw({
debug: true
});
The second way is by setting the environemnt variable NODE_ENV
to the string
development
.
If the debug
property is set, that value always takes precedent.
FAQs
A middleware for converting errors into application/problem+json
We found that @curveball/problem demonstrated a healthy version release cadence and project activity because the last version was released less than 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 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.