JustujuAI, layer by layer.Open in the interactive map

Agent permissions & sandboxing

Giving an AI agent only the tools, data and network access a task needs, running it in a sandbox, and asking a person before risky actions.

Layer 8 · Agents · Run time · Pending expert review, written 2026-11-02

Read first: The agent loop, Prompt injection.

SimpleA plain explanation, one diagram and an analogy, with where the analogy breaks.

Guess first: when an agent is fooled, what limits the harm it can do?

Show the answerWhat it is allowed to do. A fooled agent can only use the powers it was given.

An AI agent acts for you: it runs code, edits files, sends messages. Whatever it can do, a tricked or broken agent can do too.

So give it only what the job needs. An agent fixing a typo does not need your email or the power to delete servers. This is least privilege.

Run it in a sandbox: a closed room with its own copy of the files and no open door to the internet unless the task needs one.

For risky steps, such as deleting, paying or sending data out, have it stop and ask a person. Keep a log so you can see what it did.

These limits work even when the agent is fooled, because they do not depend on the agent noticing the attack.

Taskwhat is it for?1Least toolsonly what itneeds2Sandboxfiles andnetwork fenced3Approvala person forrisky steps4Logevery action5
Layers of limits around an agent
  1. Task: what is it for?
  2. Least tools: only what it needs
  3. Sandbox: files and network fenced
  4. Approval: a person for risky steps
  5. Log: every action

Like: A temp worker given one office key, a visitor badge and a rule to ask before spending money.
Where it breaks: A temp works at human speed. An agent can try thousands of actions a minute, so limits must be enforced by the system, not trusted to its judgement.

How it worksAn interactive demo first, then the mechanism: light maths, pseudo-code and trade-offs.

Excessive agency is OWASP's name for the root problem: excessive functionality (tools a task doesn't need), excessive permissions (tools that can do more than needed) and excessive autonomy (high-impact actions without checks).

Scoping maps each task to a minimal tool set and credential scopes: read-only tokens, single-repository access, short expiry. Credentials live outside the agent's environment where possible, so injected instructions cannot read them.

Sandboxing runs the agent's code and tools in a container or virtual machine with a restricted filesystem and an egress allow-list. The sandbox boundary, not the model, decides what can leave.

Human approval gates irreversible or outbound actions, showing the exact command or message. Audit logs record every tool call with its inputs, for detection and for investigation afterwards.

Trade-offs

ResearchWhere the simple picture breaks, open problems and primary sources.

Real cases. An overscoped build token let an attacker commit a destructive prompt into a released AI coding extension; the vendor says it was malformed and did not run (AWS-2025-015); prompt injection made a CI coding agent read its own environment and leak an API key (Microsoft, 2026).

Design patterns. Plan-then-execute, action selectors and dual-model isolation give agents provable resistance to injected control flow at some cost in flexibility (Beurer-Kellner et al., 2025; CaMeL).

Threat models. OWASP's Top 10 for Agentic Applications (December 2025) ranks the main risks of agents that plan, use tools and keep memory, building on its earlier agentic threat list, which covers privilege compromise, tool misuse and memory poisoning (OWASP, 2025; OWASP, Feb 2025).

Open questions. How to infer the minimal permission set for open-ended tasks automatically, and how to design approvals people don't rubber-stamp.

Security on this concept: 2 threats Pending expert review

An agent in a build pipeline leaks its keys Pending expert review

Exposed
  • API keys and tokens in the agent's environment
  • Pull requests, issues and comments the agent reads
Attacks
  • Prompt injection in an issue or comment that makes the agent read and post its secrets
Real case
Research demonstration: Secret exposure through a coding agent's CI action (2026-06)
Controls
  • Keep long-lived secrets out of the agent's environment; use short-lived, scoped tokens
  • Don't let agents act on untrusted pull requests with write access
  • Block the agent from reading process and environment files
Owner
AppSec, with Platform/Cloud
Reference
LLM02:2026 Sensitive Information Disclosure
AML.T0083 Credentials from AI Agent Configuration
AML.T0051.001 Indirect

An agent with too much power is told to destroy Pending expert review

Exposed
  • Files, cloud resources and accounts an agent can change
  • Extensions and settings that tell the agent what to do
Attacks
  • Slipping a destructive instruction into an agent's prompt or extension
  • Abusing broad permissions to delete files or cloud resources
Real case
Incident: Wiper prompt planted in an AI coding extension release (AWS says it was malformed and did not run) (2025-07)
Controls
  • Least privilege: give the agent only the tools and scopes this task needs
  • Ask a person before deleting or changing anything important
  • Run agents in a sandbox with backups and an undo path
Owner
AppSec, with Platform/Cloud
Reference
LLM03:2026 Excessive Agency
AML.T0101 Data Destruction via AI Agent Tool Invocation

All layers in the security view

Examples as of 2026-11-10

Sources

  1. OWASP Top 10 for LLM Applications: LLM06:2025 Excessive Agency (2025)
  2. OWASP Agentic AI: Threats and Mitigations (2025-02-17)
  3. Security Update for Amazon Q Developer Extension for Visual Studio Code (AWS-2025-015) (2025-07-23)
  4. Securing CI/CD in an agentic world: Claude Code GitHub action case (Microsoft Security Blog) (2026-06-05)
  5. Design Patterns for Securing LLM Agents against Prompt Injections (2025-06-10)
  6. Defeating Prompt Injections by Design (CaMeL) (2025-03-24)
  7. MITRE ATLAS data, release 2026.10 (the data behind atlas.mitre.org) (2026-10-28)
  8. OWASP Top 10 for Agentic Applications (2026 edition, published December 2025) (2025-12-09)
  9. Configure the sandboxed Bash tool (Claude Code Docs, Anthropic) (ongoing)
  10. Making Claude Code safer with sandboxing (Anthropic Engineering) (2025-10-20)
  11. Codex: Sandbox (OpenAI Developers) (ongoing)
  12. Codex: Agent approvals & security (OpenAI Developers) (ongoing)
  13. OWASP GenAI Security Project unveils the 2026 Top 10 for LLM Applications (OWASP) (2026-09-01)

More in Layer 8 · Agents