n8n security hardening

A self-hosted n8n instance holds credentials to your other systems, so its security depends on key handling, access control, webhook exposure and patching. This page sets out the decisions, build order and checks.

On this page

Why n8n security hardening starts with the credential store

A self-hosted n8n instance that runs automations often holds API tokens and database passwords for many systems, so the platform becomes a concentrated target. Hardening starts with four things: protecting the encryption key, securing the credential store that the key unlocks, controlling who can build or run workflows, and limiting what is reachable from the internet. Each of these is a decision your team owns, and none of them is settled by installing the software and accepting its defaults.

Defaults are not enough because n8n stores credentials in its database encrypted with a key held by the instance, so anyone who obtains both the database and the key can recover every secret in it. In queue mode, the main instance's encryption key must also be shared with every worker and webhook processor so they can read credentials, as described in the n8n queue mode docs. That means the key is copied to more hosts, more containers and more operator hands, and each copy widens the blast radius. Before you scale out, confirm where the key is stored, who can read it, how it is rotated and which processes receive it.

Your licensing position also shapes the review. The Sustainable Use License in the n8n LICENSE.md allows use or modification only for your own internal business purposes or for non-commercial use, and files with .ee in their name require a valid Enterprise License. Confirm with your legal or procurement team that your deployment fits those terms, and confirm which Enterprise-only controls, such as SSO, your plan includes before you design the access model around them.

Which n8n parts carry security risk

A self-hosted n8n deployment is only as secure as the pieces around its editor. The six components below hold credentials, execute code, accept inbound traffic or control who gets in, so each one needs a deliberate setting and an owner. Review them in this order before the first workflow goes live.

Main instance and editor

The main instance serves the visual editor, the REST API and, in simple setups, the webhook endpoints. Anyone who reaches the editor can read, edit and run workflows, so the editor should never sit on a public address without authentication in front of it. Check who can create accounts, who holds the owner role, and whether the API is reachable only where it needs to be.

Queue mode docs

Encryption key

n8n uses one encryption key to protect the credentials it stores. If the key is lost, saved credentials cannot be decrypted, and if it leaks, anyone with a copy of the database can read stored secrets. Store the key in a secrets manager, back it up separately from the database, and restrict who can read it. Confirm the key handling procedure before any workers are added.

PostgreSQL credential store

Workflow definitions, execution history and encrypted credentials live in PostgreSQL. A database dump, a read-only replica or a broad database role can expose far more than the editor shows. Use a dedicated database user with the privileges n8n needs, restrict network access to the n8n hosts, and set execution data retention so old run data does not accumulate.

Redis and worker or webhook processors

In queue mode, Redis carries execution jobs between the main instance and workers, and each worker or webhook processor must hold the same encryption key to read credentials. Every added node widens the set of hosts that can decrypt secrets. Limit Redis to the private network with authentication, and treat each worker host as a credential-holding system.

Queue mode docs

Code node and community nodes

The Code node runs custom JavaScript or Python, and community nodes add third-party packages to the instance. Both execute code with access to the data and credentials available to the workflow, so a malicious or careless package has a direct path to secrets. Decide who may author code, restrict installation of community nodes to reviewed packages, and pin versions through change control.

SAML or LDAP identity layer

On Business and Enterprise plans, SAML single sign-on and LDAP connect n8n accounts to your identity provider, so offboarding and role changes happen in one place. Without it, local accounts persist after staff leave. Confirm that SSO is enforced, that local login is restricted to break-glass accounts, and that project and credential access follows group membership.

SAML docs

Decisions that shape the hardening scope

This table compares the main architecture and access choices that determine which hardening controls you need and what each one costs to run. Read each row as a decision: when the option fits, and what it obliges your team to operate. The main takeaway is that queue mode and SAML both widen the set of secrets, keys and identity settings you must protect and review.

DecisionOption and when it fitsOperational cost to plan for
Deployment topologySingle main instance fits small teams with few workflows and one trust boundary for the editor and executions.One encryption key lives in one place, so backups and host access are the main exposure to review.
Deployment topologyQueue mode with workers fits heavy workloads that need separate execution capacity and a separate webhook path.The main instance's encryption key must be shared with every worker and webhook processor, so each extra node holds a copy of the key.
Code node accessRestricting Code node use to a small group fits organizations where arbitrary JavaScript or Python could reach hosts, files or internal APIs.Someone must review Code node changes and maintain a process for requesting exceptions.
Code node accessAllowing all builders to use Code nodes fits teams that already run code review and version control for workflows.Code nodes can run arbitrary logic, so review, logging and network egress limits must cover them.
Community nodesApproved-only community nodes fit regulated environments that need a documented list of third-party code.Each approved package needs a review record and an update process when it changes.
Community nodesAllowing community nodes fits teams that need specific integrations and accept third-party package risk.Packages run inside your instance, so track versions, maintainers and vulnerability notices.
Webhook exposurePublicly reachable webhooks fit inbound events from external SaaS providers that cannot reach a private network.Expose only the webhook path, terminate TLS at a reverse proxy, and rate limit and log requests.
Webhook exposureWebhooks behind a reverse proxy or private network fit internal systems and any flow that does not need public callers.Requires network design, DNS and proxy configuration, and a plan for partners who must reach the endpoint.
User managementLocal user accounts fit small teams where the number of accounts is low and offboarding is manual.Passwords, MFA and offboarding become your responsibility and must be reviewed regularly.
User managementSAML single sign-on fits organizations with central identity management and audit requirements.SAML is included on Business and Enterprise plans per the n8n pricing page, so confirm the plan cost before choosing it.

How to harden an n8n instance in order

This sequence moves a self-hosted n8n instance from a default install to one where credentials are protected, the editor and webhooks are exposed deliberately, risky nodes are constrained, and changes are logged and patched on a set cadence. Each step ends with a check you can run and record.

  1. Generate and back up the encryption key

    Before any credential is saved, generate the n8n encryption key and store it in a secrets manager or vault outside the n8n database and host, with access limited to the people who operate the instance. Keep a separate, access-controlled backup of the same key, because credentials stored in the database cannot be decrypted without it. Confirm the key is set through configuration rather than left to the default file location on the host, then save a test credential, restart the instance and run a workflow that uses it. Done means the credential decrypts after the restart and the key backup has been restored once to a scratch environment to prove it works.

  2. Restrict the editor to TLS behind a reverse proxy

    Place the n8n editor behind a reverse proxy that terminates TLS, so the editor is never served over plain HTTP and the instance itself is not bound directly to a public interface. Set the external URL and protocol settings so generated links and cookies use HTTPS, and restrict the editor to the networks where administrators work, such as a VPN or an allow list at the proxy. Check the result from outside the allowed network: an unauthenticated request to the editor address should be refused or redirected to sign-in, and a plain HTTP request should not reach the editor. Record the proxy configuration and the test output in the change record.

  3. Separate webhook exposure from the editor

    Decide which URLs must be reachable from the internet, usually only the webhook paths that external systems call, and route those through a separate hostname or proxy rule. Keep the editor and API paths on the internal route so they are not reachable from the public internet. If queue mode is in use, run dedicated webhook processors for the public path and keep the main instance off the public edge. Verify by calling a production webhook from outside, which should respond, and by requesting the editor path from the same outside location, which should fail. Confirm the result with the team that owns each external integration before you close the change.

  4. Set user roles and project access

    Create named accounts for each administrator and editor, remove or disable default or shared accounts, and assign roles so that only designated owners can manage users, credentials and instance settings. Group workflows and credentials into projects so a team sees only what it needs. If single sign-on is available on your plan, use it for sign-in rather than local passwords, and note that SSO and LDAP are listed as Business and Enterprise features on the pricing page. Check the result by signing in with a non-admin account and confirming it cannot open another team's project or view credentials it was not granted.

  5. Limit Code node and community node use

    Decide who may build workflows that run custom JavaScript or Python in Code nodes, and who may install community nodes, since both can run arbitrary logic on the host. Restrict these actions to a small group of reviewers, require review of Code node content before production use, and install community nodes only from a reviewed list pinned to specific versions. Confirm your version of n8n exposes the controls you need for this restriction in its current documentation, because availability of these settings can change between releases. Check the result by logging in as a standard user and attempting to install a community node or add a Code node, which should be refused for roles that lack the permission.

  6. Share the encryption key with workers and webhook processors

    In queue mode, the main instance's encryption key must be present on every worker and webhook processor so they can read credentials from the database. Distribute the same key through your secrets manager to each process, avoid copying it into images or repositories, and confirm each process starts with the same value. Test by triggering a workflow that uses a stored credential so that it runs on a worker, and confirm it completes successfully. Repeat the test after restarting one worker. Done means each worker and webhook processor decrypts credentials and the key distribution is recorded so that rotation can be planned later.

  7. Enable audit and execution logging

    Turn on the logging your team needs to answer who changed a workflow, who viewed or edited a credential, and what ran and when. Forward instance logs and proxy access logs to a central store that administrators cannot silently edit, and set retention to match your internal policy. Confirm which audit events your installed version records and which need a higher plan, since log streaming is listed as a Business and Enterprise feature on the pricing page. Check the result by making a test change to a workflow and a test credential, then finding both events in the central log store within the retention window.

  8. Set a patch cadence and test each update

    Agree a written cadence for applying n8n updates and security fixes, drawing on the release notes and n8n's semantic versioning, which ships minor releases frequently. Apply updates first in a staging copy with a restored database backup, run the critical workflows, and confirm credentials still decrypt before promoting to production. Keep a rollback path that includes the database backup and the matching encryption key. Done means the first staged update has been applied, the test workflows have passed, and the cadence, owner and rollback steps are documented for the operations team.

