Prompt Injection Prevention: System Prompt Hardening, Instruction Hierarchy, and Privilege Separation

A technical guide to preventing prompt injection attacks in production LLMs — covering system prompt hardening, privilege-separated architectures, instruction hierarchy, and defense-in-depth patterns with vulnerable vs. hardened code examples.