Templates / Prevent prompt injection attacks with a GPT-4O security defense system

Prevent prompt injection attacks with a GPT-4O security defense system

Ready for 3.0

by inderjeet Bhambra ✓ · 1,250 views · created 2025-08-15 · SecOps, Multimodal AI

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 19 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects OpenAI.

How it runs

Trigger: When an HTTP POST request hits its webhook URL.

  1. Extract Data (Edit Fields (Set)): sets 1 field: data
  2. Text violations (OpenAI): classify
  3. Merge: merges the data from its input branches
  4. Validate trueCategories (Code): runs custom JavaScript code
  5. Input Validation & Pattern Detection (OpenAI): uses OpenAI
  6. Check Success (If): checks a condition and branches into true / false
  7. Is REJECTED? (If): checks a condition and branches into true / false
  8. Respond to Webhook: sends the response back to the webhook caller
  9. Report Rejection (Edit Fields (Set)): sets 5 fields: message.input.threat.assessment, message.input.threat.classification, message.input.validation.flags…
  10. Content Sanitization & Neutralization (OpenAI): uses OpenAI

…plus 8 more steps. See the full node list below.

Services it uses

OpenAI

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (9)

From the author

AI Security Pipeline - Prompt Injection Defense System using GPT-4O Protect your AI workflows from prompt injection attacks, XSS attempts, and malicious content with this multi-layer security sanitization system. > Important: The n8n workflow template…

Excerpt from inderjeet Bhambra's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.