Analysis

Grasp - Building a Sandwich Defense

Page published

Coverage timeline

31 Aug 2026grasp.studyobserved

Single-source analysis — one report is available.

Why it matters

Indirect prompt injection lets hidden instructions in retrieved content hijack AI agents that traditional input filters cannot catch, so defenders need architectural patterns like the sandwich defense and moderation endpoints to harden RAG and agentic systems.

Grasp's lesson "Building a Sandwich Defense" is an educational walkthrough teaching how to defend LLM applications against indirect prompt injection, where malicious instructions are hidden in documents, webpages, or emails an agent retrieves. It introduces the "sandwich" prompt-engineering technique to isolate untrusted content and a moderation-endpoint architecture that inspects data flowing into and out of the model.