n8n Security Hardening: A Production Checklist

n8n security hardening checklist: environment variables, reverse proxy and TLS, API key scopes, credentials, disabled nodes and task runner isolation.

Executive Summary: An n8n instance holds credentials for many of your other systems, so a weak instance is a weak point for all of them. This checklist covers n8n security hardening in the order I apply it: network exposure, identity and access, credential protection, code isolation, outbound request controls, webhook authentication and audit. Each item names the setting or practice involved and explains the risk it addresses, so you can decide what fits your environment.

Most security reviews of automation tools focus on the wrong question. They ask whether the platform is secure. The better question is what an attacker gets if they reach it. For n8n, the answer is usually a lot: API keys for your CRM, tokens for your cloud provider, database passwords and the ability to run code.

In fact, that concentration of access is what makes n8n useful, and also what makes n8n security hardening worth doing properly. I run DevOps, CI/CD and alerting workflows on my own instance, which means it holds deploy credentials. That changes how you think about every setting below.

This checklist assumes the production setup from self-hosting n8n with Docker and PostgreSQL. The official n8n security documentation covers each control in more depth.

Why n8n Security Hardening Starts with a Threat Model

Before changing settings, it helps to name what you are defending against. For most teams, three threats cover the majority of real risk. First, an outsider reaching the editor or API through an exposed login page. Second, an insider or compromised account using workflow edit rights to read credentials or run code. Third, untrusted input, from webhooks, chat or AI agents, steering a workflow into doing something harmful.

Each section below maps to one or more of these threats. Network and identity controls address outsiders. Credential protection and code isolation limit what an insider can do. Outbound controls and webhook authentication handle untrusted input. As a result, n8n security hardening becomes a set of deliberate answers rather than a list of switches.

The weighting also depends on who uses the instance. A single-user instance with no public editor faces mostly the third threat. In contrast, a shared team instance faces all three, and identity controls deserve more attention. Decide which applies to you, then work through the checklist with that in mind.

1. Reduce Network Exposure

The first layer of n8n security hardening is simply limiting who can reach the instance.

  • Never expose port 5678 directly. Put a reverse proxy with TLS in front of n8n, and bind n8n itself to a private network.
  • Separate the editor from webhooks. Webhooks must be reachable by external services. The editor and API usually need not be. Restrict editor paths to a VPN, an office range or an identity-aware proxy.
  • Keep Redis and PostgreSQL private. Neither should ever have a public address. Require passwords on both, even inside a private network.
  • Enforce HTTPS cookies. Keep N8N_SECURE_COOKIE at its default of true, so session cookies never travel over plain HTTP.

Splitting editor and webhook access is the single most effective change on this list. Most attacks on self-hosted tools start with a login page or an exposed API, and this removes both from the internet.

2. Control Identity and Access

For n8n security hardening at the identity layer, make sure only the right people can sign in, and that each person can do only what they need.

  • Use SSO where available. SAML or OIDC ties n8n access to your identity provider, so leaving the company removes access automatically.
  • Require two-factor authentication. For accounts without SSO, enable 2FA for every user, especially owners and admins.
  • Use projects and roles. Group workflows and credentials by team, and grant editor rights only where needed. A marketing workflow should not share a project with deploy credentials.
  • Disable the public API if unused. Set N8N_PUBLIC_API_DISABLED=true. If you do use it, scope API keys narrowly and rotate them.

My article on OAuth and OIDC for backend engineers explains the protocols behind SSO, which helps when you configure the identity provider side.

3. Protect Credentials and the Encryption Key

n8n encrypts every stored credential with N8N_ENCRYPTION_KEY. Anyone with the database and the key can decrypt everything, so the two must never sit together.

  • Set the key explicitly and store it in a secrets manager, not in the Compose file or the data volume.
  • Keep backups encrypted and stored away from the key.
  • Use external secrets on plans that support them, so n8n reads credentials from a vault such as HashiCorp Vault or AWS Secrets Manager instead of storing them.
  • Prefer least-privilege credentials. A token that can only post to one channel is far less dangerous than an admin token.

In practice, the last point matters most. My deploy workflows use tokens scoped to the single action they perform, not a general admin key. If the instance were ever compromised, the blast radius stays small. For broader patterns, see my guide to secrets management for backend systems.

4. Isolate Code Execution

