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

@@ -133,7 +133,7 @@ export class Code implements INodeType {
sandbox.on(
'output',
workflowMode === 'manual'
? this.sendMessageToUI
? this.sendMessageToUI.bind(this)
: CODE_ENABLE_STDOUT === 'true'
? (...args) =>
console.log(`[Workflow "${this.getWorkflow().id}"][Node "${node.name}"]`, ...args)

View File

@@ -35,8 +35,8 @@ export function getSandboxContext(
};
return {
// from NodeExecuteFunctions
$getNodeParameter: this.getNodeParameter,
$getWorkflowStaticData: this.getWorkflowStaticData,
$getNodeParameter: this.getNodeParameter.bind(this),
$getWorkflowStaticData: this.getWorkflowStaticData.bind(this),
helpers,
// to bring in all $-prefixed vars and methods from WorkflowDataProxy