Saltar al contenido

Lección 22 · Hosting and Security

Security, Backups and Maintenance

Secure and maintain n8n: user access, node restrictions, the security audit, CLI exports and backups, upgrades, execution data privacy and the license basics.

An automation server holds keys to many other systems. If someone breaks into it, they may reach your email, customer database and cloud accounts. This lesson gives you a practical security and maintenance routine.

Protect access

  • Use HTTPS everywhere.
  • Turn on two-factor authentication for users, and give people only the role they need.
  • Remove accounts when people leave.
  • Do not expose the editor to the whole internet if you can use a VPN or access gateway.
  • Authenticate webhooks, forms and MCP endpoints.

Features such as single sign-on and some role controls depend on your plan.

Limit what workflows can do

Some nodes are powerful. Since 2.0, the Execute Command and Local File Trigger nodes are disabled by default, access to environment variables from the Code node is blocked, and file nodes are restricted to a specific folder by default. Keep these protections unless you have a strong reason. Self-hosters can block nodes with the NODES_EXCLUDE variable, and there are settings for SSRF protection to restrict which hosts workflows may reach.

Anyone who can edit workflows can potentially run code and use credentials. Treat edit permission as powerful. Review imported workflows, because a template from the internet can send your data elsewhere. Check each HTTP and Code node before running it.

Python Stand-in: review an imported workflow for risks

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Run a security audit

n8n can generate an audit report that looks at credentials, database use, file system access, nodes and instance settings:

Terminal
n8n audit

The audit is also available through the public API and an n8n node. It is a starting point, not a guarantee.

Data privacy

Execution history can store everything nodes saw, including personal data. Choose what to save for successful and failed runs, set pruning, and look at redaction options. Collect only what you need and follow the privacy laws that apply to you.

Backups

You need three things: the database, the encryption key, and any files or binary data your setup stores. The CLI can export workflows and credentials. With Docker, prefix commands with docker exec -u node -it <container>.

Terminal
# One file per workflow, good for version control
n8n export:workflow --backup --output=backups/latest/

# Credentials export (stays encrypted unless you ask otherwise)
n8n export:credentials --backup --output=backups/creds/

# Import later
n8n import:workflow --separate --input=backups/latest/

Never use the --decrypted flag casually. It writes secrets in plain text. If you must migrate that way, protect the file and delete it securely afterwards. Imports overwrite workflows or credentials with matching IDs.

Exports alone are not a full backup. Test a restore on a separate machine at a regular interval.

Version control and environments

Keep exported workflows in Git so you can see what changed; check that exports contain no secrets or pinned personal data. Use separate development and production instances. Some plans include built-in source control and environments features.

Upgrades

n8n releases often, with breaking changes in major versions. For example, 3.0 requires Docker for self-hosting and removed several old nodes. A safe routine:

  1. Read the release notes and breaking-changes page.
  2. Run the Migration Report and fix flagged workflows.
  3. Back up the database and key.
  4. Upgrade a staging copy and test.
  5. Upgrade production, then watch executions.

Also plan for security patches: read vendor advisories and apply fixes promptly.

JS Stand-in: find backups that are too old

Press Run (or Ctrl + Enter) to see the console output here.

No output.

An encryption key rarely changes, so judge its backup by whether it is current and restorable, not only by age.

License basics

n8n's self-hosted code uses the Sustainable Use License, described by n8n as "fair-code", not an open source license in the OSI sense. In short, according to n8n's documentation, internal business use is allowed, while selling a service whose value comes mainly from n8n (for example, hosting it for paying customers or white-labeling it) is restricted. Some enterprise features have a separate license, and Cloud has its own terms. This is a summary, not legal advice. Read the current license, and ask n8n or a lawyer if your case is unclear.

A monthly routine

Put a recurring task in your calendar. Review the list of users and remove old accounts. Look for credentials that nobody uses and remove them at both ends, in n8n and at the provider. Unpublish workflows you no longer need. Read new release notes and security advisories, test a restore, and check disk space and execution pruning. Also write down whom to call, how to unpublish a misbehaving workflow quickly and how to revoke its keys.

Practice

Imagine that a teammate's laptop is stolen while they are signed in to your n8n instance. Write the first five actions you would take, in order. Typical answers include disabling the account, ending its sessions, reviewing recent changes and executions, rotating credentials the person could use and checking for new webhooks or published workflows. Then check whether you could really do each step today: do you know where the logs are, and who can revoke each key? Close any gap you find before you need it.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. Why is permission to edit workflows sensitive?

    Workflows can act with the credentials attached to them.
  2. 2. What is risky about the --decrypted export flag?

    The output contains readable secrets.
  3. 3. What should come before a major upgrade?

    This reduces the risk of breaking production.

Summary

  • Secure access, restrict powerful nodes and review imported workflows.
  • Use the audit, and control how much execution data you keep.
  • Back up the database and key, and practice restores.
  • Upgrade carefully and check the license for your use case.

Next: Project: Lead Intake Pipeline

Tu progreso se guarda en este navegador. No necesitas una cuenta.