Question presented to candidate: "What is prompt injection? Explain the difference between direct and indirect injection, why it is so hard to fix, and how you would defend an assistant that reads users' email and can send messages on their behalf."
What a strong answer should cover:
- The root cause: a model receives instructions and data in the same stream of tokens, so any text it reads can try to act as an instruction; there is no equivalent of a parameterised SQL query
- Direct injection (the user types it, overlapping with jailbreaks) versus indirect injection (planted in a web page, email, document or tool result the app fetches), and why indirect is the dangerous one for agents
- Probabilistic, prompt-level defences and their limits: role separation and instruction hierarchy, spotlighting (delimiting, datamarking, encoding), injection classifiers; attackers can break naive delimiters
- Deterministic, architectural defences that hold even when the model is fooled: least-privilege tools, policy checks on tool calls, human approval for outward or irreversible actions, egress control, and designs such as the dual-LLM pattern or CaMeL
- The "lethal trifecta" framing (private data, untrusted content, an exfiltration channel): remove or gate one leg
- Testing: injection cases in the eval set and red-team runs, because no single layer is complete
Code / implementation expected: Optional โ wrapping untrusted content safely, or a policy gate that holds risky tool calls once untrusted content is in context.