{"record":{"id":"74c07bca1bdea173","repo":"n8n-io/n8n","slug":"cannot-override-sanitize-due-to-security-conce","errorCode":null,"errorMessage":"Cannot override \"__sanitize\" due to security concerns","messagePattern":"Cannot override \"__sanitize\" due to security concerns","errorType":"exception","errorClass":"ExpressionError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/expression-runtime/src/runtime/context.ts","lineNumber":124,"sourceCode":" */\nexport function buildContext(\n\tcallbacks: BridgeCallbacks,\n\ttimezone?: string,\n): Record<string, unknown> {\n\tif (timezone && !IANAZone.isValidZone(timezone)) {\n\t\tthrow new Error(`Invalid timezone: \"${timezone}\"`);\n\t}\n\tSettings.defaultZone = timezone ?? 'system';\n\n\tconst target: Record<string, unknown> = {};\n\n\t// __sanitize must be on the context because PrototypeSanitizer generates:\n\t// obj[this.__sanitize(expr)] where 'this' is the context (via .call(ctx) wrapping)\n\t// Use a non-writable property descriptor so override attempts throw instead of silently succeeding.\n\tObject.defineProperty(target, '__sanitize', {\n\t\tget: () => __sanitize,\n\t\tset: () => {\n\t\t\tthrow new ExpressionError('Cannot override \"__sanitize\" due to security concerns');\n\t\t},\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n\n\t// -------------------------------------------------------------------------\n\t// Create DateTime values inside the isolate (not lazy-loaded from host,\n\t// because host-side DateTime objects lose their prototype crossing the\n\t// boundary). The isolate has its own luxon with the correct timezone\n\t// already set via Settings.defaultZone above.\n\t// -------------------------------------------------------------------------\n\n\ttarget.$now = DateTime.now();\n\ttarget.$today = DateTime.now().set({ hour: 0, minute: 0, second: 0, millisecond: 0 });\n\n\t// -------------------------------------------------------------------------\n\t// Expose standalone functions (min, max, average, numberList, zip, $ifEmpty, etc.)\n\t// -------------------------------------------------------------------------","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/expression-runtime/src/runtime/context.ts#L106-L142","documentation":"Error \"Cannot override \"__sanitize\" due to security concerns\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/expression-runtime/src/runtime/context.ts:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}