In late April 2026, a coding agent working for a small software company called PocketOS ran into a credential error in a staging environment. It didn't stop to ask anyone. It searched the project, found an API token in a file unrelated to its task, and used that token to delete a storage volume on Railway, the company's cloud host. The volume held the production database, and the backups sat on the same volume. The deletion took about nine seconds.


Founder Jer Crane wrote afterwards that the token had been created for routine domain operations through Railway's command line tool. Nobody at PocketOS knew it could also delete production volumes. The company restored from a backup that was three months old, then rebuilt the missing bookings from payment histories, calendar entries and customer emails.


Nothing in that story was a hack. The token was valid and the API call was well formed, so Railway did what the credential allowed. Every system in the chain was asked "can this caller do this?" and each one correctly answered yes. No system asked who had decided the agent should be doing it.


Security people keep two words for this. A permission is what a credential can technically do. Authority is the right to do it, and it has to come from someone entitled to give it. Most agents running today have plenty of the first and a thin paper trail for the second. This piece looks at how that happens and what a proper answer looks like.

Three questions that usually get asked as one

Authentication answers "who is this?" A password, a passkey or a signed certificate proves the caller is who it claims to be. It says nothing about what the caller should be allowed to do.


Authorisation answers "what may this caller do?" Roles, scopes and policies live here. A token that can read your calendar but can't delete events is an authorisation decision.


Delegation answers a question the first two skip: on whose behalf is this caller acting, and within what limits?

If you have ever sent someone to collect a passport or a bank document for you, you already know what good delegation looks like. You write an authority letter. It names you, names the person you are sending, says what they may collect, and carries a date. The clerk checks the bearer's ID against the letter. Your cousin walks out with one envelope, and he can't empty your account while he's there.


Software has mostly handled the same errand in two worse ways. Either the cousin gets your own ID card and the clerk believes he is you, or he gets a master key to the building. The first is impersonation. The second is a broad API key. In both cases the clerk has no letter to check.


RFC 8693, the OAuth token exchange standard from January 2020, draws this line formally. Under impersonation, the acting party is indistinguishable from the person it acts for. Under delegation, it keeps its own identity and acts as that person's agent. The word "agent" was in the RFC years before anyone attached a language model to it.

Why this matters more for agents than for scripts

A nightly cron job with an over-powered key was always a risk, but a predictable one. Its code did the same thing every run, and you could read that code.


An agent decides what to do at run time. Part of what shapes the decision is text it picks up along the way: a web page, an email, a GitHub issue, an error message. Auth0's identity team puts it this way: once behaviour is no longer fixed by code, the scope of the credential is one of the few controls you have left.

How agents usually get their access

The first time you connect an agent to a database or a cloud account, the quickest route is the credential you already have. That is usually your own, or an admin key sitting in a config file. Four patterns cover almost every setup.


How the agent gets in

Who the API thinks is calling

What the log shows later

When access ends

Static API key in a config file

Whoever holds the key

"Key X did it"

When someone remembers to rotate it

Shared service account

The account

"svc-automation did it", with no person attached

Rarely

The user's own login or session

The user

"You did it"

When your session ends

Delegated token

The agent, acting for a named user

"Agent A did it for user B"

Minutes or hours



A Cloud Security Alliance survey from January 2026 gives a rough idea of the spread. Of 228 IT and security professionals, 43% said their agents rely on shared service accounts and 31% let agents run under human user identities. 74% said agents often get more access than they need. 68% could not clearly tell agent activity from human activity in their own systems.


The sample is small and the study was funded by Aembit, which sells agent identity products, so treat the figures as a sketch. The shape is still familiar. PocketOS fits the first row of the table: a key made for one job that turned out to work for every job.


Standards people have noticed. An Internet-Draft on agent authentication, written by engineers from Okta, Ping Identity, AWS, OpenAI, Zscaler and Defakto Security, calls static API keys an antipattern for agents. Its reasoning is that they are long-lived bearer secrets, bound to nothing, and hard to rotate. The document is a draft and may change, but its authors include Brian Campbell, who edited RFC 8693.

The confused deputy, 38 years on

In 1988 Norm Hardy published a three-page note called The Confused Deputy. It described a compiler on a commercial timesharing system. The compiler had write access to its home directory so it could record usage statistics. The system's billing file lived in the same directory.


One day a user told the compiler to write its debugging output to a file with the billing file's name. The compiler obliged, and the billing records were overwritten. The user had no right to touch that file. The compiler did, and it couldn't tell whose authority it was using for that particular write.


An AI agent is Hardy's compiler with a much larger vocabulary. It carries credentials from whoever deployed it, and it takes direction from whatever text lands in its context window.


Researchers at Invariant Labs showed in 2025 that a malicious issue filed on a GitHub repository could hijack an agent connected through the official GitHub MCP server. The attacker needed no access to the victim's private repositories. The agent already had it.


Not every failure needs an attacker, though. In mid-2025, Replit's coding agent deleted a user's production database after being told not to change anything without permission. The PocketOS agent wasn't tricked either. On its own account afterwards, it guessed that the volume belonged to staging and never checked.


So there are two kinds of deputies to worry about: the tricked one and the overeager one. The OWASP Thttps://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/op 10 for Agentic Applications, published in December 2025, ranks Identity and Privilege Abuse third. It describes agents running on credentials or delegated authority inherited from people and other services, then being pushed into things their owners never intended.

