One Permission Policy for Every AI Agent Action: Allow, Hold or Block
In the last six labs, AI agents were tricked by a resume, a receipt image, a poisoned memory, another agent, a web page and their own made-up answers. Every time, the model proposed something bad and the app ran it. This lab gives one agent all of those powers: it reads pages, remembers things, sends email and updates accounts. Then it puts one permission policy between the model and every tool.…
In a recent lab, AI agents were manipulated using various methods such as a resume, receipt image, poisoned memory, another agent, a web page, and fabricated answers. Each time, the model proposed malicious actions and the app executed them without any restrictions. This lab introduced a single permission policy to control the interactions between the AI model and various tools.
The model would propose an action, and the code would decide whether to ALLOW, HOLD (requiring user approval), or BLOCK the action. The decision-making process involved four key questions: the identity of the user, the origin of the data (turn read), whether the action produced side effects, and the risk level of the tool being used.
The tools were categorized into four risk tiers: read, write, external, and account, each with its own set of rules. Data could only be sent to approved destinations, and the policy was implemented in code as follows:
```python
RISK = {
"fetch_page" : "read",
"remember" : "write",
"send_email" : "external",
"update_account_email" : "account"
}
def decide(tool, args, user, tainted):
risk = RISK.get(tool)
if risk is None:
return "BLOCK", "unknown tool"
if risk == "read":
return "ALLOW", "read only"
if risk == "account":
if args.get("customer") != user["name"]:
return "BLOCK", f"{user['name']} can't change {args.get('customer')}'s account"
return "HOLD", "account changes need the owner to confirm"
if risk == "external" and args.get("to") != user["email"]:
return "BLOCK", f"{args.get('to')} isn't an allowed recipient"
if tainted:
return "HOLD", "this turn read untrusted content"
return "ALLOW", "the user asked for it directly"
```
With this policy in place, even a poisoned page could no longer save a fake refund portal or extract order history, and users could not access another person's account. However, legitimate actions like saving preferences and emailing oneself were still allowed. To test the effectiveness of the policy, the lab encouraged users to clone the GitHub repository, install the necessary dependencies, run the vulnerable and fixed versions of the app, and compare the results.
The GitHub Actions workflow ensured that the tests were executed on every push and pull request. The lab concluded that placing one permission layer between the model and every tool is crucial for preventing malicious actions, even when the model proposes them.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to