03Chapter 3 of 7
Free course9 min read

Give Aria the least access it needs.

The smaller the set of things an agent can touch, the smaller the damage when it makes a bad call. This chapter scopes Aria down: read tools apart from write tools, an allowlist of what it can reach, a hard cap on every refund, and credentials that are narrow and short-lived. Least privilege is the cheapest defense you will ever ship.


In the last chapter you saw the ways an agent like Aria gets taken advantage of: instructions hidden in the text it reads, permissions wider than the job, a refund issued when it should have paused. This chapter installs the first and cheapest defense against all of them. You give Aria the least access it needs to do its job and nothing more, and you cap every action it can take, so that even a bad decision can only reach so far. The word for this is least privilege, and it is the rule the whole rest of the course leans on.

03.0

Start from what Aria actually needs

Most agents are built the other way around. Someone wires Aria up to the store's systems, hands it a broad API key because that is the key sitting in the drawer, and moves on. Now Aria can read every order, edit every account, refund any card, cancel shipments, and export the whole customer list, because the key it was given can do all of that. Almost none of those powers are ever used. They just sit there, waiting for the one prompt-injected message or one confused decision that turns an unused power into an incident.

Least privilege flips the default. Instead of starting wide and hoping nothing goes wrong, you start from the job and grant only the powers that job requires. Aria handles three things: where is my order, what is on my account, and I would like a refund. So before you grant anything, it helps to lay the broad grant next to the short list of what the work actually needs.

A wide grant of many powers wired to Aria on the left, versus the short list of three powers the support job actually needs on the right.

Read that gap. The left side is everything the broad key can do; the right side is the handful of things the support job needs. The whole practice of least privilege is closing that gap, deciding deliberately which powers cross over to the right and refusing the rest. Everything else in this chapter is just how you do that closing carefully, one kind of access at a time.

Note
Least privilege is a security idea older than agents. It just says every part of a system should run with the fewest permissions it needs to function. What is new is that the part you are scoping down is a decision-maker reading untrusted text, so the cost of an over-broad grant is no longer theoretical. It is a refund or a leaked record.
03.1

Read tools and write tools are not the same risk

The first cut to make is between reading and writing. When Aria looks up order 4815 or opens J. Okafor's account record, it is reading. Nothing in the world changes. The worst case is that it sees something it should summarize but does not act on. When Aria issues a refund, it is writing. Money moves, and you cannot un-move it by apologizing. Treating those two as the same kind of access is how teams end up granting a write power to get a read job done.

So group Aria's tools by what they can change, and put a harder boundary around the writes. Reads can be relatively generous, because a read that goes wrong is recoverable. Writes should be few, named, and capped. The picture below sorts Aria's actual tools into the two groups, with the agent sitting between them.

Aria's tools, sorted by reads and writes
Read tools (recoverable)Aria (the agent)Write tools (capped)readreadwriteLook up orderLook up orderstatus + trackingstatus + trackingRead recordRead recordname, email, addressname, email, addressAriaAriareads, decides, actsreads, decides, actsIssue refundIssue refundup to $50 onlyup to $50 only
Reads on the left can be broad because a bad read is recoverable. Writes on the right are few and capped, because a bad write moves real money or deletes real data.

Notice how lopsided that is, and how it should be. Aria has two ways to read and exactly one way to write, and the single write is already wearing a cap. That asymmetry is the shape of a well-scoped agent. If you find yourself granting a write tool so the agent can technically read something, stop and find the read-only version of that tool instead. Almost every API has one.

✱ Field note
The fastest way to shrink a blast radius is to delete a write the agent never needed. A read it cannot misuse much; a write is the thing that ends up in the incident report. When in doubt about a tool, ask whether it changes anything in the world. If it does, it belongs in the small, capped group.
03.2

Allowlist the few things, do not blocklist the many

Once you have decided which tools Aria gets, you wire that decision in as an allowlist. An allowlist names the small set of things that are permitted and refuses everything else by default. Its opposite, a blocklist, tries to name the bad things and allow the rest, and it loses, because you can never finish writing down everything bad. With an allowlist, anything you did not explicitly think of is denied for free, which is exactly the behavior you want around money and data.

In practice this is a screen of toggles, or the config behind one. You turn on the few powers the job needs and leave everything else off. Watch what that looks like as the over-broad powers come off one at a time, and keep an eye on the meter on the right.

Every toggle you switched off is reach that a bad decision, or a cleverly worded message, can no longer turn into an action. The three powers left on are the allowlist. Notice the meter never had to know what attacks exist. It only had to count how few doors are open, because least privilege defends you without you predicting the specific thing that goes wrong.

Pro tip
Default the allowlist to empty and add powers back as the job proves it needs them. Starting from nothing and granting up is far safer than starting from everything and trying to remember what to take away, because a forgotten removal leaves a live power and a forgotten addition just files a support ticket.
03.3

Cap every action, not just the tool

Granting the refund tool is not the same as granting an unlimited refund. The tool is on the allowlist, but the allowlist alone would let Aria refund $5,000 as easily as $5. So the next layer of least privilege is a cap on the action itself. For Switchback the rule is simple and concrete: Aria may issue a refund up to $50 on its own. Anything over $50 stops and waits for the on-call human to approve. The cap is not a suggestion in the prompt; it is a number checked in code before the refund tool is ever called.

A refund amount is checked against the fifty dollar cap: at or under fifty Aria issues it directly, over fifty it pauses for the on-call human to approve.