The Code node runs user-written JavaScript and Python. Without isolation, anyone who can edit a workflow could try to read files, environment variables or the database. n8n 2.0 tightened the defaults considerably, but production instances should go further.

  • Run task runners in external mode, in their own container, so code runs outside the n8n process.
  • Block environment access in nodes. Set N8N_BLOCK_ENV_ACCESS_IN_NODE=true explicitly, so expressions and Code nodes cannot read server secrets.
  • Restrict file access. Keep N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES enabled and use N8N_RESTRICT_FILE_ACCESS_TO to limit file nodes to specific folders.
  • Block risky nodes. Use NODES_EXCLUDE to remove nodes you do not need. Since 2.0, Execute Command and Local File Trigger are disabled by default; keep it that way unless you have a strong reason.

These controls follow the same principle as sandboxing tools for AI agents, which I cover in tool sandboxing and permissions: assume code may misbehave, and limit what it can reach.

5. Control Outbound Requests

Workflows make HTTP requests, often to URLs built from user input. That creates a classic risk called server-side request forgery, or SSRF. An attacker supplies an internal address, and your n8n instance fetches it on their behalf, reaching services that were never meant to be public.

Since version 2.12.0, released in March 2026, n8n includes SSRF protection. Set N8N_SSRF_PROTECTION_ENABLED=true, and workflow nodes are blocked from private, loopback, link-local and reserved address ranges by default. If a workflow legitimately needs an internal service, allow that specific host or range with N8N_SSRF_ALLOWED_HOSTNAMES or N8N_SSRF_ALLOWED_IP_RANGES.

Therefore, turn this on early, before workflows start depending on internal access. Adding allowlist entries one at a time is far easier than discovering, later, that dozens of workflows call internal services. The SSRF protection guide lists the default blocked ranges. For background on the attack, the OWASP SSRF overview is a good primer.

6. Authenticate Every Webhook

Similarly, a public webhook without authentication lets anyone who finds the URL trigger your workflow. Random-looking paths are not authentication; URLs leak through logs, browser history and screenshots.

  • Use header or basic authentication on the Webhook node for internal callers.
  • Verify signatures for providers that sign requests, such as GitHub and Stripe, by checking the HMAC in a Code node before any processing.
  • For chat-driven workflows, check the sender against an allowlist as the first step.
  • Validate payload shape and reject anything unexpected early.

My CI/CD workflows receive GitHub events, so every request is checked against GitHub’s signature before anything else runs. The webhook node guide covers these patterns in detail.

7. Audit, Log and Keep Current

Finally, n8n security hardening is not a one-time task. Configuration drifts, new workflows appear and new vulnerabilities are found.

  • Run the built-in audit. The n8n audit command reports risky nodes, unused credentials, abandoned workflows and instance settings worth reviewing.
  • Stream logs. Send n8n and proxy logs to a central store, so you can investigate after the fact. My post on centralizing server logs describes a lightweight approach.
  • Patch promptly. Subscribe to n8n’s security advisories and upgrade quickly when a fix lands. Pin versions, but do not let them go stale.
  • Review access quarterly. Remove departed users, unused API keys and credentials no workflow references.

The Checklist at a Glance

Area Key action
Network Proxy with TLS; editor private; Redis and PostgreSQL private
Identity SSO or 2FA; projects and roles; public API off if unused
Credentials Explicit key in a secrets manager; least-privilege tokens
Code External runners; env access blocked; risky nodes excluded
Outbound SSRF protection on, with narrow allowlists
Webhooks Authentication or signature checks on every endpoint
Operations Regular audits, central logs, prompt upgrades

Frequently Asked Questions

Is self-hosted n8n secure?

It can be very secure, but security depends on your configuration. n8n provides the controls; n8n security hardening is the work of turning them on and keeping them current.

Does n8n protect against SSRF?

Yes, from version 2.12.0. Enable it with N8N_SSRF_PROTECTION_ENABLED=true, then allowlist any internal hosts your workflows genuinely need.

What happens if I lose the n8n encryption key?

Stored credentials become unreadable, and you must re-enter every one. Back up the key separately from the database.

Security Proportional to Access

An automation platform is only as safe as the access it holds. Because n8n connects to so much, it deserves the same care as any production system with admin rights. Work through this n8n security hardening checklist in order, revisit it every quarter and treat each new credential as something that raises the stakes.

Last updated on 29 November 2026

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *