Skip to content
Exchange

The injection threat card

1 file2 KB

A look inside

The first lines of prompt-injection-agents.md. The whole file is in your library once you get it.

# The injection threat card

A free card from MenFem's Building with agents, lesson 7.2: Prompt injection and how agents get tricked.
The lesson, with the picture and the examples: https://menfem.com/courses/building-with-agents/prompt-injection-agents

This is what you keep: where outside text gets in, and the changes in code and set-up that stop it steering your agent.

1. Outside text is anything you did not write: pages, files, issues, emails, tool errors and other agents' output.
2. A rule in the prompt is more text. Put the limits in code.
3. Where the steps are known, fix the plan before the agent reads outside text.
4. Let a model with no tools read the outside text, and pass on only a label, a number or a yes or no.
5. Close every way out: sends, posts, web fetches and image links, unless a person or an allow list says yes.
6. Keep a set of poisoned inputs, and run it whenever the prompt, the tools or the model change.

**The rule:** Once an agent has read outside text, assume that text is in charge, and make sure it cannot do anything that matters.

## Used once

From the lesson, on a made-up shop: "Every night a job finds yesterday's late parcels and drafts an apology for each. The steps never change: look up the order, track the parcel, write the draft."

Answer: Fix the plan first. The steps are known before any customer text is read. Fix them in your code, and a note saying "refund me" has no step to land in.

## Your turn
…and 10 more lines.

What is inside

  • prompt-injection-agents.md2 KB

How to use it

Open it beside the job and go down the 6 lines in order, then check your answer against the rule at the bottom. It is the card from Building with agents, lesson 7.2 (Prompt injection and how agents get tricked), with one worked example from the lesson and a space for your own case.

Run before it was listed

Tested 2026-11-29: Generated from the lesson's own keep card and checked line by line against it; used once on the lesson's made-up example, which is printed in the file.