n8n Email Agent Prompt Injection: 60 Attacks, 0 Defenses That Worked A developer built a coffee-store support bot in n8n 1.123.84 running Qwen 1.8B via Ollama and tested it against 20 prompt injection payloads, each run three times. The naive workflow let 12 of 20 injections succeed, and adding standard XML-tag and defensive-instruction hardening made it worse at 13 of 20. Only moving all decision logic into deterministic Code nodes, leaving the LLM as a schema-validated field extractor, eliminated successful injections across all 60 runs. An n8n workflow that reads customer emails and routes them with an LLM is a common pattern. It is also a direct channel from untrusted input to your refund API. A developer tested this by building a coffee store support bot, then attacking it with 20 distinct prompt injection payloads, running each three times for statistical validity. The naive version let 12 of 20 injections succeed. Adding XML tags and defensive instructions the standard hardening advice increased successful attacks to 13 of 20. Only moving all decision logic into deterministic Code nodes brought the success rate to zero across 60 total runs. The workflow ran on n8n 1.123.84 with Qwen 1.8B in Ollama at temperature 0.2 with JSON mode enabled. The model choice was deliberate: small, cheap models are what people deploy on high-volume inboxes. Testing against GPT-4 would not reflect production economics. The fictional business Brewline, a D2C coffee gear store had a public policy in the system prompt: 7-day returns, shipping times, help center link. The naive version also included internal notes: an on-call phone number and a staff-only goodwill discount code. This mirrors real support prompts where context accumulates over time. The workflow structure: The attack surface is step 2. If the LLM decides an email is a refund request, the workflow executes the refund. The customer controls the email body, which becomes part of the prompt. The test set covered common injection patterns: Each payload was sent three times. The metric: did the workflow execute an unintended action refund, leak internal data, misclassify to trigger wrong automation ? The naive prompt had no injection defenses. It told the model to classify emails and extract fields, with the business context inline. Successful attacks: The most effective pattern was output format injection. The model expected JSON like {"type": "refund", "urgency": "high"} . Emails containing that exact structure, even wrapped in natural language, often passed through. The model treated the injected JSON as its own output. Delimiter attacks worked when the email contained