What drives hardening effort and how to contain it

This table lists the factors that expand an n8n hardening review and the containment step for each one. Read each row as a lever: the driver sets the size of the review, and the containment step is what you do before a partner or internal team starts so the work stays bounded. The main takeaway is that an inventory of environments, credentials, nodes and endpoints usually decides scope more than any single setting.

DriverWhy it changes effortHow to contain it
Number of environmentsEach environment (development, staging, production) has its own encryption key, database, credentials and webhook URLs that must be reviewed separately.Limit to production plus one staging copy where possible, and confirm in writing which environments are in scope.
Workflows and credentials to reviewEvery workflow can reference several credentials, and each credential's scope and owner must be checked against what the workflow actually needs.Export a workflow and credential inventory before review, flag unused or orphaned items, and retire them first.
Builders with Code node accessThe Code node runs custom JavaScript or Python, so each builder with access widens what must be reviewed for data exposure and host access.Restrict Code node use to a named short list of builders, and keep the rest on approved nodes.
Community node inventoryCommunity nodes are third-party packages, and each one needs a source, version and permission review before it can run against live credentials.Maintain a short approved node list and block installation of anything outside it.
Webhook endpointsEach public webhook is an internet-facing entry point that needs authentication, rate limits and a known caller list.Count webhooks by workflow, mark which ones must be public, and move internal triggers off public URLs.
Identity integrationChoosing local accounts, SAML or LDAP changes how admin access, offboarding and role assignment are tested. SAML and LDAP require the Business or Enterprise plan according to the pricing page.Decide the identity model before the review starts, and confirm with n8n whether your plan includes SSO and LDAP.
Compliance evidence requirementsAssessors often ask for access reviews, audit logs, backup records and change history, each of which must be produced and retained.Agree the evidence list with your compliance team first, then map each item to the system or log that produces it.
TLS and reverse proxy setupCertificates, proxy headers and internal traffic between main, worker and webhook processes each need checking.Document the current proxy and certificate layout so the review tests the real topology, not an assumed one.

How hardening differs by deployment model

On a single virtual machine, one n8n process serves the editor, triggers, webhooks and executions, and the encryption key sits on the same host as the application. Hardening centers on the reverse proxy in front of it, the host firewall and a controlled patch cycle covering the operating system, the Node.js runtime, PostgreSQL and n8n itself. With one process to secure, the key stays on one host and administrative access is limited to one boundary.

  • TLS termination at the proxy: Terminate HTTPS at a reverse proxy on the same VM or at a load balancer in front of it, and bind the n8n listener to localhost or a private interface so clients cannot reach it directly.
  • Key storage: Keep the encryption key in a file or secret store readable only by the service account, and back it up alongside the database. Lost keys leave stored credentials unrecoverable.
  • Webhook exposure: Publish only the webhook paths that external systems need, and keep the editor off the public internet or behind SSO and an allow list.
  • Patch delivery: Apply operating system, runtime, database and n8n updates in one maintenance window on the same host, and read the release notes before each minor upgrade.
  • Host controls: Restrict outbound traffic to the destinations workflows actually need, and keep host administration separate from n8n admin accounts.

