Threat Modeling Compound AI Systems › Step 2: Draw trust boundaries
Language AI HandbookAll chapters Mark a boundary when responsibility or scope changes. A request entering the application crosses from reader-controlled inputs to application request handling. A catalog row returning from retrieval crosses into answer preparation. The rendered result crosses from the application back to the current reader session.
For each boundary, write the check in terms that can fail. At the retrieval return, check that there is a caller-visible record and select only viewable fields. At rendering, bind display to the current session and check that the reported location matches the selected record. If the record is unavailable, both designs can show an explicitly unavailable result. This keeps an unverified location out of the reply.
PythonIn [5]Expand
boundary_checks = {
"Reader → application": "Bind request to the authenticated reader",
"Application → retrieval service": "Check current record-read authorization",
"Retrieval service → application": "Accept the result for the authorized record",
"Application → answer model": "Project the approved response fields",
"Answer model → renderer": "Check that the proposed location matches the source",
"Renderer → reader": "Render to the current reader session",
}
assert len(boundary_checks) == 6One component can sit on both sides of different checks. The application owns the retrieval request and the model handoff, for instance. It makes a resource decision at the first boundary and an exposure decision at the second. Write them as separate controls so that passing one check never implies that the other happened.
If a team puts a label such as internal on an entire region of a diagram, ask what property the label signifies. A field can come from an authenticated service without carrying authority to propose a new operation. Likewise, a request from a verified account can still be rejected if the policy denies that particular read. These examples are easier to handle if the diagram says exactly which fact the crossing establishes. For the lookup boundary, establish authenticated identity and permission for the requested record. For the model boundary, establish which fields have been selected and that they are carried as evidence.
The value of a boundary drawing is that it can identify who takes the next decision. Imagine the team grants the renderer permission to consult the original catalog record to compare location values. Who owns that read? It can reuse the application's existing authorized record snapshot, or it can request a separate read under current authority. Reusing a snapshot avoids another lookup but ties the answer to the freshness and authorization rules for that snapshot. An additional read raises questions about how to handle changes between the two readings. Neither choice is present in the toy run. The worksheet should record what a deployed route does.
Use a table when drawing the system with colleagues who work on different components. For every row, identify the sending component, the receiving component, the field or operation, and the local decision about it. Then check that the selected branch makes sense when the record is missing and when the access check denies it. A review meeting that only follows rows in which every service succeeds can miss the route users see during outages.
The rendering check is an example of something structured enough to test without running the answer model. Supply a proposal object expected to pass and one expected to fail the semantic comparison, with no free-text instructions in either. For a real service, check the normal entry point separately so the semantic validator cannot be accidentally omitted by a formatting or retry path.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!