Indirect Prompt Injection › Limitations and impact

Michael BrenndoerferDecember 2, 20267 min read
Language AI HandbookAll chapters
Part 61 of 67Agentic AI and Protocol Security
Chapter 466Indirect Prompt Injection › Limitations and impact
Reading section 11 of 14 · Limitations and impact · 7 minSection 11 of 14 · 7 min

Section 11 of 14 · 7 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

A deployment still needs to check that its enforcement boundary is on every path to the capability. In the notebook all paths are function calls that share the same authorization predicate. In other designs a renderer, cache, or follow-up request can have its own boundary. Also, the code assumes catalog fields were already available in the declared type. The room value could still be inaccurate. Solving that problem belongs with data validation and provenance.

A useful regression test checks an authorized source with a benign mark, an authorized clear source, and a source with withdrawn permission. Compare the reason codes and chosen fields. For the authorization property, verify the denies across all content policies. For the usefulness property, check that the chosen fields still answer the user's original question. The two tests can disagree without either test being wrong.

What this exercise leaves to the application

The policy example is an in-memory decision function, so it represents a local snapshot of permissions. It does not represent a distributed transaction that checks authorization and delivers a result at the same instant. When a deployment needs a strong revocation semantics across services, the team has to choose where authority is checked and how older results are invalidated or rechecked. Client-side display alone cannot retroactively change what was disclosed. Write requirements in terms of future reads, future displays, and prior disclosures so each can have the right treatment.

Similarly, we choose the room from an existing field. A deployed catalog may use broad text or third-party records that lack suitable fields. There the application must decide whether to avoid a model interpretation, extract information with a bounded result format and validate it elsewhere, or require a different source. A narrower result schema can check that the application receives a field in the expected shape. Whether that field corresponds to a valid room will still depend on its source and the check used to validate it.

There is no measurement here of an actual system's rate of unsafe behavior. The data sets are hand-selected and the program has minimal branching and no learned component. That is valuable for regression because all expected outcomes are inspectable. To learn about a deployed workflow you would need end-to-end assurance about all real entry points and independent measurements that use representative authorized and benign cases. The limited experiment makes it easier to explain how a decision changed before moving to deployment-specific tests.

When a content policy applies unexpectedly to an ordinary user, the product should have a bounded way to handle it. In a library, a maintainer can inspect whether a guide was presented as data, whether the room field exists, and whether the reader was allowed to use it. They do not need the application to grant broad permissions to resolve that issue. This is another reason to distinguish resource authorization, evidence use, and support workflows in the threat model. An appeal or request for correction can go to an authorized human owner with enough context to decide.

One final check connects all the cases. For a supported task, write down the data that must arrive, the current permission that must hold, and the ways a fixture can vary. Check both the desired values and the behaviors under different permission states. Where interpretation is uncertain, write the uncertainty into the view or the final response instead of presenting a plausible unsupported location.

Replay the permission and mark axes independently

We can write all expected outcomes for one known row as a small table. The first axis is whether the current source identifier is visible. The second is which of the two fixture marks the row carries. The remaining dimension is the selected view strategy. With two visibility states, two marks and three strategies, the product contains twelve cases. This calculation applies to this selected row and these two-state inputs. It does not count all possible production inputs or claim to establish coverage of the application's entry points.

Use this table as a check on code structure. A source that is outside the current authorization should lead to denial across all strategies and marks. Once authorized, rejecting or narrowing the view changes how much evidence survives. These are two stages of one decision, with different invariants. We can vary the screening input by making a second copy of our one fixture row. This requires no new source text and fires no side effects.

PythonIn [20]
CollapseExpand
from dataclasses import replace
from itertools import product

replay_grid = {}
for eligible, mark, strategy in product((False, True), ContentMark, Strategy):
    replay_row = replace(example_row, mark=mark)
    permissions = all_visible if eligible else withdrawn
    replay_grid[eligible, mark, strategy] = evaluate_row(
        replay_row, permissions, strategy
    )
assert len(replay_grid) == 2 * len(ContentMark) * len(Strategy)

Check the six denied rows first. Every row in that half of the table should pair the same denial reason with an empty view. Then examine the eligible half. The minimum policy preserves the room for both marks. The restrict policy keeps a title only for the clear mark. The reject policy omits the instruction-like row and retains the two fields for the clear mark. Reviewing the entire table for the declared row protects against a change that accidentally moves the marker branch ahead of the authorization test.

PythonIn [21]
CollapseExpand
denied_result = (Decision.DENY_ACCESS, {})
for mark, strategy in product(ContentMark, Strategy):
    assert replay_grid[False, mark, strategy] == denied_result

clear_view = (Decision.ROOM_AND_TITLE, {"room": "E2", "title": "Visitor guide"})
room_view = (Decision.ROOM_ONLY, {"room": "E2"})
assert (
    replay_grid[True, ContentMark.CLEAR, Strategy.REJECT_FLAGGED] == clear_view
)
assert (
    replay_grid[True, ContentMark.CLEAR, Strategy.RESTRICT_FLAGGED]
    == clear_view
)
assert replay_grid[True, ContentMark.CLEAR, Strategy.MINIMIZE_ALL] == room_view
assert replay_grid[
    True, ContentMark.INSTRUCTION_LIKE, Strategy.REJECT_FLAGGED
] == (
    Decision.DROP_SOURCE,
    {},
)
assert (
    replay_grid[True, ContentMark.INSTRUCTION_LIKE, Strategy.RESTRICT_FLAGGED]
    == room_view
)
assert (
    replay_grid[True, ContentMark.INSTRUCTION_LIKE, Strategy.MINIMIZE_ALL]
    == room_view
)

The two permission states in this replay are conditions chosen by the test author. They are neither a claim about how often access is withdrawn nor a model of how quickly distributed permission changes arrive. Keep the recorded fixture input beside the expected outcome. If a deployment later adds pending approval as a third condition, define what the current user should see and which fields are allowed to reach the answer stage. Test the transition when the approval is granted, and test the case where it never arrives. The original decision space has only two permission conditions and remains useful for the tasks that share that contract.

The complete table gives one thing that the three-row worked example cannot. It checks that a row marked clear still loses access on the next evaluation, even when the policy would normally pass its broadest view. You can keep that rule as a regression test when you change eligibility calculation or add a fourth policy. Update the set of assertions and its expected denominator when the declared state space changes.

Permission and projection tests should use different fixture controls. To test identity-to-permission resolution, feed an application test a known reader identity and examine which source IDs it considers visible. To test the projection code, supply a permission set and an evidence row directly. An error resolving identity will not show up in a pure function that only receives a set. An error in view construction can show up there even if account permission assignment is correct.

You could also compare the six eligible cases by how much data arrives. Of the eligible cases, exactly one produces an empty view, three produce room only, and two produce both fields. The grouped counts describe the marked and clear variants of this one source. They should differ from the earlier figure, whose unit was across four sources with their original marks. Keep these experiments separate because repeating the same source at two labels is a different fixture arrangement.

PythonIn [22]
CollapseExpand
eligible_decisions = Counter(
    decision
    for (eligible, _, _), (decision, _) in replay_grid.items()
    if eligible
)
assert eligible_decisions == {
    Decision.DROP_SOURCE: 1,
    Decision.ROOM_ONLY: 3,
    Decision.ROOM_AND_TITLE: 2,
}

This outcome summary does not weight cases by how likely each state is. It counts each legal combination once as part of a table of expected behavior. That is useful for finding an untested branch. It does not tell you the proportion of deployed requests expected to produce any of those decisions.

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!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy