From 3cd1da70884658d5e0e4e7120695edf4032c887b Mon Sep 17 00:00:00 2001 From: Dominik Przybysz <132913826+sfc-gh-dprzybysz@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:21:30 +0200 Subject: [PATCH] SNOW-811103: Set new Function as default json parser (#635) --- lib/global_config.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/global_config.js b/lib/global_config.js index ea3775c2c..ce347eea9 100644 --- a/lib/global_config.js +++ b/lib/global_config.js @@ -9,11 +9,8 @@ const mkdirp = require('mkdirp'); const Util = require('./util'); const Errors = require('./errors'); const Logger = require('./logger'); -const vm = require('vm'); const { XMLParser, XMLValidator } = require("fast-xml-parser"); -const VM_CONTEXT = vm.createContext() // create a new context so VM does not have to make a new one for each conversion - let insecureConnect = false; /** @@ -173,7 +170,7 @@ const rest = { exports.rest = rest; // The default JSON parser -exports.jsonColumnVariantParser = rawColumnValue => vm.runInContext("(" + rawColumnValue + ")", VM_CONTEXT); +exports.jsonColumnVariantParser = rawColumnValue => new Function(`return (${rawColumnValue});`)(); /** * Updates the value of the 'jsonColumnVariantParser' parameter.