# Prompt Injection via Untrusted Input - ID: javascript-prompt-injection - Severity: HIGH - CWE: Injection (CWE-74) - Languages: JavaScript, TypeScript - Frameworks: express, fastify ## Description Detects user input flowing directly into AI/LLM prompts without sanitization. ## Detection Message Untrusted input from {source} flows directly into AI prompt at {sink}. This allows an attacker to manipulate AI responses (prompt injection attack). ## Remediation Use system prompts and sanitize user input with length limits before including in prompts. ```javascript const sanitized = userInput.substring(0, 500); const messages = [ { role: 'system', content: 'Answer only about products.' }, { role: 'user', content: sanitized } ]; ``` Learn more: https://shoulder.dev/learn/javascript/cwe-74/prompt-injection ## Documentation [object Object] ## Related Rules - **AI Prompt Injection** [HIGH]: - **AI Prompt Injection** [HIGH]: