Implementing security boundaries around AI agents
Implementing security boundaries around AI agents connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding security boundaries around AI agents helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
An agent combines a model with tools, identity and the ability to progress through a task. Permissions and approvals need to constrain the actual operations performed, regardless of how convincingly the agent explains its plan.
Only the two mapped low-risk tools skip human review in this example. Medium, high, critical, and unmapped tools require it. This classification does not grant permission to run a tool; the execution component must still check the actor's authorisation and any required approval for the exact action.
Authenticate communicating agents and enforce the sender's permissions at the receiving service before executing a request. A valid message signature does not grant permission to perform the requested action.
Why it matters
Consider a realistic failure: an agent receives a general-purpose credential when its feature needs only read access to one collection.
A broad tool credential can turn an instruction-following failure into access to files, records or business actions. Persistent memory and delegated work can extend the effect beyond the original request or conversation.
Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.
How penetration testers check for it
Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.
- Map tools, identities and delegated capabilities.
- Compare proposed actions with submitted parameters and effects.
- Test untrusted inputs and changes to persistent state.
- Review cancellation, revocation and containment.
How to fix it
Use the appropriate maintained mechanisms and verify the result in the actual production configuration.
- AI Console Malicious Configuration: AI developer consoles can be compelled to consume data that contains instructions driving malicious changes to the underlying LLM configuration.
- Use separate tool sets for different trust levels (e.g., internal vs. user-facing agents).
- Use delimiters and clear boundaries between instructions and data.
- Consider using separate LLM calls to validate/summarize untrusted content.
- Separate users and trust levels in memory and messaging.
- Provide independent limits and shutdown mechanisms.
Human approval is useful only when the person can see and verify the consequential operation. A generic confirmation prompt is not a substitute for precise authority and trustworthy action binding.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Building frontend trust boundaries around untrusted content
- Implementing safe GraphQL schemas and resolver boundaries
- Preserving user identity across application service boundaries
Read about our methodology or contact pentested.com to discuss secure development and code review.