Prototype Pollution
Prototype Pollution
javascriptCopy codelet user = JSON.parse(req.body.user);javascriptCopy codelet user = JSON.parse(req.body.user);
if (user.hasOwnProperty('__proto__')) {
throw new Error('Prototype pollution attempt detected');
}javascriptCopy codelet user = Object.assign({}, req.body);javascriptCopy codelet user = Object.assign({}, req.body);
if (user.hasOwnProperty('__proto__')) {
throw new Error('Prototype pollution attempt detected');
}Last updated