Indirect Prompt Injection › Monitoring and the residual-risk view
Language AI HandbookAll chapters For a defensive test, pick a legitimate task and vary one input at a time. The guide example varies permission with the mark, source, and strategy held fixed. The strategy comparison varies the strategy with the inputs and permission fixed. That separation makes it possible to attribute a changed decision to the variable you changed.
For a change review, record the policy version, decision code, and provenance for the operator who needs to investigate a discrepancy. Establish what can be stored and for how long. Source content and authorization state can be sensitive, so the example shows aggregate decision counts and holds the fixture data in memory.
PythonIn [19]Expand
from collections import Counter
decisions_by_reason = Counter(decision.value for decision, _ in before + after)
assert decisions_by_reason == {
"drop source": 1,
"room only": 2,
"deny access": 3,
}
print(dict(decisions_by_reason))ConsoleOut [19]Expand
{'drop source': 1, 'room only': 2, 'deny access': 3}Use decision logs to ask a bounded question
The examples above produce small summaries of policy decisions. A product may record similar reason codes to answer operational questions. An increase in dropping a marked source could follow a policy update, a changed mix of guides, or greater volume. Without comparing a consistent denominator and version, an increased count alone gives little guidance. Separate this sort of usage signal from an incident finding. A maintainer needs enough detail to trace whether people could still complete authorized tasks and whether unexplained state changes occurred.
If an authorized task fails, the support team may need to know whether the source was unavailable, its access was denied, its content was marked, or the renderer could not answer. Give operators a way to identify that stage without requiring them to read every user's prompt or document. A policy version, scope identifier with appropriate minimization, and reason code can be enough to reproduce a similar case using artificial data. When reproducing authorization choices, include the intended state explicitly in the fixture. Avoid relying on reproduction against a live reader account.
Review operational metrics when moving the boundary. Suppose the application starts trimming views at retrieval rather than just before model input. It may count policy decisions earlier, before records are grouped for a response. The same reason codes then describe a different unit, perhaps source rows instead of displayed answers. A chart comparing before and after needs to document that change. For an incident review, make clear which events were observed at each boundary and which steps are functional assumptions.
The purpose of capturing different outcomes is to avoid turning a clear mark into a statement of trust. What a marker found describes a weak observation about source content. What the application permitted describes a decision made with current identity and scope. What showed in the UI describes a rendered result under the application's checks. The categories may appear as separate events with a common test-case ID. Compare them using a local replay where the test controls what changed. Keep incident data handled within the application's approved access boundary.
A practical regression exercise also includes an authorized source needed to complete the task after restriction. It checks that the user can still complete the task with the selected view. A security test that only checks restriction can reward removing all evidence. An availability test that ignores permission can reward retaining evidence past an access boundary. Require both properties for the route where the notebook describes a room lookup. Their separation gives operators a way to fix the failing mechanism without making the passing mechanism weaker.
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!