Confirm that the editor is unreachable from the public internet, that a key backup restores into a test instance and that certificate renewal at the proxy is monitored.

Access control and secrets controls to set

These controls decide who can read credentials, what workflows can reach, and which entry points accept traffic. Each one is configured in n8n, your database, your network or your identity provider, so the operator must confirm how their version and deployment mode implement it before go-live.

Encryption key storage and rotation

The encryption key protects every credential n8n stores in the database. Keep it in a secrets manager or a restricted file outside the workflow editor, never in a shared repository or chat. Plan rotation before go-live, because changing the key without re-encrypting stored credentials breaks them. In queue mode, the same key must reach every worker and webhook processor, so confirm how it is distributed and who can read it.

Queue mode docs

Credential sharing limits by project

Shared credentials are visible to anyone with access to the project that holds them, so a credential shared broadly can be used by any workflow author in that project. Create separate projects for separate teams or data classes, and share only the credentials each project needs. Ask whether your edition supports project-level sharing and whether it is available on your plan before you design the structure.

Least-privilege roles for workflow editors

Editors who can build workflows can also expose credentials through an HTTP request or a Code node, so editing rights are effectively data access. Give most users viewer or executor rights and limit editor and owner roles to a small group. Confirm which roles your edition provides and whether role assignments come from your identity provider, which is only available on Business and Enterprise plans.

Restricting outbound network access

A workflow can call any host the server can reach, which makes it a path for data exfiltration if an editor is compromised or a prompt injection reaches an AI step. Place the n8n host in a network segment that allows only the APIs your workflows require, and deny metadata endpoints and internal admin interfaces. Test the allowlist against your real workflows, since blocked calls fail at runtime.

Protecting the Code node

The Code node runs custom JavaScript or Python with access to the workflow's data and, depending on configuration, the host environment. Decide who may create or edit Code nodes, review each one like application code, and confirm which environment variables and file paths it can read. Consider disabling it for roles that do not need it, and check the settings for your version before assuming it is off.

Securing webhook authentication

Webhook URLs are reachable by anyone who knows them, so an unauthenticated webhook can start workflows that write data or spend API quota. Require a header or basic authentication on every production webhook, rotate those secrets on a schedule, and expose only the webhook paths you need through the reverse proxy. Confirm which authentication options your version provides and test each one with a rejected request.

How to test that hardening holds and fails safely

Hardening is only proven when each control is tested from the position of the user or attacker it is meant to stop. Start by confirming that the editor and webhooks are reachable only on the paths you intended. From outside the network, request the editor address, the REST API and each webhook path, and confirm that only the reverse proxy endpoints you published respond, over TLS, with the expected authentication. Then test from inside your trusted network and from a host that should have no access at all. Record the results as a baseline so later changes can be compared against it. Ask your team or partner to name every route that is public, including any webhook used by a third-party service, because an unlisted path is the most common gap this test finds.

Next, test access to shared credentials with a user who has no rights to them. Log in as a member with a viewer or limited project role, open the workflow editor, and try to view, export, copy or reference a credential owned by another project. Then run a workflow that uses that credential under the restricted account and confirm it is refused. Repeat with an admin account to confirm the expected access still works. For workers, set the shared encryption key on the main instance and on every worker and webhook processor, restart them, then run a test execution that needs a credential. It should succeed. Change the key on one worker in a staging copy, and confirm that execution fails with a clear decryption error rather than running with partial or blank data.

Finally, verify that failure is safe and that the record of activity is complete. A wrong or missing key should stop execution and must not expose credential values in error messages, logs or the editor. Confirm that failed runs are recorded and that alerts reach an operator. Check that logs capture successful and failed logins, password or role changes, workflow creation, edits, activation and deletion, and credential changes. Confirm where those logs go and how long they are kept, and check your own retention rules, since the platform's logging options depend on your edition and configuration. Retest after every upgrade, because a new minor release can change proxy handling, default settings or logging output, and a control that held last month may not hold now.

What to monitor, back up and patch after go-live

Hardening is only useful if it holds after go-live. The controls below watch for misuse, keep the data and the encryption key recoverable, keep the instance on supported releases, and record who decides what. Each one closes a gap that tends to reopen once the team moves on to the next project.

Monitor failed logins

Review failed sign-in attempts and unexpected account lockouts on the n8n login and any SSO path, and alert on bursts from one source. Repeated failures can indicate password guessing against local accounts, which matters most on the Community edition where SSO is not included. Confirm where n8n writes its authentication events and whether your log platform receives them.

Watch webhook error rates

Track the rate of failed or rejected webhook calls and the status codes they return. A sudden rise in 401 or 403 responses can point to someone probing public endpoints, while a spike in 500 errors can mean a broken workflow is exposing internal messages to callers. Set the baseline during the first weeks after go-live so that the normal level is known before any alert is trusted.

Review new community nodes

Record every community node installed, its publisher and version, and flag any installation that did not go through the approved list. Community nodes run third-party code inside your instance and can read the credentials that workflows use. Compare the installed set against the node approval list at each review, and remove anything no active workflow needs.

Audit credential changes

Log who created, edited, shared or deleted each credential, and review changes to credentials that connect to payment, HR or production systems. A credential swapped to a broader account can silently widen what a workflow can reach. Check the audit trail against the access matrix each month, and confirm which of these events your plan's log streaming can export.

Back up the database

Take regular backups of the PostgreSQL database, since it holds workflows, execution history and encrypted credentials. Test a restore into a separate environment on a schedule, because a backup that has never been restored is an assumption. Recovery without the matching encryption key will not decrypt stored credentials, so the database and key must be backed up on separate paths.

Store the encryption key separately

Keep the n8n encryption key in a secrets manager or sealed vault with its own access list, not in the same backup bucket or repository as the database. The key is shared with worker and webhook processors in queue mode, so every copy must be tracked. Record the key location, version and custodians, and rehearse a restore that uses only the separated key and database.

Back up configuration

Version-control the environment variables, reverse proxy rules, TLS certificate locations, Docker or Kubernetes manifests and queue settings that define the instance. Without them, a rebuild after an incident depends on memory and screenshots. Store the configuration in a repository with reviewed changes, and keep secrets out of it by referencing the vault.

Track release notes for security fixes

Subscribe to the n8n release notes and read each minor release for security fixes, since n8n ships minor releases roughly weekly. Apply security fixes first in a test environment that runs your real workflows, then promote them. Breaking major releases need a separate plan that checks each workflow, node and credential type before the upgrade window.

Minor release cadence
Weekly
n8n release notes

Document key custodians

Name the people who hold the encryption key, the database admin role, the admin accounts and the approval authority for new community nodes. Keep a written access matrix that lists which roles can see, edit and run each shared credential and project. Review both documents at each staff change, since an instance with no recorded owner tends to keep access that nobody remembers granting.

Questions teams ask before hardening n8n

Can our team harden self-hosted n8n in-house?

Yes, many teams can, provided they have someone who understands containers or servers, PostgreSQL, TLS and secrets management, and who can own the change over time. The hard part is rarely a single setting. It is deciding who may create credentials, which nodes are allowed, how the encryption key is stored and rotated, and how webhooks are exposed, then keeping those decisions in force as workflows grow. Teams without a security engineer or platform owner usually find that the review and the retest are the parts that slip. An outside partner can carry the first pass and the evidence, while your team keeps the operating controls.

What do we need to provide before hardening work starts?

Plan to provide four things before work starts:

  • Named owners for the platform, security decisions and workflow approvals
  • Access to the hosting environment, database, reverse proxy and secret store, under your change process
  • An inventory of workflows, the systems they touch, and the credentials they use
  • A list of community nodes and any Code node use in production

The inventory is the input that most shapes the work. Without it, the scope of credential access and node restrictions cannot be set. Confirm the exact access model and approval steps in the written scope.

What drives the effort of hardening n8n?

