Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fixes sandbox escape (#197)
  • Loading branch information
patriksimek committed Apr 7, 2019
1 parent 2ac8ff2 commit 4b22d70
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/contextify.js
Expand Up @@ -327,15 +327,15 @@ Decontextify.object = (object, traps, deepTraps, flags, mock) => {
return proxy;
};
Decontextify.value = (value, traps, deepTraps, flags, mock) => {
if (Contextified.has(value)) {
// Contextified object has returned back from vm
return Contextified.get(value);
} else if (Decontextify.proxies.has(value)) {
// Decontextified proxy already exists, reuse
return Decontextify.proxies.get(value);
}

try {
if (Contextified.has(value)) {
// Contextified object has returned back from vm
return Contextified.get(value);
} else if (Decontextify.proxies.has(value)) {
// Decontextified proxy already exists, reuse
return Decontextify.proxies.get(value);
}

switch (typeof value) {
case 'object':
if (value === null) {
Expand Down Expand Up @@ -621,15 +621,15 @@ Contextify.object = (object, traps, deepTraps, flags, mock) => {
return proxy;
};
Contextify.value = (value, traps, deepTraps, flags, mock) => {
if (Decontextified.has(value)) {
// Decontextified object has returned back to vm
return Decontextified.get(value);
} else if (Contextify.proxies.has(value)) {
// Contextified proxy already exists, reuse
return Contextify.proxies.get(value);
}

try {
if (Decontextified.has(value)) {
// Decontextified object has returned back to vm
return Decontextified.get(value);
} else if (Contextify.proxies.has(value)) {
// Contextified proxy already exists, reuse
return Contextify.proxies.get(value);
}

switch (typeof value) {
case 'object':
if (value === null) {
Expand Down

0 comments on commit 4b22d70

Please sign in to comment.