
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
joi-express
Advanced tools
Simple validation middleware for express using the joi validation suite.
Simple validation middleware for express using the Joi validation suite.
npm install joi-express
npm install joi
var Express = require('express');
var BodyParser = require('body-parser');
var ExpressJoi = require('joi-express');
var Joi = require('joi');
var app = Express();
app.use(BodyParser.json());
// Use Joi to create your schemas
var querySchema = {
query: {
limit: Joi.number().default(10).min(10).max(100),
offset: Joi.number().default(10).min(10).max(100)
},
headers: {
authorization: Joi.string().required()
}
};
// Attach the validator like other middleware
app.get('/', expressJoi(querySchema), function (req, res, next) {
// do something with req.query.limit & req.query.offset
...
});
// Use Joi to create your schemas
var bodySchema = {
body: {
name: Joi.string().required()
}
};
// Attach the validator like other middleware
app.post('/', expressJoi(bodySchema), function (req, res, next) {
// do something with req.body;
...
});
// Example error handler
app.use(function (err, req, res, next) {
if (err.isBoom) {
return res.status(err.output.statusCode).json(err.output.payload);
}
});
app.listen(8080);
If a validation error occurs it will either be handled by your express error handling middleware or thrown.
Since this middleware is just a wrapper around the Joi validate
method all the options
are supported.
npm install
npm test
FAQs
Simple validation middleware for express using the joi validation suite.
We found that joi-express 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.