Choose your depth. Learn at your own pace.
Understand it
Prompt injection tries to make an AI system follow instructions supplied through a source that should not control it. A webpage, document or tool result may include text aimed at changing the assistant’s behavior rather than answering the user’s question.
Imagine asking Cedar’s assistant to summarize a guide. The guide contains an unrelated instruction to disclose private information. The user authorized a summary, not that new action. The distinction is about trust and authority, not merely unusual wording.
Under the hood
Direct injection enters through a user-facing input; indirect injection arrives through retrieved or externally supplied content. Text boundaries and instruction hierarchy help, but a language model does not provide the same separation as a conventional parameterized interpreter.
Defenses must also constrain outputs and effects. Keep secrets out of unnecessary context, validate tool arguments, restrict destinations and enforce permissions independently. A retrieval pipeline or a content filter alone does not eliminate the risk.
Practitioner perspective
Evaluate the actual system: what untrusted content it consumes, which secrets it can see and which actions its tools permit. Test attempts to cross those boundaries using synthetic data and authorized environments. Measure unauthorized outcomes, not just whether the model repeats a suspicious phrase.
Maintain provenance through retrieval, memory and tool results. Human approval is useful only when the person sees a concrete action and enough context to evaluate it. Do not claim a universal prevention guarantee from a prompt, classifier or guardrail.
Watch it work
A fictional, simplified model. Select a component to inspect it, or follow the steps in order.
AI demo production system
Reveal the supporting controls around a model call. This is one illustrative architecture, not a universal stack.
A prompt and model response demonstrate capability but not operational readiness.
How to use this example
Select Next step to read at your own pace, or Animate step to watch one exchange. Nothing advances until you choose.
What it means
Everyday example
State in this scenario
Inspect components & read every step
- User interface
The part of an application that people interact with.
Example: A text box receives a question before the application processes it.
- Policy gateway
A control point that checks requests against application rules.
Example: It may enforce access or usage limits before a model request proceeds.
- Model
An AI system that generates output from its input. Its answer can be wrong.
Example: It drafts an answer using the question and supplied context.
- Retrieval
The process of finding relevant information to supply as context.
Example: A system searches approved documents before asking a model to draft an answer.
- Tool executor
Application code that performs an allowed action requested through a tool interface.
Example: It checks permissions before making an approved calendar lookup.
- Audit + evaluation
Records and checks used to examine how a system behaved and how well it performed.
Example: A team reviews a failed tool call and evaluates whether answers meet its criteria.
Small demo
A prompt and model response demonstrate capability but not operational readiness.
- User interface Model: Prompt. The demo passes a prompt directly to a model.
- Model User interface: Response. A plausible response returns; production controls are not represented.
Controlled production flow
Independent policy checks protect data and tool actions; monitoring and evaluation support review.
- User interface Policy gateway: User request. Authenticate the caller and apply request limits.
- Policy gateway Retrieval: Authorized retrieval. Filter documents under the user’s access policy.
- Retrieval Model: Context + task. Retrieved text is evidence, not authority to change tool permissions.
- Model Policy gateway: Proposed action. The model proposes an action; policy decides whether it can execute.
- Policy gateway Tool executor: Approved action. A scoped executor performs only the approved action.
- Tool executor Audit + evaluation: Outcome + trace. Record outcomes with appropriate privacy and retention.
- Model User interface: Answer. Return the response; evaluation and monitoring remain ongoing.
Fictional teaching trace. One moving dot represents an exchange, not a measured network capture.
Open the detailed lesson walkthrough
Explore the system
User request
Summarize the fictional product guide.
Read every step without animation
Authority confusion
- User request. Summarize the fictional product guide.
- Untrusted document. The guide includes an unrelated instruction.
- Boundary lost. The application lets source content redirect the task.
- Unsafe proposal. An action outside the user’s intent is proposed.
The external document was given authority it did not have.
Constrained system
- User request. The same summary is requested.
- Source boundary. Retrieved content remains evidence for the summary.
- Tool policy. Any unrelated action fails independent authorization.
- Task preserved. The assistant can answer within the permitted scope.
Reduce influence and independently limit consequences.
Attack view
The fictional document asks for an action outside the user’s request. This simulation uses a symbolic instruction and no exfiltration destination or real secret.
Defender view
- Treat external content as data with limited authority.
- Constrain tool permissions and validate effects outside the model.
- Use synthetic adversarial tests and review failures as the application evolves.
Common mistakes
- RAG does not automatically prevent prompt injection.
- A filter detecting suspicious wording does not prove all unauthorized actions are blocked.
Check your understanding
Active recall: explain this idea in 30 seconds
Prompt injection tries to make an AI system follow instructions supplied through a source that should not control it. A webpage, document or tool result may include text aimed at changing the assistant’s behavior rather than answering the user’s question.
Now give an example and name one limitation. Revisit the explanation if you get stuck.
Primary sources
Original explanations informed by these specifications and official resources. Source versions and lesson review are separate from product updates.
- OWASP Prompt Injection (explicitly 2025 reference)
- NIST AI Risk Management Framework
- OWASP GenAI LLM Top 10 2026 announcement
Content reviewed 2026-09-10. Read the editorial policy.