The main drivers are the number of workflows and credentials, how many teams build workflows, and how much custom code runs in Code nodes or community nodes. Other factors include whether n8n runs in queue mode with several workers, how many external systems webhooks reach, the state of your existing TLS and logging setup, and whether audit evidence must be produced for an assessment. Simple single-instance deployments with few builders take less review time than shared environments with many credentials. Ask any partner to show how each driver maps to a line in the written scope.

Do we need SSO to harden n8n well, and which plans include it?

SSO is not strictly required for hardening, but it is one of the strongest controls for managing who can sign in and when access ends. According to n8n's pricing page, SSO and LDAP are included only in the Business and Enterprise plans. n8n SAML single sign-on is available on those plans, with setup guides for Okta Workforce Identity and Azure AD. On the Community edition, you will need local account discipline, strong passwords, MFA at the proxy or identity layer where possible, and a documented joiner and leaver process. Confirm plan details with n8n before you rely on them.

How do Enterprise-only features change the hardening design?

They change which controls you can use and how you build for resilience. Multi-main setup, which runs several main instances for high availability, is restricted to Enterprise self-hosted deployments and is not available in the Community edition or n8n Cloud. Files with .ee in their name or directory require a valid n8n Enterprise License. If you do not plan to license those features, design the hardening around a single main instance, strict backups and a tested restore path. Also check the Sustainable Use License terms against how you use n8n internally and for any customer-facing work, and confirm the answer with n8n or counsel.

How often should we retest n8n security controls?

Retest after every material change, and on a regular schedule in between. Material changes include a minor or major version upgrade, a new community node, a new webhook, a change to the encryption key or database, and any new team that can build workflows. n8n ships minor releases roughly weekly and uses semantic versioning, so a fixed calendar cadence alone is not enough. Many teams pair a scheduled review with a retest after each upgrade window. DeployOpen offers ongoing testing as a retainer, and the frequency is agreed in the written scope.

Will hardening n8n make us compliant with an assessment?

No. Hardening produces controls and evidence, but only an independent auditor or certification body can issue an audit report, attestation or certification. Ask your assessor early which evidence they expect, such as access reviews, key handling records, audit logs and change records, then design the hardening work to produce it. DeployOpen prepares systems, controls and evidence for compliance assessments but does not issue audit reports or certifications.

How the trust boundaries fit together

The diagram starts with users reaching the n8n editor through a TLS reverse proxy, and external systems calling webhooks through a separate endpoint. Both paths land on the main instance, which hands executions through Redis to workers and reads and writes workflow data in PostgreSQL, where credentials are stored encrypted. The N8N_ENCRYPTION_KEY is shared with the workers and webhook processors, so anyone who can read that key can decrypt stored credentials. Check that the public boundary touches only the proxy and webhook endpoint, and that Redis and PostgreSQL stay on private networks.

Public traffic enters only through the proxy and webhook endpoint.

How DeployOpen scopes, hardens and hands over n8n security work

DeployOpen works on n8n security hardening inside your own infrastructure, starting from a written scope and ending with documented controls your team can run. Each step is agreed in writing before work starts, so the security review, changes and evidence match what you asked for.

How we scope

  • Inventory the n8n editions, hosts, databases and workers you run, and which features your plan includes.
  • Map where the encryption key lives and which processes, including workers and webhook processors, need it.
  • Agree in writing which hardening areas, test scope and evidence the engagement covers before work starts.

How we build

  • Apply changes to encryption key handling, credential sharing, Code and community node permissions and webhook exposure.
  • Configure TLS, access controls and audit logging in your environment, then test each change against the agreed scope.
  • Test the instance for exposed webhooks, weak access paths and misconfigured credentials, and retest after fixes.

How we hand over

  • Document the configuration, decisions and trade-offs so your engineers can see why each control is set as it is.
  • Deliver the findings report with fixes, retest results and a list of items your team should confirm with n8n or your auditors.
  • Walk your security and platform teams through patching steps and the audit log locations they will monitor.

How we support

  • Engagements are fixed-scope, and ongoing support, upgrades and continuous testing are available as retainers.
  • Retainers can cover reviewing n8n release notes and testing hardening settings again after upgrades.
  • Support scope is written down in advance, so your team knows what is covered after handover.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.