Skip to content

Python Native Node: Import of standard library modules fails on 1.123 (regression) #22958

Description

@jakubvondrak

Bug Description

I've upgraded to 1.123.4 yesterday and the code in the Python Native module now fails with security exception due to disallowed imports of re, zlib, base64. It was working fine on the previous versions (I think v1.115.3 to v1.122).

None of the above libraries are listed in N8N_RUNNERS_BUILTINS_DENY in the Task runner environment variables docs and I need them to perform the logic in my workflow.

To Reproduce

Create a workflow with Python Native node on v1.123.4 Cloud with below code and run it:

import re
import zlib
import base64

return []

You'll get this error:

{
  "errorMessage": "Security violations detected",
  "errorDescription": "Line 1: Import of standard library module 're' is disallowed. Allowed stdlib modules: none\nLine 2: Import of standard library module 'zlib' is disallowed. Allowed stdlib modules: none\nLine 3: Import of standard library module 'base64' is disallowed. Allowed stdlib modules: none",
  "errorDetails": {},
  "n8nDetails": {
    "n8nVersion": "1.123.4 (Cloud)",
    "binaryDataMode": "filesystem",
    "stackTrace": [
      "Error: Security violations detected",
      "    at throwExecutionError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_8da18263ca0574b0db58d4fefd8173ce/node_modules/n8n-nodes-base/nodes/Code/throw-execution-error.ts:11:9)",
      "    at PythonTaskRunnerSandbox.runUsingIncomingItems (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_8da18263ca0574b0db58d4fefd8173ce/node_modules/n8n-nodes-base/nodes/Code/PythonTaskRunnerSandbox.ts:56:30)",
      "    at processTicksAndRejections (node:internal/process/task_queues:105:5)",
      "    at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_8da18263ca0574b0db58d4fefd8173ce/node_modules/n8n-nodes-base/nodes/Code/Code.node.ts:171:12)",
      "    at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_ec37920eb95917b28efaa783206b20f3/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1045:8)",
      "    at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_ec37920eb95917b28efaa783206b20f3/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1226:11)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_ec37920eb95917b28efaa783206b20f3/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1662:27",
      "    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_ec37920eb95917b28efaa783206b20f3/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2274:11"
    ]
  }
}

Expected behavior

The code would run without issues.

Debug Info

Debug info

core

  • n8nVersion: 1.123.4
  • platform: docker (cloud)
  • nodeJsVersion: 22.21.0
  • nodeEnv: production
  • database: sqlite
  • executionMode: regular
  • concurrency: 5
  • license: community
  • consumerId: 00000000-0000-0000-0000-000000000000

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: filesystem

pruning

  • enabled: true
  • maxAge: 720 hours
  • maxCount: 25000 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/143.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2025-12-09T07:25:29.059Z

Operating System

docker (cloud)

n8n Version

1.123.4

Node.js Version

22.21.0

Database

SQLite (default)

Execution mode

main (default)

Hosting

n8n cloud

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions