Indirect Prompt Injection › Three response strategies
Language AI HandbookAll chapters The three strategies share the caller's existing scope. They differ only in the view they construct after the access check succeeds.
- Reject marked omits marked evidence. A clear authorization result still leaves a flagged source unavailable to the answer.
- Restrict marked keeps the room field from a marked source. The response still needs to treat it as a reported location from that source.
- Minimize all passes only the room for every visible source. This makes the field projection independent of the screening mark and omits the display title even from clear evidence.
A field is useful only if it exists and means what the application expects. In this example the room is supplied from a typed catalog record. Our projection is an explicit selection from that record. Cropping a paragraph would produce a different interface and would still leave text open to model interpretation. A narrower view limits which values cross the boundary. Source correctness still needs a separate check.
PythonIn [9]Expand
def context_fields(row: Evidence, decision: Decision) -> dict[str, str]:
if decision is Decision.ROOM_ONLY:
return {"room": row.room}
if decision is Decision.ROOM_AND_TITLE:
return {"room": row.room, "title": row.title}
return {}PythonIn [10]Expand
def evaluate_row(row: Evidence, permission: frozenset[str], strategy: Strategy):
decision = decide(row, permission, strategy)
return decision, context_fields(row, decision)
assert evaluate_row(example_row, all_visible, Strategy.REJECT_FLAGGED) == (
Decision.DROP_SOURCE,
{},
)Check an empty permission set as well as an empty field projection. Both can leave the context empty. Their reason codes differ. In a deployment, this distinction can help maintainers tell an access decision from an evidence-selection decision without recording the raw record.
PythonIn [11]Expand
assert evaluate_row(example_row, all_visible, Strategy.RESTRICT_FLAGGED) == (
Decision.ROOM_ONLY,
{"room": "E2"},
)
assert evaluate_row(example_row, frozenset(), Strategy.RESTRICT_FLAGGED) == (
Decision.DENY_ACCESS,
{},
)Choose a view by required evidence
Projection works when the application knows which fields it needs. In this example the location inquiry requires the room. A separate question comparing near-identical guides might depend on titles and editions. A minimum-view policy that works for the first task can quietly remove data that the second task needs. Before you narrow the view, ask the team to write down the smallest evidence needed to deliver the current feature. Then test that the approved context still contains it.
The reject strategy makes one choice at the row level. It drops the whole row when the mark is instruction-like. That can be a sensible response when the needed facts cannot be obtained from the record under the chosen policy and better evidence is available. If the marked record is the only source, the workflow needs a careful unavailable or review behavior. Returning an empty answer without context leaves the reader guessing whether they lack access or the library has no result.
The restrict strategy makes a conditional choice at the field level. For marked rows our application takes a room code that it has independently modeled as a catalog field. This produces an answer view only because the field is present and its contents can be checked. When the only record field is an unstructured paragraph, conditional projection is a different problem. An application that asks a model to extract a location needs to assess the extracted value, its source, and its suitability for display. The limited dictionary in this chapter does not do that extraction.
Minimum view is a fixed selection. It helps reviewers verify a constant data contract for the example. A team can check that a response model receives room-only data in every authorized case, independent of one marker's behavior. The cost is that the application denies itself a convenient title even when it could legitimately use that information. A renderer can sometimes recover the title from its own validated view. That creates a separate application-to-renderer path that should still be controlled.
These policies illustrate three distinct choices rather than a ranking. In an application that only needs a room, both kinds of restricted views can deliver the required field for a marked authorized record. Another application might choose to drop the whole record when the desired evidence is unavailable in trusted fields. The example keeps access control fixed for all comparisons, so changing views cannot be interpreted as changing who may read the underlying record.
If you are responsible for a publication or training corpus, ask the application team where projection occurs relative to persistent copies. A minimal model request does not retroactively change a larger retrieval result retained by the application. The application might be able to project in storage or at its retrieval boundary if doing so still supports the user's task. Any extra data copy introduces a requirement to consider its intended audience and retention. Separate that observation from the question of how a model reacts to the fields already in its request.
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!