Security hardening for n8n

n8n · Expert · 13 min

n8n holds credentials to many systems; a compromised instance or a misled agent can do real damage.

An n8n instance holds keys to many of your systems. Treat it like a sensitive server.

Access

  • Use SSO (single sign-on with your company login, via SAML or OIDC) where available, and require two-factor authentication (2FA: a code from your phone besides the password).
  • Give people the lowest role they need, and use projects to limit who sees which credentials.

Instance settings (self-hosted)

  • Serve only over HTTPS, and keep the encryption key secret; replace (rotate) it if it is ever exposed.
  • Block nodes you don't need. n8n 2.x already disables Execute Command and Local File Trigger by default, restricts file nodes to one folder, and blocks environment-variable access from the Code node.
  • Harden task runners, which isolate Code node execution from n8n itself.
  • Enable SSRF protection: limit which hosts and internal network addresses nodes may call, so a workflow can't be tricked into probing your internal servers.
  • Disable the public API if unused, and consider execution data redaction so sensitive inputs don't sit in execution logs.
  • Run the built-in security audit, which reports risky settings, nodes and credentials.

Workflows: protect webhooks with authentication, and validate incoming data with If or Stop and Error nodes.

AI agents: text an agent reads (an email, a web page, a document) may contain instructions written to manipulate it, called prompt injection. Give agents only the tools they need, fix parameters instead of using $fromAI where possible, and put Human review on tools that send, change or delete.

Remember

  • SSO, 2FA and least-privilege roles protect access
  • Block unneeded nodes, harden task runners, enable SSRF protection, run audits
  • Treat agent inputs as untrusted: few tools, fixed parameters, human review

Watch out for

  • Re-enabling Execute Command on a shared instance, which lets any editor run commands on the server.

Check yourself

  1. An agent reads customer emails and has a "delete record" tool. What reduces the risk most?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: docs.n8n.io/deploy/host-n8n/configure-n8n/security/