Skip to content

Commit

Permalink
Add sandboxed context parameter preventEscape
Browse files Browse the repository at this point in the history
Default: false.
This will fix: metarhia/Example#58
  • Loading branch information
tshemsedinov committed Nov 30, 2020
1 parent 92e3093 commit e5090ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ const COMMON_CONTEXT = vm.createContext(
})
);

const createContext = (context) => {
const createContext = (context, preventEscape = false) => {
if (!context) return EMPTY_CONTEXT;
return vm.createContext(context, CONTEXT_OPTIONS);
return vm.createContext(context, preventEscape ? CONTEXT_OPTIONS : {});
};

class MetaScript {
Expand Down

0 comments on commit e5090ab

Please sign in to comment.