Skip to content

Commit

Permalink
Merge pull request #10053 from 418sec/1-npm-mongoose
Browse files Browse the repository at this point in the history
Security Fix for Prototype Pollution - huntr.dev
  • Loading branch information
vkarpov15 committed Mar 22, 2021
2 parents 00e059d + 3ed44ff commit 91f003a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/schema.js
Expand Up @@ -466,6 +466,11 @@ Schema.prototype.add = function add(obj, prefix) {
}

prefix = prefix || '';
// avoid prototype pollution
if (prefix === '__proto__.' || prefix === 'constructor.' || prefix === 'prototype.') {
return this;
}

const keys = Object.keys(obj);

for (const key of keys) {
Expand Down

0 comments on commit 91f003a

Please sign in to comment.