When to reach for it
- Tools execute sensitive actions.
- Agents require varying access levels.
- Compliance or auditability is relevant.
Each tool carries the smallest permission set that lets it work.
Each tool is provisioned with the minimal permissions its use requires, scoped per agent, task, or run — so the credential a tool call carries, not merely which tools exist, bounds what a compromised or misdirected call can reach.
In practiceA document-processing agent is provisioned with read-only S3 access for the specific input bucket, so even if it calls a delete method the IAM scope denies the action.
Without itWithout scoped permissions, a compromised or misdirected tool call can reach systems it never needed, amplifying a single prompt injection into a broad data breach. See the anti-pattern →
A tool call carries a credential, and the credential is cut to the task. What the call can reach is decided by the system that checks the credential, not by the prompt.
1 · Before the run
2 · On every call
| Call | Scope check | Result |
|---|---|---|
| Read an invoice from the inbox | Read on the inbox: in scope | Allowed |
| Write the extracted data to processed | Write on processed: in scope | Allowed |
| Delete the inbox, after the hidden text | Delete: not in scope | Denied |
| Read a file from the HR folder | Another folder: not in scope | Denied |
def scoped_storage_tool(agent, task):
credential = issue_credential( # short-lived, cut to this task
principal=agent.id,
allow=[("read", f"invoices-inbox/{task.month}/*"),
("write", f"invoices-processed/{task.month}/*")],
ttl_minutes=15,
)
def storage(action: str, path: str, body: bytes | None = None):
try:
return storage_api(action, path, body, credential=credential)
except AccessDenied as denied:
# the storage system decided, not the prompt
return f"Denied: {denied}"
return storage # the model gets the function, never the credentialWhen to reach for it
When it backfires
Every time a task fails on a permission boundary, the easy fix is to broaden the scope. After three quarters every tool runs with admin and the original principle is gone.
Countermeasure
Treat permission widening as an architectural change, not a bug fix. Require a reviewer when a scope grows; record the justification in the audit trail.
The agent is instructed not to call the delete method, but the token it holds still permits it. A prompt injection ignores the instruction and the platform happily executes the call.
Countermeasure
Enforce scope at the credential / IAM layer so the action is denied at the boundary; never treat a prompt instruction as a security control.
EU law
Duties from EU law that this pattern helps meet, or that land on it. A reading aid, not legal advice.
An engineer's reading aid, not legal advice. The legal texts and their interpretation are authoritative.
Keep going
Search patterns, frameworks, and pages.