fix(core): Don't use unbound context methods in code sandboxes (#11914)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-11-27 12:08:16 +01:00
committed by GitHub
parent 2c252b0b2d
commit f6c0d045e9
6 changed files with 19 additions and 30 deletions

View File

@@ -92,8 +92,8 @@ return items;`,
// Define the global objects for the custom function
const sandbox = {
getNodeParameter: this.getNodeParameter,
getWorkflowStaticData: this.getWorkflowStaticData,
getNodeParameter: this.getNodeParameter.bind(this),
getWorkflowStaticData: this.getWorkflowStaticData.bind(this),
helpers: this.helpers,
items,
// To be able to access data of other items
@@ -157,7 +157,7 @@ return items;`,
const vm = new NodeVM(options);
if (mode === 'manual') {
vm.on('console.log', this.sendMessageToUI);
vm.on('console.log', this.sendMessageToUI.bind(this));
}
// Get the code to execute