The diagram is the whole policy in one fork. A refund of $50 or less flows straight through, because that is small enough that an occasional mistake is cheap to absorb. A refund over the cap, like a full $128 order, branches to a human instead of going out automatically. The point of the cap is not that $50 is a magic number. It is that you have decided in advance how much damage a single unattended Aria decision is allowed to do, and you enforced that number in code rather than trusting the model to remember it.

The refund cap, enforced in code
refund-policy.tsts
1// Checked in code BEFORE the refund tool runs — not left to the prompt.
2const REFUND_CAP_USD = 50;
3 
4function canRefund(amountUsd: number) {
5 if (amountUsd <= REFUND_CAP_USD) return { allow: true };
6 // Over the cap: hand off to the on-call human, do not issue.
7 return { allow: false, reason: 'over_cap', escalateTo: 'on_call' };
8}
In code, not the prompt
The check runs before the refund tool is ever called. A cap written into the prompt is a suggestion the model can be talked out of; this is a gate that runs no matter what Aria decided.
A named constant
The $50 cap is a named value, not a number buried inside an if. Finance can find it and change it in one place.
Under the cap: straight through
A refund of $50 or less returns allow:true and flows automatically. Small enough that an occasional mistake is cheap to absorb.
Over the cap: refuse with a reason
Anything larger is refused with a reason and an escalation target, so the audit trail records why it was blocked and who to hand it to, not just that it failed.
Watch out
A cap written only into the prompt is not a cap. The model will follow it most of the time and then, on the wrong day with the wrong message, it will not. The number has to live in code that runs before the tool, where no amount of persuasive text in the inbox can talk it out of the check.
03.4

Make the credentials narrow and short-lived

The tools, the allowlist, and the cap all assume Aria is the one calling them. But Aria reaches those systems with a credential, an API key or a token, and that credential is its own piece of the blast radius. A broad, never-expiring key is a standing invitation: if it leaks, or if Aria is talked into using it past its intent, it works just as well for the attacker as it did for you. Least privilege applies to the credential too, in two ways: make its scope narrow, and make its life short.

Narrow means the credential can only do the one job. For Aria's inbox access you do not hand it a token that can read, send, and delete mail. You request gmail.readonly, a scope that can read messages and nothing else, so even a fully hijacked Aria cannot send mail from the company address or empty the inbox. Short-lived means the credential is issued fresh, expires quickly, and is replaced rather than left lying around. A token that lives for ten minutes is a far smaller prize than one that lives forever.

Aria requests a narrow gmail.readonly scope, a short-lived token is issued, Aria reads the inbox, and the token expires soon after.

Walk the flow left to right. Aria asks only for the narrow scope it needs, a short-lived token is minted for exactly that scope, Aria does its read, and the token expires on its own a few minutes later. Nothing in that chain is a key that an attacker could pick up tomorrow and still use. The credential is small in what it can do and small in how long it can do it, which is the same idea as the allowlist and the cap, applied to the thing Aria authenticates with.

Critical
Never give an agent a long-lived, broadly-scoped credential because it is convenient. That single key usually turns out to be the worst part of the blast radius, since it works everywhere and never expires. If a credential can read, write, and delete and it never dies, you have undone the careful scoping you did everywhere else.
03.5

What least privilege buys you

Step back and look at what these four moves do together. Reads are separated from writes, the writes are on a short allowlist, every refund is capped at $50, and the credentials are narrow and short-lived. None of these defenses tries to predict the specific attack. They simply make sure that whatever goes wrong, Aria did not have the power to make it catastrophic. That is the quiet strength of least privilege: it works against the failure you did not see coming, because the power to cause that failure was never granted in the first place.

Broad grantLeast privilege
One broad API key does everythingReads and writes split into separate tools
Every power is on, just in caseOnly the three powers the job needs are on
Refunds limited only by the promptRefunds capped at $50 in code
A long-lived key that can read and sendA short-lived gmail.readonly token
"What might Aria need someday?""What does this exact job need right now?"

The course will keep building on this. The next chapter assumes Aria is already scoped down and asks the harder question of how to stop untrusted text from steering even a well-scoped agent. But scoping comes first, because every later defense is cheaper and smaller when the agent it is protecting can only reach a few things in the first place. Get least privilege right and you have already removed most of the worst outcomes from the table.

KEY TAKEAWAYS
  1. Least privilege means granting only the powers the job needs and nothing more, so a bad call can only reach so far.
  2. Start from the job, not the broad API key in the drawer: list what Aria actually does, then grant only that.
  3. Separate read tools from write tools, and put the harder boundary around writes, because a bad write is the one you cannot undo.
  4. Wire access in as an allowlist that denies by default, never a blocklist that tries to name every bad thing.
  5. Cap every action in code, not in the prompt: Aria refunds up to $50 on its own and pauses for a human above that.
  6. Make credentials narrow and short-lived, like a gmail.readonly token that expires, so a leaked key is a small prize.

End · Chapter 3 of 7

Mark it complete and it’s ticked off on your route.

Rivet, the product security agent for software teams, free to start. Human-led pentests and design review when you need them. AI agents are our specialty.

or get a free Rivet scan

BASEDChicago, IL · remote

FIELD NOTES

ONE SHORT EMAIL A MONTH

© 2026 ROUTEWORK — ALL RIGHTS RESERVED

Claude and Mythos are trademarks of Anthropic. RouteWork is not affiliated with Anthropic.