Caloogy Article
中文

Agent Permission Design: Least Privilege + Human-in-the-Loop

Date
Sep 14, 2025
Series
Agent Sandbox
Reading
4 min
Topics
AiAgentPermissionsLeast privilege

The one-sentence version

Giving permissions to an AI Agent is the same problem as giving permissions to a new employee: give too little and they can't do the job; give too much and the cost of a mistake is massive. The practical approach involves three things: read-only by default, risk-based approval (automatic for low risk, human confirmation required for high risk), and never handing credentials to the model (the system uses them on the model's behalf). The biggest trap is confirmation fatigue: if you have to click "Allow" for every single step the Agent takes, you will soon start clicking without reading the content, rendering the approval process useless.

This article has three layers:

  1. Layer 1: The Intuition: Giving permissions to a new employee
  2. Layer 2: Real-World Use: Permission models for coding Agents, browser Agents, and enterprise Agents
  3. Layer 3: Risk classification of actions, approval interface design, short-lived credentials, and proxies

Layer 1: The Intuition

1.1 Giving permissions to a new employee

A reasonable company grants permissions to a new employee like this:

An Agent should be treated the same way. The difference is: Agents are much easier to trick (see "prompt injection") and can perform dozens of actions in a single second.

1.2 Three Principles

Principle Meaning
Read-only by default Can read but not modify; can query but not send
Risk-based approval Low risk is automatically allowed; high risk requires human confirmation
Never hand credentials to the model When the model says "I want to call this API," the system authenticates on its behalf; the model itself never sees the secret keys

Layer 2: Real-World Use


Layer 3: Principles and Engineering

3.1 Action Risk Classification

Level Characteristics Examples Handling
Low Read-only, local, reversible Reading files, searching code, running tests Automatically allow
Medium Writeable but reversible, small impact scope Modifying files in the working directory, local commits Automatically allow or batch confirmation
High External, irreversible, affects others Pushing code, sending emails, sending messages, calling paid APIs, deployment Step-by-step confirmation
Forbidden Extremely dangerous Deleting production databases, transferring funds, modifying permissions and security settings, reading private keys Capability not provided

Dimensions for judging risk: Reversibility, Impact scope (affects only self vs. affects others/public), Involvement of money or credentials, and Whether it sends data externally.

3.2 How to design the approval interface

A good confirmation interface should allow a user to understand the context within seconds:

Ways to avoid confirmation fatigue (see "Risk Control Scoring and Friction Design"):

3.3 The trap of command allowlists

"Allowing git commands" might seem safe, but git can push to any remote repository; "Allowing npm" means allowing npm install arbitrary packages, and an installation script can execute arbitrary code (see "Dependency Poisoning"). Allowlists should be as specific as possible down to subcommands and parameters, and must consider command combinations (pipes, &&, $(...)).

3.4 Credentials: Short-lived, narrow scope, and not in context

Approach Description
Short-lived credentials Validity measured in hours or even minutes; invalid once the task is finished
Narrow scope Can only access this specific repository or this specific calendar
Proxy injection Requests sent by the Agent go through a proxy that attaches the credentials; the Agent's environment variables and files contain no actual secrets (see "Credential Leakage and Context Window," Network Egress Control)
Revocable Users can see and revoke all authorizations in one place at any time

3.5 Log everything

Every action (including rejected ones) must be logged: time, action, parameters, and who approved it. This serves both as a basis for post-incident investigation and as a signal for detecting anomalies: if an Agent suddenly attempts a large number of rejected actions, it has likely been subject to prompt injection.


Summary

Layer Key points
Principles Read-only by default; risk-based approval; never hand credentials to the model
Classification Check reversibility, impact scope, involvement of money/credentials, and external exposure
Approval Display full parameters instead of summaries; avoid confirmation fatigue
Credentials Short-lived, narrow scope, proxy injection, revocable; log everything