Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

CVE-2022-37614 - resolve prototype pollution vuln #81

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions mockery.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,22 @@ var m = require('module'),
* the effective options, and return those.
*/
function getEffectiveOptions(opts) {
var options = {};
var defaultOptionsTemp = {};

Object.keys(defaultOptions).forEach(function (key) {
options[key] = defaultOptions[key];
});
if (opts) {
Object.keys(opts).forEach(function (key) {
options[key] = opts[key];
});
for (var key in defaultOptions) {
if (defaultOptions.hasOwnProperty(key)) {
defaultOptionsTemp[key] = defaultOptions[key];
}
}

if (opts) {
for (var defaultKey in defaultOptionsTemp) {
if (defaultOptionsTemp.hasOwnProperty(defaultKey) && opts[defaultKey]) {
defaultOptionsTemp[defaultKey] = opts[defaultKey];
}
}
return options;
}
return defaultOptionsTemp;
}

/*
Expand Down