Why external task runners matter for n8n Code node isolation
External task runners move Code node script execution out of the main n8n process, so a script written by a user runs in its own container instead of alongside the component that holds your credentials. If your instance stores real credentials and more than a handful of people can write Code node scripts, this separation is the first isolation decision to make. The Code node is one of n8n's most flexible nodes because it accepts custom JavaScript or Python, which is the reason it deserves a deliberate boundary rather than the default setup. This page is planned for infrastructure you control, so the runner placement, image choices and resource limits described below are decisions your team owns and can review.
By default, Code node scripts run inside the main n8n process, so a script has a path to the same runtime that holds the encryption key, the database connection and decrypted credentials used by other nodes. Anyone who can edit a workflow with a Code node can therefore write logic that reads what the process can read, which is a larger exposure than most teams assume when they first grant editor access. Teams usually need runners once the instance serves several editors, handles production credentials or runs in queue mode, where workers and the main instance both need to be hardened. Before you start, confirm which n8n version and edition your team runs and check the current runner documentation for supported settings, since the exact configuration keys depend on the release you deploy.
Start by listing every workflow owner who can add or edit a Code node, every credential type those workflows touch and every host where a script could run. That inventory tells you whether a sidecar runner is enough or whether you also need to separate runner placement in queue mode. Plan the runner image, user and filesystem settings as part of the same change, and record the decisions so your security and compliance reviewers can trace them later.
Which runner placement and configuration fits your instance
This table compares internal and external task runner modes, a sidecar per main instance against a shared runner pool, and runners beside queue mode workers against runners beside main instances. Read each row as a choice you make for one instance, then check the option against the n8n docs for your version before you commit.
| Option | When it fits | Latency and operations trade-off | What to confirm in the n8n docs |
|---|---|---|---|
| Internal task runner (Code node runs in the n8n process) | Small, single-main instances where no workflow edits Code node logic and the team accepts that scripts share the process with n8n | Lowest latency and simplest setup, but a script that misbehaves affects the main process and there is no separate container boundary | Whether internal mode is still the default for your version and what it means for Code node isolation |
| External runner as a sidecar beside each main instance | Single-main or multi-main deployments where each main needs its own isolated Code node execution | One runner to scale and monitor per main, with a clear failure boundary, but more containers to size and upgrade | Sidecar image tag, shared authentication token setup and the runner version that must match n8n |
| External runner pool shared across mains | Several main instances that need one managed set of runners and a single place to set timeouts and limits | Fewer containers to operate, but a shared pool can queue Code node work and a single pool failure affects every main | How runners register with mains, pool sizing guidance and whether pool members need network reach to each main |
| Runners beside queue mode workers | Queue mode deployments where Code node work runs in the worker pool, close to where executions happen | Keeps execution-time Code work near workers and scales with them, but each worker host must carry the runner and match the encryption key | Worker-side runner configuration and which node types the workers execute in your version |
| Runners beside main instances | Queue mode deployments where you want the main instance to own script execution and keep workers lean | Simpler network path to the main, but main hosts carry extra CPU and memory load and scale less freely | Whether Code node tasks are offloaded from mains in queue mode for your version and how the runner connects |
| Read-only root filesystem, non-root user and distroless runner image | Any instance that holds real credentials, regardless of placement | Small operational cost for writable volumes and health checks, and a smaller attack surface for scripts | Required writable paths, image variants and the runner image tag published for your n8n version |
How to deploy the n8nio/runners sidecar step by step
This sequence moves the n8n Code node out of the main process and into a separate runner that starts with only the privileges it needs. Each step ends with a check, so the team can confirm the runner executes Code tasks, enforces its limits and still resolves credentials before the instance goes to production.
Confirm the n8n version and runner mode
The platform team checks the version of the main instance against n8n's release notes and confirms that the Code node can run through external task runners in that version. Record the version and the execution mode you plan to use, because the runner image must match it. Check: the main instance reports the version you recorded, and a test workflow shows the Code node running in the mode you documented.
Pull the n8nio/runners image
The platform team pulls the n8nio/runners image into the container registry your organization uses, pinned to the tag that matches the main instance version. Compare the tag and digest with the values in your change record, and confirm that the image is distroless, meaning it ships without a shell or package manager that an attacker could use. Check: the image sits in your registry with a recorded digest, and a test container starts from it.
Set broker and authentication settings
Configure the broker address and the authentication secret that the main instance and the runner share, so the runner accepts tasks only from your main instance. Store the shared secret in your secret manager, limit network access to the broker port to the main instance and the runner, and keep the value out of workflow files and container images. Check: the runner logs show a successful connection to the main instance, and a runner started with a wrong secret is refused.
Run as non-root with a read-only filesystem
Start the runner container as a non-root user and mount its root filesystem as read-only. If the runner needs scratch space, give it one writable temporary directory and no other writable path. Confirm the exact user and mount options against the runner configuration for your version. Check: the process reports a non-zero user ID, and a test write to a path outside the temporary directory fails with a permission or read-only error.
Set task timeouts for Code tasks
Set a maximum runtime for each task so a runaway script cannot hold a runner indefinitely. Agree the value with the workflow owners, based on the longest legitimate Code node they expect to run, and confirm the setting name in n8n's documentation for your version. Check: a test Code node with an endless loop stops at the limit, the execution is marked as failed, and the runner accepts the next task.
Place runners in queue mode
In queue mode, the main instance handles triggers and webhooks and sends executions through Redis to workers that read and write workflow data in PostgreSQL. Attach the runner to the worker hosts that execute Code tasks, make sure every worker holds the main instance's encryption key as queue mode requires, and keep the broker reachable only from internal networks. Check: a Code node execution triggered through the queue completes, and the runner logs show that it handled the task.
Verify isolation and credential access
Run a short test set that a security engineer can repeat. Include a Code node that tries to read environment variables and files outside the runner, and a workflow that uses a stored credential. Save the results next to the configuration so later changes can be retested. Check: the environment and file reads are blocked or return nothing sensitive, the credential workflow still succeeds, and the results are recorded in the change record.
What the runner boundary protects and what it does not
The runner boundary separates two roles that a Code node otherwise shares: the main process, which holds the N8N_ENCRYPTION_KEY and database access, and the runner process, which executes the JavaScript or Python a user wrote. With an external runner, user scripts execute in a separate container, so a script that escapes its sandbox lands in a process that does not hold the key or the database connection. That is the control you are buying, and it only holds if the runner is deployed as its own container with a non-root user, a read-only filesystem and no volumes shared with the n8n containers. Confirm each of those settings in your own manifests instead of assuming the defaults match your intent.
Queue mode weakens that boundary in a way that is easy to miss. Every worker and webhook processor must receive the encryption key so it can decrypt credentials stored in PostgreSQL, so a worker compromised through a workflow can read the key and any credential it decrypts. If a runner runs inside a worker container, both share the same environment, and isolation protects little. Place runners in their own containers or pods, keep the key and configuration out of the runner, and consider a dedicated worker pool for workflows that run Code nodes. Ask your team to list every process that receives N8N_ENCRYPTION_KEY, because that list defines the real blast radius of a compromise.
Isolation reduces what a script can reach, but it does not decide what a script is allowed to do. A runner can still make outbound HTTP requests, so SSRF protection and egress rules remain necessary. Which modules a script may import and which environment variables it may read are separate controls, covered in the Code node restriction topic, and they must be set on the runner as well as the main instance. A script can also send credentials it legitimately receives to an external host, and no sandbox prevents that. Treat the runner as one layer alongside node policies, webhook authentication and a security audit, and test the combined setup before production.
How the main instance, workers and runners connect
The diagram starts at the main instance, which receives triggers and webhooks and places executions on a Redis queue. Webhook processors feed the same queue. Queue workers pick up jobs, read and write workflow data in PostgreSQL, and send Code node tasks to the n8nio/runners sidecar. The shaded boundary marks the runner, the component that should have the least access. The key path shows that the main instance's encryption key must also reach the workers and webhook processors so they can decrypt credentials. When you review your setup, check which containers can read that key and which can reach the runner.
Execution flow from main instance to runner, with the shared key path.
Container hardening controls that matter for runners
A task runner executes untrusted-by-design Code node scripts next to the n8n process that holds credentials, so the container around it is the last line of defense. The controls below limit what a script can change, reach and consume if it escapes its intended task.
Distroless runner images
A distroless image ships the Node.js runtime without a shell, package manager or debugging tools. An attacker who gets code execution in the Code node has far fewer utilities to download tools, pivot or persist. Confirm which base image your pinned n8nio/runners tag uses, that you pull it by digest from your own registry, and that your scanner accepts the image without unexpected OS packages. Ask the vendor which tags are maintained for your n8n version.
Non-root user
Running the runner as a non-root user means a script that escapes the Node.js sandbox still lacks root rights inside the container. Confirm the effective UID in the running pod or container, not just the image default, and check that the platform blocks overrides. Verify that the user cannot write to directories holding the n8n configuration, the encryption key mount or the runner's own code.
Read-only root filesystem
A read-only root filesystem stops a script from planting binaries, altering the runner's modules or leaving a payload that survives a restart. Mount only the paths the runner needs to write, such as a size-limited temporary volume, and keep them separate from credential material. Test with a workflow that writes to an unexpected path and confirm it fails, then confirm the runner still completes normal tasks.
Dropped Linux capabilities
Linux capabilities split root privileges into smaller grants, such as network administration or raw socket access. A Code node task needs none of them, so drop all capabilities and disallow privilege escalation. Verify this in the container spec, not only the image, and check your admission policy rejects pods that add capabilities back. Re-test after any runner version change, since the required set should stay empty.
Resource limits
CPU and memory limits protect the rest of the cluster and the n8n main instance from a script that loops, allocates large buffers or fills the disk. Set requests and limits based on the largest payloads your workflows process, and test them with a representative load. Pair limits with the runner task timeout so a stuck task ends predictably. Ask your platform team how out-of-memory kills are logged and alerted.
Network egress restrictions
A runner that can reach the internet, the database or internal admin APIs can exfiltrate data or probe services a Code node should never touch. Apply network policy so the runner talks only to the task broker it needs and nothing else by default. Confirm the policy is enforced by your CNI plugin, because an unenforced policy looks correct on paper. Test egress from inside a runner pod before go-live.
How to keep runners patched and in step with n8n releases
The runner image must match the n8n version it serves, and it must move in the same change window as the main instance. A runner that lags behind the main instance can fail to accept task requests or behave differently from the Code node the editor shows users, so treat the n8nio/runners sidecar as part of the n8n release, not as a separate component. Pin both images to explicit tags in your deployment manifests rather than to a floating tag, so that a restart or node replacement never pulls a runner that differs from the version your main instance and workers run. Before each upgrade, confirm the exact runner tag that corresponds to your target n8n version against the n8n documentation and release notes, and record that pairing in your change ticket.
Read the n8n release notes for every minor release you plan to adopt, and search them for entries that mention task runners, the Code node, environment access or module allowlists. Those changes can alter how your existing NODE_FUNCTION_ALLOW_BUILTIN and NODE_FUNCTION_ALLOW_EXTERNAL settings behave, so they belong in your upgrade checklist alongside the main instance changes. Stage the new pair first: deploy the target n8n version and the matching runner image to a non-production environment that holds a copy of your workflows and a representative set of Code node jobs, then run those jobs, confirm the expected outputs, check that blocked modules still fail, and confirm that the runner registers with the main instance. Only then promote the same tags to production.
Once the runner is in production, watch its health as a separate signal. Track whether the runner stays connected, how often Code node tasks time out, and how long tasks queue before a runner picks them up. A rise in timeouts after an upgrade is an early warning that the image, the allowlist or the workload has changed, and it should trigger rollback to the previous tag pair rather than a fix in place. Ask your platform team to confirm which metrics and logs your n8n version exposes for runners, since the names and availability depend on the release you run. Schedule the review of release notes as a recurring task, so that runner patches are reviewed on the same cadence as main instance patches.
Limits and what to confirm in your environment
External task runners depend on the n8n version, the image variant and how your platform treats writes to the filesystem. Each card below is a point to confirm against current n8n documentation and your own environment before you rely on the isolation design.
Runner mode support by version
Confirm which n8n release introduced external task runners as the supported path for the Code node, and whether your target version uses them by default or needs explicit configuration. Older instances may run Code node code in the main process, so an upgrade can change the trust boundary without any change to your workflows. Check the release notes for the version you plan to run, and record the default settings you inherit.
n8n release notesImage variant and architecture
Confirm that the runners image tag you choose matches your n8n version exactly and that it publishes for the CPU architecture of your nodes. Distroless variants omit a shell and package manager, which limits debugging inside the container but also limits what an attacker can use after a compromise. Ask n8n which tags are supported for your architecture before you pin a digest in your deployment manifests.
Read-only filesystem behavior
A read-only root filesystem is only workable if n8n and the runner write only to paths you mount explicitly, such as a writable temporary directory or a data volume. Confirm with your orchestrator how it applies read-only root settings, how it handles mounts with ownership for the non-root user, and whether any feature in your workflows writes files outside those paths. Test a full execution with binary data before promoting the change.
Licence coverage for your deployment
The Sustainable Use License governs internal business use, and files marked with .ee require an Enterprise License. Confirm that your deployment mode, including queue mode with a separate runner tier and any multi-instance setup, falls within the terms that apply to you, and that any feature you depend on for runner governance is included in your plan. Have your legal or procurement team review the license file against your planned topology.
n8n license termsTimeouts and resource limits
Confirm the timeout and memory settings that apply to runner tasks in your version, and how a task that exceeds them is reported to the main instance. Check whether limits you set on the runner container interact with n8n's own task settings, so a long-running script is stopped cleanly rather than leaving executions stuck. Load test with your heaviest Code node workflows to see how limits behave under concurrency.
Runner placement in queue mode
In queue mode, confirm which processes start runners, how many runners each worker or webhook processor gets, and whether the broker address and authentication token reach every component that needs them. Verify that the encryption key rules for workers still hold, since runners sit beside processes that can read credentials. Confirm this with the queue mode documentation and a staging topology that matches production.
Queue mode docsQuestions teams ask before isolating the Code node
What does isolating the n8n Code node with external task runners cost?
The cost is mostly the labor to design, build and verify the runner setup, plus the time your own team spends on it. There is no separate license fee for the runner sidecar in the sources we rely on, but you should confirm that against your n8n plan and edition before you buy. Cost rises with the number of instances, the number of environments that need the same controls, how many workflows depend on Code node features that the runner changes, and how much testing you require before production. Ask any partner for a fixed-scope quote that lists each environment, the workflows reviewed, the verification steps and the handover documents, so you can compare it with your own effort.
How long does a typical runner isolation rollout take?
No duration figure is supplied for this work, so treat any number you hear as unverified until it is tied to your environment. The main drivers are the deployment model (Docker, Kubernetes or a queue mode layout with workers), the number of instances, how many Code node workflows must be tested, and whether your change process needs staged approvals. A small single-instance setup with few Code nodes will move much faster than a queue mode estate with several worker pools. Ask for a timeline that breaks the work into build, staging test, production cutover and rollback steps, with dates tied to your change calendar.
What does the rollout need from our platform and security teams?
Platform engineers need to supply the container runtime or orchestration platform, image pull access, network paths between the main instance and the runner sidecar, and a place to run the runner in the same queue mode topology as your workers. Security teams need to approve the non-root user, read-only filesystem and the timeout and resource settings, and to confirm how the runner's logs and any secrets it receives are handled. Both teams should agree on who owns image updates, since the runner must track the n8n version. Ask the partner to document these dependencies in the scope before work starts.
Can our own staff isolate the Code node without a partner?
Yes, if your team already runs containers and has a working n8n deployment, the setup is within reach of a platform engineer who reads the runner documentation carefully. The harder part is verification: confirming that the runner starts with the expected user and filesystem limits, that timeouts stop runaway scripts, that existing Code node workflows still behave, and that the setup survives an upgrade. Teams with limited container or n8n experience often hire help for the design and test steps, then operate the result internally. Decide which parts you own before you start, and write down the test cases you will use to prove the isolation works.
How does runner isolation relate to Code node module restrictions?
Runner isolation controls where Code node scripts run and what the container around them can access, while module restrictions control which libraries and environment values a script may import or read. They address different risks, so most instances holding real credentials need both. A runner limits the blast radius of a script that escapes its intended behavior, but a script still inside the runner can import any module the runner allows unless you restrict it. Set the module and environment policies on the task runners themselves, then test that a blocked import fails as expected. Treat the two controls as one hardening change with a shared test plan.
What should we check in a quote before agreeing to the work?
A useful quote lists the environments in scope (development, staging and production, and each queue mode worker pool), the number of Code node workflows reviewed, the runner configuration decisions, the verification tests and their pass criteria, the upgrade and rollback steps, and the documentation you will receive. It should also state what the partner does not cover, such as changes to your identity provider, secret storage or network firewalls. Ask how the partner will handle n8n version changes after handover and whether ongoing support is a separate retainer. Compare quotes on the same written scope rather than on headline effort.
Does runner isolation help with licensing or compliance evidence?
Runner isolation is a technical control that supports your own security review, but it does not by itself satisfy a license or certify compliance. The n8n Sustainable Use License governs how you may use and modify n8n, and files with .ee in their name require a valid Enterprise License, so check the license terms before changing any code. For compliance, the runner settings, test results and change records become evidence you can give an auditor, while the auditor's own testing decides the outcome. Ask your partner to keep the configuration and test records in a form your compliance team can review.
How DeployOpen scopes and delivers runner isolation
DeployOpen scopes runner isolation as a fixed piece of work agreed in writing before any change is made to your n8n instance. The scope usually starts with an inventory: which workflows use the Code node, which credentials those workflows can reach, which hosts run the main instance, webhook processors and workers, and where the n8nio/runners sidecar would sit relative to each. From that inventory we agree the deliverables: the runner configuration, the image and user settings, the timeouts and resource limits, the module allowlists, and the network paths the runners need. A quote follows from that written scope, so the cost reflects the number of instances, the queue mode topology, and how many environments must be changed in sequence.
During delivery, DeployOpen plans and implements the sidecar inside your own infrastructure, whether that is a Docker host, a Kubernetes cluster or a restricted network you operate. We set the distroless image, the non-root user and the read-only filesystem, then confirm that the runner can reach the main instance but nothing else it does not need. Where you request it, our security testing team attempts to escape the Code node boundary, reads environment variables and files from a runner, and checks whether credentials leak into execution data. The output is a findings report with fixes and a retest. The configuration, test results and change records are documented in a form your compliance and security reviewers can read without a live walkthrough.
Ongoing work is optional. A retainer can cover n8n upgrades that change runner behavior, periodic retesting after configuration changes, and review of new Code node usage by workflow owners. Ask any partner, including DeployOpen, to state in the quote which items are one-time and which recur, who holds the infrastructure and access after handover, and what happens if an upgrade changes a runner setting. Confirm with your own security team which evidence they need, since DeployOpen prepares systems, controls and documentation for review but does not issue audit reports or certifications.

