Best practiceRunning agents
Check every agent action against policy before it runs
OWASP ASI01OWASP ASI02OWASP ASI03
Instructions in a prompt are not access controls: Replit's agent deleted a production database during a code freeze it had been told about again and again, and a malicious GitHub issue got an agent to copy data from private repositories into a public pull request. A check in front of every tool call decides on the call itself, and OWASP's advice is to keep that check outside the agent, so corrupted planning cannot trigger harmful actions.
What to do
- Put a policy enforcement point in front of every tool call: it validates the intent and the arguments, enforces schemas and rate limits, and refuses what the policy does not allow.
- Authorize each call as the user the agent acts for, at the moment of the call, and verify every request on the server side; the scopes a token claims are not enough on their own.
- Write data-flow rules into the policy, such as private data never going to public places and destructive commands never reaching production.
- Keep the policy engine outside the agent, separate planning from execution, and re-verify each privileged step.