mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(expression): prevent calls to constructor to forbid arbitrary code execution (#4139)
* fix(expression): prevent calls to constructor to forbid arbitrary code execution
This commit is contained in:
@@ -249,6 +249,15 @@ export class Expression {
|
||||
data.Boolean = Boolean;
|
||||
data.Symbol = Symbol;
|
||||
|
||||
const constructorValidation = new RegExp(/\.\s*constructor/gm);
|
||||
if (parameterValue.match(constructorValidation)) {
|
||||
throw new ExpressionError('Expression contains invalid constructor function call', {
|
||||
causeDetailed: 'Constructor override attempt is not allowed due to security concerns',
|
||||
runIndex,
|
||||
itemIndex,
|
||||
});
|
||||
}
|
||||
|
||||
// Execute the expression
|
||||
const returnValue = this.renderExpression(parameterValue, data);
|
||||
if (typeof returnValue === 'function') {
|
||||
|
||||
Reference in New Issue
Block a user