What drives the placement decision
Three questions determine where a defense belongs:
- Context: does the defense need application state, user intent, or data semantics? If so, it belongs in the application.
- Consistency: must the defense behave uniformly across teams? If so, it belongs at the proxy.
- Auditability: must the defense be reviewable? If so, it belongs at the proxy.
Classifying common defenses by where they are most effective
| Layer | Defenses | Placement rationale |
|---|---|---|
| Application layer | Prompt structure, privilege separation, and validation that depends on user intent and data context. | Depends on application state, user intent, or data semantics. |
| Proxy layer | Uniform filtering, tool-call policy, identity-based permissions, rate limits, and audit logging. | Must be uniform and reviewable across teams. |
| Shared controls | Tool-call authorization and least privilege. | The application supplies context and the proxy enforces policy. |
Limits of each layer
No single layer removes the risk. Application-layer controls depend on application context, while proxy-layer controls provide uniform, reviewable enforcement. Each covers what the other cannot, so the goal is layered reduction of likelihood and impact rather than elimination.
How indirect injection and tool calls shift control placement
Tool calls need both layers. The application supplies context, and the proxy enforces policy through tool-call policy, identity-based permissions, and logging. Tool-call authorization and least privilege are therefore shared controls rather than the responsibility of a single layer.
A decision framework for ownership and layering
Apply these steps to each defense in turn:
- Check whether the defense depends on application state, user intent, or data semantics. If it does, assign it to the application, as with prompt structure and context-aware validation.
- Check whether the defense must be uniform and reviewable across teams. If it does, assign it to the proxy, as with baseline filtering, tool-call policy, identity-based permissions, rate limits, and logging.
- Check whether the defense involves tool calls. If it does, split ownership: the application supplies context and the proxy enforces policy.
- Layer the resulting controls, and treat the outcome as a reduction in likelihood and impact rather than a removal of risk.
Application owns
Controls that need application state, user intent, or data semantics.
Proxy owns
Controls that must be uniform and reviewable across teams.
Criteria for evaluating proxy-layer runtime enforcement
- Policy expressiveness: can policies cover prompts, responses, and tool-call requests, and be scoped per agent, tool, or user?
- Detection efficacy: is it measured independently, and how are false positives tuned and escalated?
- Latency: is the added cost of inline inspection documented for prompts, responses, and tool calls?
- Audit logging: do logs record the decision, policy version, agent identity, and tool-call parameters, and can they be exported for review?
- Identity integration: does it work with agent identity and permission systems, including MCP-connected tools?
- Vendor claims: is each capability corroborated beyond marketing material before it informs the decision?