Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = prototypeInjectionHandler = (req, res, next) => {
try {
if (req.body && typeof req.body === 'object') {
Bourne.scan(req.body);
}
next();
} catch (error) {
let OperationOutcome = require(resolveSchema('3_0_1', 'operationoutcome'));
let err = new OperationOutcome({
statusCode: 400,
issue: [
{
severity: 'error',
code: 'invalid',
details: {
text: error.message,
},
},
],
});