mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
fix(core): Allow $evaluateExpression to resolve in task runners (#14641)
This commit is contained in:
@@ -49,17 +49,6 @@ setErrorHandler((error: Error) => {
|
||||
if (isExpressionError(error)) throw error;
|
||||
});
|
||||
|
||||
const AsyncFunction = (async () => {}).constructor as FunctionConstructor;
|
||||
|
||||
const fnConstructors = {
|
||||
sync: Function.prototype.constructor,
|
||||
|
||||
async: AsyncFunction.prototype.constructor,
|
||||
mock: () => {
|
||||
throw new ExpressionError('Arbitrary code execution detected');
|
||||
},
|
||||
};
|
||||
|
||||
export class Expression {
|
||||
constructor(private readonly workflow: Workflow) {}
|
||||
|
||||
@@ -217,8 +206,6 @@ export class Expression {
|
||||
data.Reflect = {};
|
||||
data.Proxy = {};
|
||||
|
||||
data.constructor = {};
|
||||
|
||||
// Deprecated
|
||||
data.escape = {};
|
||||
data.unescape = {};
|
||||
@@ -345,10 +332,6 @@ export class Expression {
|
||||
data: IWorkflowDataProxyData,
|
||||
): tmpl.ReturnValue | undefined {
|
||||
try {
|
||||
[Function, AsyncFunction].forEach(({ prototype }) =>
|
||||
Object.defineProperty(prototype, 'constructor', { value: fnConstructors.mock }),
|
||||
);
|
||||
|
||||
return evaluateExpression(expression, data);
|
||||
} catch (error) {
|
||||
if (isExpressionError(error)) throw error;
|
||||
@@ -362,11 +345,6 @@ export class Expression {
|
||||
|
||||
throw new ApplicationError(match.groups.msg);
|
||||
}
|
||||
} finally {
|
||||
Object.defineProperty(Function.prototype, 'constructor', { value: fnConstructors.sync });
|
||||
Object.defineProperty(AsyncFunction.prototype, 'constructor', {
|
||||
value: fnConstructors.async,
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user