Building with AILesson 63 of 80

Module 7 · Safety, security and the adversary

The channels that leak: how a model sends data out

In this lesson

  • 9 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 3 of 10 in this chapter

This chapter’s goalThreat-model an AI feature and defend it by architecture: name every channel by which untrusted text reaches the model and every channel by which its output reaches a privileged action or the outside world, restrict each with a control that does not depend on the model’s obedience, layer moderation and abstention with measured false-positive costs, and state plainly what a user must be told and what you cannot promise about a provider’s handling of their data.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
The exits teams close, and the ones they forgetUsually closedA send tool, gated behind a confirmation cardA fetch tool restricted to an allowlist ofhostsMarkdown rendered with raw HTML disabledRetrieval filtered by permission beforerankingUsually forgottenA markdown image the browser loads on render,with data in its query stringA summary written into a field that anotheruser reads laterAn error message that includes the renderedpromptA trace viewer readable by more people thanthe conversations it recordsA report-a-problem button that attaches thewhole contextEach item on the right has appeared in a published attack on a real product. The exercise ismechanical: for every place the model’s context is written, ask who can read that place. An exit youfilter still leaks; only an exit you close does not.
Each item on the right has appeared in a published attack on a real product. The exercise is mechanical: for every place the model's context is written, ask who can read that place. An exit you filter still leaks; only an exit you close does not.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

An exit is anything the model writes that leaves

The previous lesson said an injection needs an exit. This lesson lists the exits, because most teams can name one and are surprised by the other four. Each has been used in a published attack against a real product.

Images and links in rendered output

The model writes markdown. Your interface renders it. If it renders an image tag, the browser fetches the image URL the moment the message appears, and that URL can be https://attacker.example/log?d= followed by whatever the model was persuaded to put there: the user’s previous messages, the contents of a retrieved document, an API key that was in the context. No click needed. The request carries the data in the query string, and the attacker reads their server logs.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Python, from Zero, for AI exam.

Stuck on something?Ask Sayali, your AI tutor

How to cite: Addaly (2026) ‘The channels that leak: how a model sends data out’, in Building with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/building-with-ai/the-channels-that-leak (Accessed: 27 November 2026).