From 6442e3ceca070fc529c4584fd73c98f6e2b8a9f5 Mon Sep 17 00:00:00 2001 From: lohxt1 Date: Wed, 20 Nov 2024 18:29:19 +0530 Subject: [PATCH] feat: deleteEnvVar safe mode shim --- packages/bruno-js/src/sandbox/quickjs/shims/bru.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/bruno-js/src/sandbox/quickjs/shims/bru.js b/packages/bruno-js/src/sandbox/quickjs/shims/bru.js index d55c37439..297add66a 100644 --- a/packages/bruno-js/src/sandbox/quickjs/shims/bru.js +++ b/packages/bruno-js/src/sandbox/quickjs/shims/bru.js @@ -39,6 +39,12 @@ const addBruShimToContext = (vm, bru) => { vm.setProp(bruObject, 'setEnvVar', setEnvVar); setEnvVar.dispose(); + let deleteEnvVar = vm.newFunction('deleteEnvVar', function (key) { + return marshallToVm(bru.deleteEnvVar(vm.dump(key)), vm); + }); + vm.setProp(bruObject, 'deleteEnvVar', deleteEnvVar); + deleteEnvVar.dispose(); + let getGlobalEnvVar = vm.newFunction('getGlobalEnvVar', function (key) { return marshallToVm(bru.getGlobalEnvVar(vm.dump(key)), vm); });