If you self-host n8n or run 24/7 AI agents wired to public webhooks, two separate headaches are converging in December 2026:
- 6 days until December 11, 2026 (
gpt-5/o3model cutoff): Hardcoded legacy model IDs inside exported n8nworkflow.jsonfiles, LangChain nodes, and agent proxies will start throwing 404/deprecation failures in production if you haven't audited your workflow JSONs yet. - Post-Black-October self-hosted agent hardening: Between
CVE-2026-21858("Ni8mare"),CVE-2025-68613,CVE-2026-1470,CVE-2026-145077(OpenClaw), and October's$740kLLMjacking wave on leaked workspace credentials, the defaultdocker run n8nio/n8nsetup with open webhooks and unconstrained LLM keys is an open wallet.
Here is the concrete, zero-fluff hardening baseline we now enforce across self-hosted n8n & agent stacks.
Step 1: Hardened Dockerfile Baseline (n8nio/n8n >= 2.1.4)
Pinning a patched image is step one, but disabling high-blast-radius nodes, blocking env/file reads inside expressions, and enforcing execution timeouts cuts off the most common post-compromise pivots:
FROM n8nio/n8n:2.1.4 # Block expression env-var leakage, local file reads, and shell RCE nodes ENV N8N_BLOCK_ENV_ACCESS_IN_NODE=true \ N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=true \ N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \ N8N_DIAGNOSTICS_ENABLED=false \ N8N_METRICS=false \ EXECUTIONS_TIMEOUT=300 \ EXECUTIONS_TIMEOUT_MAX=600 \ EXECUTIONS_DATA_PRUNE=true \ EXECUTIONS_DATA_MAX_AGE=168 \ NODES_EXCLUDE='["n8n-nodes-base.executeCommand","n8n-nodes-base.localFileTrigger","n8n-nodes-base.readWriteFile"]' # Bind n8n only to localhost behind Caddy/reverse-proxy (never 0.0.0.0:5678 directly) EXPOSE 5678 HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ CMD wget -qO- http://127.0.0.1:${N8N_PORT:-5678}/healthz || exit 1 Pair this with a startup entrypoint guard that refuses to boot unless N8N_ENCRYPTION_KEY is at least 32 characters (preventing silently weak or ephemeral credential encryption on container restarts), and bind port 5678 to 127.0.0.1:5678:5678 in docker-compose.yml behind a TLS reverse proxy that verifies webhook HMAC signatures and rate-limits bursts.
Step 2: Audit Your Workflows for Dec 11 gpt-5/o3 & Denial-of-Wallet Loops
Before December 11, run a quick local scan across your exported workflow.json files (or repo) to catch four things in one pass:
- Deprecated model IDs (
gpt-5,o3,o3-mini) that will break on Dec 11. - Unauthenticated
n8n-nodes-base.webhooktriggers (authentication: "none") connected directly to LLM nodes withoutmax_tokensor rate limiting. - Hardcoded API keys (
sk-proj-,sk-ant-,AIza,ghp_) stored in node parameters instead of encrypted n8n credentials. - Dangerous
executeCommand/readWriteFilenodes.
# Quick zero-dependency local audit across exported n8n workflow JSONs node -e ' const fs = require("fs"); for (const file of process.argv.slice(1)) { const wf = JSON.parse(fs.readFileSync(file, "utf8")); const raw = JSON.stringify(wf); const findings = []; if (/"model"\s*:\s*"(gpt-5|o3)(-preview|-mini)?"/i.test(raw)) findings.push("DEC-11 MODEL CUTOFF: hardcoded gpt-5/o3 model ID"); if (/(sk-proj-|sk-ant-|AIza[0-9A-Za-z_-]{20})/.test(raw)) findings.push("CRITICAL: plaintext API key inside workflow JSON"); for (const n of wf.nodes || []) { if (n.type === "n8n-nodes-base.webhook" && (!n.parameters?.authentication || n.parameters.authentication === "none")) findings.push(`UNAUTH WEBHOOK: ${n.name} (Denial-of-Wallet risk if wired to LLM)`); if (/executeCommand|readWriteFile/i.test(n.type || "")) findings.push(`HIGH-BLAST NODE: ${n.name} (${n.type})`); } console.log(file, "->", findings.length ? findings : ["PASS"]); } ' ./workflows/*.json Step 3: Put a Hard Daily USD Spend-Cap Proxy in Front of Agent Keys
Never hand a 24/7 autonomous agent a raw unlimited OpenAI/Anthropic key. Put a lightweight reverse proxy between the agent and upstream LLM APIs that:
- Clamps
max_tokensper request, - Tracks estimated spend in memory/Redis and hard-trips HTTP 429 at your daily USD ceiling (e.g.,
$15/day), - Enforces an allowlist of outbound hosts/MCP servers to stop SSRF and rug-pull tool exfiltration.
We open-sourced two minimal MIT Railway/Docker templates implementing these exact guardrails, plus a 100% browser-side workflow.json security scanner & self-hosting TCO router (Railway vs Hostinger vs Vultr vs Hetzner vs n8n Cloud vs Make.com):
- Free Client-Side Workflow Scanner & TCO Router (Zero Upload): https://stackbay.netlify.app
- Open-Source Hardened n8n Railway Template (MIT): https://github.com/spleyapp/n8n-hardened-railway
- Open-Source AI Spend-Cap Proxy Template (MIT): https://github.com/spleyapp/agent-costguard-railway
- All 9 Free Dev & Compliance Tools: https://spleyapp.github.io/
(Disclosure: the browser scanner, TCO router, and both Railway starter repos are completely free/MIT. We offer optional $39/$49/$99 production agency packs on StackBay with queue-mode Postgres+Redis compose, Caddy HMAC webhook shield, encrypted S3/R2 backups, and LiteLLM kill-switch configs.)

