Why teams enable npm modules and Python in n8n Code nodes
Teams enable additional npm modules or native Python in n8n Code nodes when a workflow needs a library the node does not expose by default, such as a parser for an unusual file format, a crypto helper for signing payloads, or a data library for reshaping large tables. The capability lets workflow authors import packages beyond the defaults, so the decision is about which libraries reach the server and who may use them. n8n is a fair-code workflow automation platform built with TypeScript and Node.js that combines a visual canvas with custom JavaScript or Python code. The Code node is where that custom logic lives, which makes it the place where a workflow's power and its risk both concentrate.
The distinction to keep in mind is between built-in modules, which ship with the runtime and are available to the Code node out of the box, and external modules, which are third-party packages that someone must install into the runtime image before a workflow can import them. Built-in modules are a smaller, more predictable addition. External modules bring their own code, dependencies and maintenance history into the server process. Every module you add expands what any workflow author can run on your infrastructure, including code that reads files, makes network calls or touches credentials that the workflow can reach.
Before you change anything, inventory the libraries your workflows actually need, record who requested each one, and confirm which module settings your n8n version supports, since the exact configuration keys and the Python runtime options are documented by n8n and should be checked against the version you run. Treat each approved module as a change to the production image, with an owner, a justification and a review of its dependency tree. This section explains the reasons; the sections that follow cover how the allowlists work and what each module costs in security terms.
Configuration options and when each fits
This table compares the four ways to give Code node scripts extra capability: no extra modules, a small allowlist of built-in Node.js modules, vetted external npm packages baked into a custom image, and native Python packages in the runner. Read each row against your own risk tolerance and release cadence. The main takeaway is that every addition widens what a workflow author can run, so the more code you add, the more you must maintain.
| Option | Configuration surface and maintainer | Upgrade impact and typical risk |
|---|---|---|
| No extra modules | Default Code node behavior with no added modules. Confirm the default for your release in the n8n documentation. Nothing new to maintain. | No upgrade work beyond normal n8n upgrades. Lowest risk, but authors must rebuild logic with built-in nodes or HTTP requests. |
| Allowlist of built-in Node.js modules | Environment setting that names specific Node.js built-in modules. Confirm the exact setting name and syntax for your version. Maintained by the platform owner who sets the allowlist. | Review on each upgrade, since module behavior and the allowed list can change. Moderate risk, because built-in modules can reach the file system and network. |
| Vetted external npm packages in a custom image | Packages installed into a custom runner or n8n image built by your team. Maintained by your platform team, which owns the Dockerfile, package lock and rebuild pipeline. | Image must be rebuilt for every n8n upgrade and every package update. Higher risk, because each package adds transitive dependencies and its own supply chain exposure. |
| Native Python packages in the runner | Python packages installed into the Python task runner environment. Confirm current support, module allowlisting and runner configuration for your release. Maintained by your platform team. | Python runner behavior and supported features have changed across releases, so test before upgrading. Higher risk, because packages run native code with broad system access. |
| Who approves a new module | Usually a security lead with the workflow owner. Set a written request and review process before the first package is added. | Approval effort recurs with each new package, not only at setup. Keep the list short to control review load. |
| Pinning and provenance | Lock file, exact versions and internal mirror or registry where your policy requires it. Confirm registry options with your environment team. | Pinning makes upgrades deliberate but creates drift. Plan a regular review of pinned versions and advisories. |
| Monitoring and removal | Execution logs, image inventory and a documented removal path for each module. Maintained jointly by security and platform teams. | Unused packages keep their risk. Remove modules when no workflow depends on them. |
How to set up approved modules in a self-hosted n8n instance
This sequence turns ad hoc module requests into a reviewed, pinned and tested allowlist that every n8n process loads the same way. The result is a Code node environment where approved modules run and unlisted ones are refused, with a record of who approved each one and why.
Inventory module requests from workflow owners
Collect every module and Python package that workflow owners want in a Code node, along with the workflow it serves, the data it touches and the reason the built-in nodes fall short. The platform team owns this list and asks each requester to name a version range and the owner who will maintain the workflow. The step is done when every request has a row in a single register and no module is installed informally on a server.
Review each module's maintainers and dependencies
For each request, the security reviewer checks the publisher, the maintenance history, the open vulnerability reports, the license and the transitive dependency tree. Pay particular attention to install scripts, which run code on the host during installation, and to modules that make network calls or read the filesystem. The output is a short review note per module with an approve, reject or conditional decision, and the conditions attached to any approval.
Decide built-in or external for each module
Sort approved requests into Node.js built-in modules, which ship with the runtime, and external packages, which must be installed into the image. Built-ins usually carry a smaller supply chain cost, so confirm whether a standard library call can replace an external package before adding one. The platform team records the decision for each module, which determines whether it appears in the built-in list, the external list or both.
Write the allowlist configuration
Set the allowlist for built-in modules and for external modules as environment variables, using the variable names in n8n's current self-hosting documentation for your version. Keep the lists in version control with the review notes linked from each entry. The step is complete when the configuration file reads cleanly in review and every entry traces back to an approved decision.
Build the image with pinned package versions
Build a custom n8n image, or a custom runner image if your version uses task runners, that installs each approved external package at an exact version and includes the Python packages the same way. Lock the dependency tree, generate the image from the lock file, and record the image digest. The output is a tagged image in your registry with a bill of materials that lists every package and its version.
Deploy to staging with matching configuration
Deploy the image and allowlist configuration to a staging instance that mirrors production. In queue mode, the main instance, every worker and every webhook processor must run the same image digest and the same allowlist settings, or executions will behave differently depending on which process picks them up. See the queue mode documentation before deploying. Check that each process reports the same image version and configuration before moving on.
Test approved and unlisted modules
Run a test workflow that calls an approved module and confirms it returns the expected result, then run one that imports an unlisted module and confirm the Code node refuses it with an error. Repeat both tests on a worker process, not only the main instance, and include one Python check if Python is in scope. Keep the test workflows and their results with the change record, and promote to production only when every test passes on every process type.
What each added module costs in security terms
Every package you allow in a Code node adds code that runs with the workflow engine's privileges and can reach the same secrets. The cards below cover the risks that accumulate with each module and the controls that keep the list small and maintained.
Supply chain and transitive dependencies
A module you approve brings its own dependency tree, and most of that tree is code nobody on your team reviewed. Each added package multiplies the number of maintainers who can change what runs in your n8n process. Before approving a module, review its full dependency list, not only its top-level package, and pin exact versions in the image you build. Check whether the package has a maintainer set you recognize and a history of releases you can follow.
Install-time scripts
Many npm packages run install hooks or native build steps when they are installed, and those scripts execute during your image build, often with network access. A package can do its work at install time without ever being called from a workflow. Build the runner image in a pipeline with a fixed registry, disable or review lifecycle scripts where your package manager allows it, and keep the build log so you can see what each module executed.
Network and filesystem access from Code nodes
Once a module is loaded into a Code node, it can usually open outbound connections and read or write files available to the n8n process. A module that is harmless on its own may send workflow data to an external host or read mounted configuration. Limit what the runner can reach with egress rules at the network layer, restrict file system mounts to what the workflow needs, and test each approved module against those rules before it goes to production.
Credential exposure through shared process memory
Code nodes execute in the same process space as the engine that holds decrypted credential data for the workflows it runs. A loaded module can therefore reach values that a workflow never passed to it, and no per-package permission model separates them. Treat any module with broad code execution as able to read credentials in use, keep high-value secrets out of workflows that run third-party code, and use separate instances or runners for workflows that need different trust levels.
License terms for the packages themselves
Your n8n license covers the platform, but every npm or Python package carries its own license, and some restrict commercial use, redistribution or embedding in a product. Those terms apply to the image you ship, and they can conflict with a plan that embeds n8n in customer-facing services. Record the license of each approved module, check it against your use case, and ask legal to confirm terms for any package with a non-standard license before it enters the allowlist.
Patching ownership after release
A module that is safe on approval date can receive a security fix later, and a rebuilt image is the only way to deliver that fix to a self-hosted instance. Assign a named owner for each module who watches its advisories, rebuilds the runner image, and retests the workflows that use it. Set a review date for every allowlisted package and remove modules that no active workflow still uses, since unmaintained code stays in the image until someone removes it.
How approved modules move from review to the runner
The path starts with a module request from a workflow builder, which goes to a security review before anything is installed. Approved packages are pinned and built into a custom image, so the same versions reach every process. The main instance and workers then load that image, and the Code node runs inside a trust boundary that keeps it apart from the credential store. Check that the reviewed version is the one deployed, and that the allowlist in the image matches the approval record.
Approved modules are pinned into one image that every n8n process loads.
Operating approved modules after go-live
How do we rebuild the runner image on every n8n upgrade?
Treat the runner image as a build artifact that is rebuilt from source control whenever you change the n8n version or the module list. Pin the n8n version and every approved package version in a single build file, so a rebuild produces the same result from the same inputs. Before promoting a new image, run a staging instance with a copy of your production workflows that use Code node modules, execute them, and confirm each module still loads. Keep the previous image tag available so you can roll back if a module or Python package behaves differently on the new release. Confirm the exact runner image contents and build steps for your version in the n8n documentation before you automate them.
How should we review and retire Code node modules over time?
Keep a register with one row per module: name, pinned version, business owner, the workflows that depend on it, the data it touches and the date of its last review. Require a short review whenever someone requests a new module or a version change, covering what the package does, its maintainers, its install scripts and its network or file access. Retire a module by removing it from the allowlist and the build file, then searching your workflows for references before the next image ships. Give owners a clear migration path, such as a built-in node or a small internal function, so retirement does not stall teams.
How do we monitor approved modules for vulnerable dependencies?
Generate a software bill of materials for each runner image, listing every direct and transitive npm and Python package with its version. Run a dependency scanner against that list on a schedule and whenever the image changes, then route findings to the owners recorded in your module register. Track the transitive dependencies too, because most advisories affect packages that a module pulls in rather than the module itself. Decide in advance who can accept a risk, how exceptions expire and when a vulnerable module is removed from the allowlist. Ask your security team which scanner and advisory sources they already trust so the results fit existing triage.
How do we log which workflows use which modules?
Record module use at two points: in the workflow inventory, and in the runtime logs or execution metadata that your n8n monitoring already collects. For the inventory, export workflows on a schedule and parse each Code node for imports or require calls, mapping every module to the workflow ID, project and owner. Store the mapping in the same register as your module reviews so that a vulnerability notice can be traced to affected workflows within minutes. Confirm which execution fields your n8n version records and whether your log pipeline can retain them for the period your auditors expect.
Who maintains the runner image and module list after go-live?
Ownership usually sits with the platform team that runs n8n, with a named approver from security and a named owner for each workflow that depends on a module. The platform team owns the build pipeline, image registry and rollback. Security owns the allowlist criteria and reviews new or upgraded modules. Workflow owners own their business logic and confirm testing after an image change. Write this split down before go-live, because unclear ownership is where stale modules and unpatched packages tend to remain in production.
How much ongoing work does a module allowlist create?
The recurring work is driven by the number of modules, how often they change, how many workflows depend on them and how fast your organization ships n8n upgrades. Each image rebuild needs a staging run, a dependency scan and a sign-off, so a longer list and more frequent upgrades increase effort. Costs come from internal staff time, build and scanning tooling, and any external support you buy. A quote should name which of these tasks the provider takes on, how often it repeats, what it requires from your team and what happens when a dependency needs an emergency change. Ask for the test scope used to confirm each rebuild.
Can DeployOpen run module reviews and image rebuilds for us?
DeployOpen plans, implements, hardens, backs up, upgrades, documents and supports self-hosted open-source platforms inside your own infrastructure, and that work can include rebuilding and testing n8n images. Engagements are fixed-scope, so the module review cycle, rebuild steps, scanning and log mapping would be written into the agreed deliverables before work starts. Ongoing upgrades and support are available as retainers. Ask for the exact tasks, the environments covered and the handover documents in the written scope.
Keeping main, worker and webhook processes consistent
In queue mode, the main instance's encryption key must be shared with every worker and webhook processor node, because those processes read credentials from the database and need the key to decrypt them. The same logic applies to Code node settings. Any process that can run a Code node must load the same module allowlist and have the same packages installed, or the same workflow can behave differently depending on which process picks up the execution. Before you enable any module or Python package, list every container or host that runs a main, worker or webhook process, and confirm each one uses the same image tag, the same environment variables and the same key material. Check the queue mode documentation for the current list of settings that must be shared, and confirm them against your n8n version.
Drift is the usual failure. A worker built before a module was added to the allowlist, or one running an older image after an n8n upgrade, will fail a Code node that works on the main instance. A webhook processor missing a Python package may return an error only for requests routed to it, so the failure appears intermittent. Teams often read these symptoms as bugs in the workflow logic and spend time editing nodes that are not broken. When a Code node fails only some of the time, compare the image digest, the allowlist environment values and the installed package versions on each process before changing the workflow.
Treat the runner image as one versioned artifact that is promoted to every process at once. Build it from a single pinned definition, tag it with the n8n version and the package set, and deploy that tag to mains, workers and webhook processors in the same change window. Add a smoke test that runs a Code node using each allowed module and a Python step on every process type, not only on the main instance, and run it after each deployment and each upgrade. Ask your platform or DeployOpen team to document which process type handles which trigger, so the test covers the path your webhooks actually take.
Limits to confirm in your environment
Allowing modules in a Code node changes what your n8n instance can execute, what licenses you take on and how often you rebuild. The cards below list the points to confirm against your own release, edition and deployment before you approve any module list.
Exposed Node.js and Python capabilities
Confirm which built-in Node.js modules and which Python capabilities your n8n release exposes inside Code nodes, and whether the defaults differ between the JavaScript and Python runners. Test each capability on a non-production instance, because a module that loads in one release can be blocked or behave differently in the next. Record the exact release you tested so the allowlist matches what production runs.
n8n release notesEdition and plan effects
Confirm whether the code execution and module settings you need are available on your current edition. The pricing page places SSO, LDAP, Git environments and log streaming in the Business and Enterprise plans, so a Community deployment may have a different control set than a paid one. Ask the vendor in writing which features apply to the plan you hold.
n8n pricingLicensing of added modules
Each npm or Python package carries its own license, separate from n8n's Sustainable Use License. Review the license of every direct dependency and its transitive dependencies before adding it, and confirm that your intended use, including any distribution to customers, is permitted. Keep a record of the license review with the allowlist entry.
Internal use limits of the license
Confirm that your use of n8n with added modules stays within the Sustainable Use License, which permits use for your own internal business purposes and limits distribution. If you plan to offer workflows to customers or embed n8n in a product, check the licensing rules before rollout. Ask counsel to confirm how the license applies to your specific use.
n8n license textCustom image support in your deployment
Confirm that your hosting model lets you build and run a custom image with the extra packages installed in the runner. Managed or restricted environments may not allow image builds, and queue mode workers must run the same image as the main instance so every process has the same modules. Verify this with your platform team before choosing a design.
Rebuild cadence after upgrades
Confirm how often your team will rebuild the runner image, since n8n ships minor releases roughly weekly and each upgrade can change the runtime that modules depend on. Decide whether rebuilds follow each release or a set schedule, and who runs regression tests on the allowlisted modules after each build. Budget the rebuild and test work as recurring effort, not a one-time task.
- Minor release cadence
- Weekly
What does it cost to enable Code node modules?
What drives the cost of enabling Code node modules in n8n?
The main cost drivers are the number of modules, how deep each security review goes, how the runner image is built and rebuilt, the queue mode topology, and how often you upgrade n8n. Each module brings its own dependency tree, network and filesystem reach, and an update track to follow, so the work grows faster than a simple module count suggests. Queue mode multiplies the image work, because the main instance, workers and webhook processors that run Code nodes need matching packages. Upgrade frequency matters because each n8n upgrade can require a rebuild and retest. Ask any partner to break the quote into inventory and review, image build and testing, queue rollout, and upgrade support.
Which costs are one-time and which recur after go-live?
The one-time work covers the module inventory, the initial security review, the first image build, test workflows, and documentation of what is allowed and why. The recurring work covers updating module versions, re-reviewing a module whenever its version or maintainer changes, rebuilding the image for each n8n upgrade, and retiring modules nobody uses. n8n ships minor releases roughly weekly, according to its release notes, so the rebuild and retest cycle is continuous rather than occasional. Over several years, the recurring work often costs more than the initial build. Ask for the recurring part to be priced separately, with the upgrade cadence and the retest scope written down.
Can our own team enable Code node modules without a partner?
Yes, if your team can build container images, manage a registry, write test workflows, and own upgrades after go-live. The technical steps are not unusual for a platform engineering group. The harder parts are judging the risk of each module, getting a named security approver to sign off, and keeping the image current on a steady schedule. Teams that handle these well usually have a clear owner for the allowlist and a documented review process. Confirm three things before deciding: whether you have engineers with time for the upgrade cycle, whether your security team can review Node.js and Python packages in depth, and whether your internal use of n8n fits the terms in n8n's license. A partner is useful when those gaps are large or the timeline is short.
What does our side need to provide for this engagement?
The engagement depends on inputs that only your organization can supply. Expect to provide:
- A module inventory listing each package, its purpose, the version requested, and the workflow owner who needs it
- A named security approver who can accept or reject each module after review
- Access to your container image registry and build pipeline, including permission to publish new runner images
- A named owner for upgrades and module retirement after handover
- Representative test workflows and the environments where they run
- Details of your queue mode layout, including how many workers and webhook processors run and where
Missing any of these usually extends the timeline, so confirm them before the written scope is agreed.
How long does enabling Code node modules take?
The duration depends on your environment, and no fixed timeline applies to every organization. The main variables are the number of modules, whether you run queue mode with several workers, how mature your image pipeline is, and how long your internal security approvals take. A small allowlist on a single instance with an existing pipeline is a very different job from a multi-worker queue deployment that needs new registry access. Most engagements are fixed-scope, so the timeline is agreed in writing before work starts. Ask for the milestones, the dependencies on your approvers and registry, and the point at which the team takes over upgrades.
How much does each additional module add to the work?
Each module adds more than its own review. The reviewer checks what the package does, its transitive dependencies, whether it reaches the host filesystem, network, or environment variables, whether it includes native binaries, and how actively its maintainers publish fixes. Some modules share dependencies, so the effort is not strictly linear in the count. A module that needs outbound network access or handles credentials usually needs a deeper review and a narrower allowlist entry than a pure data-transformation library. Ask the partner or your own team to classify modules into review tiers during scoping, so the price and time reflect the actual risk mix rather than a flat per-module figure.
What should a quote for this work include?
A quote should follow a written scope rather than a generic package. Ask for the module list with the review tier for each module, the image build and registry steps, the environments covered, the queue mode topology and rollout plan, the test approach, and the upgrade support model. Separate one-time work from any retainer, and list what is excluded, such as changes to modules after handover or fixes to n8n itself. Confirm who holds the image build and allowlist after delivery. DeployOpen does not publish a price list, and a quote follows from the written scope agreed before work starts.
How DeployOpen scopes and supports Code node modules
DeployOpen handles Code node modules under a written, fixed scope agreed before any work starts. The scope lists the modules and Python packages you want available, the review each one receives, the allowlist settings applied to your n8n instance, the custom runner image build, the staging tests that prove workflows behave as expected, and the handover documentation your team keeps. Pricing follows from that written scope, so the more modules, runtimes and environments you bring in, the larger the review and build work becomes. DeployOpen plans, implements, hardens and documents self-hosted platforms inside your own cloud accounts, data centers or restricted networks, so the image, the allowlist and the evidence stay under your control.
Module review is the part that takes the most judgment, and it is where we ask most questions. For each package we look at what it can reach on the host, whether it makes outbound network calls, which native dependencies it compiles, how it is maintained, and whether it can be pinned to a version you have tested. The output is a decision record per module that your security and platform teams can approve or reject. Ask any partner, including DeployOpen, to show how the allowlist maps to the exact module names, how new versions get re-reviewed, and who signs off. DeployOpen does not hold vendor partnerships or certifications for n8n, so confirm any vendor-related questions directly with the n8n documentation and your own environment.
Support after handover is optional and sold as a retainer. Retainer work typically covers rebuilding the runner image when n8n or a module is upgraded, reviewing new module requests, and re-running staging tests before changes reach production. Ask for the retainer's response expectations in writing, and confirm which upgrade events trigger a rebuild in your environment. Your own team should keep ownership of the allowlist and the approval process, since those decisions carry the security cost of every module you add.

