
Hardening a self-hosted n8n instance before it carries production data takes six changes from the defaults, each set out in n8n's own documentation: PostgreSQL in place of SQLite, a reverse proxy that terminates TLS, an encryption key you set and store, authentication on every webhook, community packages off until reviewed, and environment variables blocked from workflows. On top of those, run the stable release and patch it against n8n's security advisories. Single sign-on, external secret stores and log streaming to a SIEM come with n8n's paid editions.
Self-hosting keeps workflow logic, credentials and execution history on infrastructure you control, and it makes the setup your responsibility. n8n's production requirements say the quick starts "start with n8n's built-in SQLite database, which suits testing and small setups", and the n8n process on port 5678 serves the editor, the API and webhooks alike.
Self-hosted n8n uses SQLite unless you set DB_TYPE=postgresdb and the DB_POSTGRESDB_ variables, and n8n's production requirements say "n8n recommends PostgreSQL for production" and that it "doesn't support SQLite in queue mode, and doesn't recommend it for multi-user production use". When PostgreSQL runs on another host, give n8n the server's CA certificate and leave DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED at its default of true, so n8n refuses a connection that fails validation, as the database guide sets out. Queue mode, where Redis hands each run to separate workers, also needs PostgreSQL.
n8n encrypts every stored credential with the key in N8N_ENCRYPTION_KEY. Left unset, n8n uses a random key generated on first launch and saves it in its .n8n user folder, and n8n's backup guide warns that without that key "a restored database or encrypted credential export can't be decrypted". Run on your own key, stored securely and the same on every instance. The production checklist suggests openssl rand -hex 32 to generate it, and in queue mode the main instance and every worker need the same value. Any n8n variable can be read from a file by adding _FILE to its name, which keeps the key out of a compose file in a repository. From n8n 3.0, key rotation is on by default. Your instance key never changes, and n8n rotates the data encryption key beneath it; on n8n 2.x you turn rotation on with N8N_ENV_FEAT_ENCRYPTION_KEY_ROTATION=true.
The production requirements say: "Don't expose the n8n process directly to the internet. Put a reverse proxy or load balancer in front of it." Run n8n behind a reverse proxy or load balancer that terminates TLS, which n8n recommends over passing certificates into n8n itself, since the proxy can also renew them (Set up SSL). Behind the proxy, set N8N_PROTOCOL=https, the hostname in N8N_HOST, and N8N_PROXY_HOPS to the number of proxies in front of n8n. N8N_SECURE_COOKIE is already true by default and "Ensures that cookies are only sent over HTTPS", so leave it on.
A Webhook node with authentication set to None answers anyone who has its URL, and n8n's security audit lists such webhooks as unprotected. Give every webhook Basic, Header or JWT auth for outside callers, or n8n User Auth to limit callers to people signed in to the instance, as the Webhook node offers. The node's IP allowlist is a second filter only: n8n's advisory CVE-2025-68949 found that from version 1.36.0 to before 2.2.0 it used "partial string matching instead of exact IP comparison", so a caller outside the list could pass. If nobody calls n8n's public REST API, n8n recommends turning it off with N8N_PUBLIC_API_DISABLED=true.
Some built-in nodes run code on the host. Execute Command is blocked by default, and NODES_EXCLUDE stops n8n loading any node you list; n8n suggests Execute Command and Read/Write Files from Disk as a start (Block specific nodes). Community packages are on by default through N8N_COMMUNITY_PACKAGES_ENABLED; keep them off until reviewed, package by package. Environment variables are readable from expressions and the Code node unless they are blocked with N8N_BLOCK_ENV_ACCESS_IN_NODE set to true, which keeps secrets passed to the container away from workflow builders, and N8N_RESTRICT_FILE_ACCESS_TO limits file access to the folders you name (security variables).
Code node code runs in task runners. n8n's hardening guide puts them in external mode, as separate containers apart from the n8n process, on the distroless image, as the unprivileged nobody user and with a read-only root filesystem. From n8n 2.12.0, SSRF protection stops workflow requests to private, loopback and link-local addresses once you enable it, and n8n says your firewalls and security groups stay "your primary line of defense".
n8n publishes its security fixes as advisories on its GitHub repository, and its Docker guide names the stable version as the one "for production use", while the beta "may be unstable". Pin the image to a stable version number, so an upgrade happens when you choose it, after you have read the advisories since your last one. Advisory CVE-2026-21858, rated critical, shows what falling behind costs: from 1.65.0 to before 1.121.0, certain form-based workflows let "an unauthenticated remote attacker" reach files on the server, and until an instance was upgraded n8n's only stopgap was to "restrict or disable publicly accessible webhook and form endpoints".
Run n8n audit after every upgrade and every change to the settings above. Its instance report lists unprotected webhooks, missing security settings and whether the instance is outdated, and its nodes report lists the risky, community and custom nodes in use.
A self-hosted instance talks to n8n's servers by default: "It notifies users about available updates, workflow templates, and diagnostics." To stop all of it, n8n's isolation guide sets N8N_DIAGNOSTICS_ENABLED, N8N_VERSION_NOTIFICATIONS_ENABLED and N8N_TEMPLATES_ENABLED to false and leaves EXTERNAL_FRONTEND_HOOKS_URLS, N8N_DIAGNOSTICS_CONFIG_FRONTEND and N8N_DIAGNOSTICS_CONFIG_BACKEND empty.
n8n's production requirements allow for an air-gapped deployment "where workflows only call internal services". There, the n8n image comes from a registry inside your network, PostgreSQL and any queue run inside it, and workflows reach only your own systems and any model you host yourself. With version notifications off, someone on your team has to watch n8n's advisories, and community packages can come only from a registry you name in N8N_COMMUNITY_PACKAGES_REGISTRY, which n8n's nodes variables mark "license required".
Every person signs in with their own account: n8n 1.0 made user management mandatory and removed "BasicAuth and External JWT", as its migration guide records, so a shared owner login is the gap to close. Each user can turn on two-factor authentication with an authenticator app.
Which further controls you get depends on the self-hosted edition, as n8n's edition guide and pricing page set out.
| Community | Business | Enterprise | |
|---|---|---|---|
| Sign-in | n8n accounts, with two-factor authentication for each user | SAML single sign-on and LDAP | OIDC single sign-on as well, and two-factor authentication enforced across the instance |
| Roles | no projects | projects with project roles | custom roles |
| Secrets | credentials encrypted in n8n's database | credentials encrypted in n8n's database | external secret stores such as HashiCorp Vault or AWS Secrets Manager |
| Logs | n8n's own logging | n8n's own logging | log streaming to your SIEM, audit logging and execution data redaction |
Ovidius reviews, fixes and secures the n8n instance you already run, and builds new ones. We read every workflow, credential and setting, then rank what we find by risk and by cost, and you see the ranked findings before we change anything. A new build runs n8n in Docker on your own cloud, with Postgres and Redis workers, so executions and credentials stay with you. Where your security team asks for single sign-on, a vault and a SIEM, we deploy n8n Business or Enterprise in your cloud account, with the right plan chosen before you talk to n8n sales.
It encrypts every credential n8n stores in its database. If you do not set N8N_ENCRYPTION_KEY, n8n generates a random key on first launch and saves it in its .n8n user folder, and n8n's backup guide says a restored database cannot be decrypted without it. Set your own key, keep it in your secrets store and your backups, and give the main instance and every worker the same value.
n8n advises against it. Its production requirements recommend PostgreSQL for production, say SQLite is not supported in queue mode, and do not recommend SQLite for multi-user production use. SQLite is the default for self-hosted installs and suits testing and small setups, so switch to PostgreSQL by setting DB_TYPE=postgresdb before production data arrives.
Set authentication on every Webhook node: Basic, Header or JWT auth for outside services, or n8n User Auth for people signed in to your instance. Treat the IP allowlist as a second filter, because n8n's advisory CVE-2025-68949 found that it matched addresses by partial string before version 2.2.0. Running n8n audit lists any webhook left unprotected.
Yes. n8n's isolation guide sets N8N_DIAGNOSTICS_ENABLED, N8N_VERSION_NOTIFICATIONS_ENABLED and N8N_TEMPLATES_ENABLED to false and leaves its three diagnostics and hooks settings empty. That stops the update notices, workflow templates and diagnostics a self-hosted instance sends by default, so someone on your team then has to watch n8n's security advisories by hand.
No. On self-hosted n8n, SAML single sign-on and LDAP come with the Business and Enterprise editions, and OIDC single sign-on with Enterprise, according to n8n's edition guide and pricing page. On the Community edition each person signs in with their own n8n account and can turn on two-factor authentication with an authenticator app.
Ready to harden your n8n instance before production data reaches it?
Book a discovery call. A senior partner leads your workflow from the first call.