mongoose_proto.patch 375 B

123456789101112
  1. --- node_modules/mongoose/lib/document.js
  2. +++ node_modules/mongoose/lib/document.js
  3. @@ -689,6 +689,10 @@ function init(self, obj, doc, opts, prefix) {
  4. function _init(index) {
  5. i = keys[index];
  6. + // avoid prototype pollution
  7. + if (i === '__proto__' || i === 'constructor') {
  8. + return;
  9. + }
  10. path = prefix + i;
  11. schema = self.$__schema.path(path);