From b62f1da1ff5442f23443d6be6a92d00e65cba93a Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Mon, 1 Nov 2021 20:41:46 -0600 Subject: [PATCH] Protect against constructor modification, #84 --- lib/validate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/validate.js b/lib/validate.js index 99c9c9c..8992d6d 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -207,7 +207,7 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O } for(var i in objTypeDef){ - if(objTypeDef.hasOwnProperty(i) && i != '__proto__'){ + if(objTypeDef.hasOwnProperty(i) && i != '__proto__' && i != 'constructor'){ var value = instance[i]; // skip _not_ specified properties if (value === undefined && options.existingOnly) continue;