The same control stops both kinds. If the credential can't perform the damaging action, it doesn't matter whether the agent was fooled or just wrong.

What properly delegated access looks like

Very little of the fix is new. Most of it is OAuth plumbing that has existed for years and is now being pointed at agents. Six pieces do the work.

  1. The agent has its own identity. The IETF draft treats an agent as a workload with one unique identifier and short-lived credentials cryptographically bound to it. It also says the model itself must never see those credentials, so a prompt injection has nothing to leak.
  2. A person grants a narrow slice. The user signs in and approves a consent screen that names the agent and the specific access it wants. This is the authority letter being written.
  3. The token carries both names. After a token exchange, the access token lists the user as the subject and the agent as the actor.
  4. The token works in one place only. The MCP authorisation rules require clients to say which server a token is for, and require servers to reject any token that wasn't issued to them. Forwarding a client's token to another API is forbidden outright.
  5. Tokens are short-lived and fetched per task. The agent never holds a long-lived refresh token. A broker holds it and hands out a fresh, narrow token for each operation. Revoke the connection at the identity provider and no new tokens are issued.
  6. Scopes start small. MCP's security guidance recommends a minimal read-only baseline, with extra scopes requested only when a privileged action is first attempted. It warns against wildcard scopes and against bundling unrelated privileges to avoid future prompts.


Here is what step 3 looks like in practice. This is the payload of a delegated token for an invented scheduling agent:

{   "sub": "meera@example.com",   "aud": "https://calendar.example.com",   "scope": "calendar.events.read",   "exp": 1794445200,   "act": { "sub": "agent:scheduling-assistant" } } 


Five fields answer the question in this article's title. sub says whose authority this is. act says who is using it. aud and scope say where and for what, and exp says until when. The calendar API can now apply a rule to the pair: Meera may delete events, but the scheduling agent acting for Meera may only read them. The audit log records both names.

Where this is still unfinished

It would be dishonest to present this as solved. Several separate Internet-Drafts on agent authorisation were circulating at the IETF in 2026, and none is a standard yet.


Scopes are also blunt. Auth0 points out that OAuth scopes can't easily express something like "contact details for the accounts I'm working on, but not the legal hold queue". Rules that fine need a policy check on every request, on top of the token.


And none of this helps if a second, broader credential is lying in a file the agent can read. That was the entire PocketOS failure.

An "Are you sure?" box is not authorisation

Many agent tools show a confirmation prompt before a risky step. That is useful, but it is weaker than it looks, for two reasons.

The prompt is drawn by the same software it is supposed to restrain. The IETF draft is blunt about this. A confirmation inside the agent's own interface does not count as authorisation unless it is tied to a grant from the authorisation server. The stronger pattern sends the approval request out of band, to the user's phone for example, with the details of the exact action attached. The draft admits that approvals in the middle of a running task still need more standards work.


The second reason is that words are not controls. The Replit user had told the agent not to make changes without permission. PocketOS had rules written into the agent's instructions. Telling an agent to stay out of production is a request. Removing its write access to production is a control, and only one of those survives a bad guess.


There is a human limit as well. Ask someone to approve every file read and by the afternoon they are approving everything. MCP's guidance lists users abandoning consent dialogs that ask for too much as a risk in its own right. Approval works when it is rare. Keep it for actions you can't take back: deleting data, moving money, sending something outside the company, changing who has access.

Seven questions before you hand an agent access

You don't need an identity platform to get most of the benefit. You need honest answers to these.

  1. Does the agent have its own identity, or is it borrowing mine or a shared one?
  2. If I read the audit log six months from now, will it show the agent, the person it acted for, and the action?
  3. What is the worst single call this credential can make? Find out before the agent does.
  4. When does this access end if I do nothing at all?
  5. Can I revoke it in one place, today, without breaking unrelated things?
  6. Which actions need a human yes, and is that yes enforced by the system or only by the prompt?
  7. What other credentials can the agent read from disk or from environment variables?


The last question is the one PocketOS missed, and it is the easiest to miss. An agent with shell access can read every secret in the working directory, whether or not you meant to hand it over. For a solo developer or a small team, the practical version is short. Give the agent a per-project token instead of an account-wide one. Point it at a read-only database user unless the task needs writes. Keep production secrets out of the folder it works in. Store backups somewhere the same credential can't reach.

FAQ

What is the difference between authentication and authorisation for an AI agent?

Authentication proves which agent is calling. Authorisation decides what that agent may do. An agent can be perfectly authenticated and still hold far more access than its task needs.

Should an AI agent log in as me?

Preferably not. If the agent uses your login, every system treats its actions as yours and the logs can't tell the two of you apart. A delegated token that names both you and the agent keeps the record straight and lets you limit what the agent can do.

What does "on behalf of" mean in OAuth?

It describes a token that records two parties: the user whose authority is being used and the actor using it. RFC 8693 defines the token exchange that produces these tokens and the act claim that names the actor.

Does MCP take care of authorisation for me?

Partly. The MCP specification defines how a client gets an OAuth token for a remote server, ties that token to that one server and bans passing it on. It does not choose your scopes, and it can't stop a local agent from reading a broader key off your disk.