Is your AI agent running on someone else's login? Give it its own, and cap what it can do
If your AI agent signs in on a shared service account or someone's personal token, it holds everything that account holds. Here's how to give it its own identity, short-lived access per task, a person who approves anything irreversible and a log that says who it acted for.
part 4 of 11 · Identity security, from the ground upthe ideaThe model decides what it wants. The credential decides what it can do.
after reading, you can- Know why an agent needs a login of its own, so you can explain to your team what a borrowed account actually puts at risk.
- Give each agent run its own short-lived token for one task. Then add a tool allow-list that says no by default.
- Spot the actions someone should approve outside the chat. Then check your audit records actually hold all four facts.
AI agents now sign in, call APIs, read data and change things on systems that matter, and many of them do it on someone else's account. If you run one, give it its own identity, short-lived access for each task and a person who signs off anything you can't undo. This post explains why, then what to do if an agent's access gets misused.
Your AI agent is probably running on someone else's login, and it can do far more than its job needs
An AI agent is software that does work for you. It reads invoices, answers tickets, updates records and sometimes moves money. To do any of that it has to sign in, and often someone hands it an account that already exists: a shared one the company has used for years, or the login of the engineer who set it up. From then on the agent can do everything that account can. Nobody manages it, it works all night and it never leaves the company. Anyone who can slip instructions into what it reads can try to steer it.
Think of a temp who starts on Monday and gets handed the office manager's master key because it's quicker than cutting a new one. The temp can now open the safe and the payroll files, and the door log will say the office manager did it. You'd normally give the temp a badge of their own that opens only the rooms the job needs, and only for this week.
- Teams putting AI agents into production
- Business owners approving agent projects
- IT and identity teams
- Security and audit teams
- Finance teams whose agents touch payments
Why it matters to you
Your agent authenticates, calls APIs, reads data and changes state on systems that matter. In most deployments it does all of that as a shared service accountdefinitionA non-human account that software signs in with. Shared ones tend to pick up years of extra permissions., or on the personal token of whoever wired it up. An agent acting on someone's behalf is a privileged user with no HR record, no manager and no leaving date. So it has to be governed as its own identity, and that's an identity problem with known answers.
The cost shows up in two places. The agent can reach far more than its job needs, so one bad instruction can do a lot of damage. And when something goes wrong, your logs name the wrong actor, so you can't tell an auditor or an insurer who actually did what.
We've argued before that zero trust is something you have to prove, and that conditional access is production code you test like any other. Agents make the same case at machine speed. They make the same access decisions hundreds of times an hour, and someone can talk them into things.
-
01 The agent borrows an account
Someone wires the agent up with a shared service account or their own token. It now holds every permission that account ever collected.
-
02 A poisoned item arrives
Someone plants an instruction in a document, a calendar invite or a ticket comment. The agent reads it while doing its usual work, and nobody on the team ever sees it.
-
03 The agent wants to act
The model treats that instruction as part of the job, say paying a supplier or changing their bank details. Filters catch some phrasings, but whoever planted it only needs one that gets past.
-
04 The borrowed account says yes
Nobody ever asked whether an invoice job should be able to pay anyone. The borrowed account can, so the payment actually goes out and nobody stops it.
-
05 The log blames the wrong person
The audit trail names the engineer or the batch job as the actor. Working out what the agent did, and for whom, can take days.
For engineers, the point of that chain is step four. Prompt injectiondefinitionSomeone hides an instruction in a document or ticket comment an AI will read. If the agent follows it, it does something its user never asked for, with whatever access it holds. gets the agent to want something, and the credential decides whether it can do it. Every fix below works on what the agent holds at that moment, because that part you control.
What changes when the agent gets its own identity
The most common agent deployment we find in production authenticates as something that already existed. Usually that's a shared service account carrying a decade of accumulated grants, or the credential of the engineer who built the integration. Both collapse two principals into one.
The service account hands the agent every entitlement anyone ever needed from it, and you can't tell an agent's call apart from a nightly batch job's. The personal token is worse. The agent inherits a human's full standing access, and the audit log names that human as the actor for everything it does, including whatever it gets up to at 3 a.m. while they sleep.
- Signs in as a shared service account or an engineer's own token, because that was quicker
- Holds every grant that account ever collected
- Logs only show the account. Nobody can tell the agent from a batch job or a person
- Nobody owns it and it never gets retired
- Does whatever the account can, whoever asked. A junior rep's request gets the same power as an admin's
- Gets its own identity for each deployment and environment. When something breaks, you know which agent did it
- Has a named owner and a retirement date. When it stops being useful, someone actually switches it off
- Its token says agent-on-behalf-of-user. When you read the logs later, you see both names on every line
- Capped at what the delegating user actually holds
- Gets fresh, narrow tokens for each task
An agent acting for a person is not that person. It needs its own principal, registered alongside every other non-human identity with a named owner and a retirement date. DelegationdefinitionLetting an agent act for one person and writing that down. If Priya hands an agent her refund queue, the log shows the agent did the work for Priya. then gets recorded instead of happening by accident. The agent holds a token that says agent-on-behalf-of-user, and both halves survive into every log line.
The standards already cover this. OAuth 2.0 Token Exchange (RFC 8693) separates delegation from impersonation: under delegation the acting party keeps its own identity, and the token's act claim names it. Ask your identity provider whether it can issue tokens like that, since it decides how much of this you build yourself.
That model also settles the authority question. An agent's ceiling is the overlap between what the agent is approved to do and what the delegating user actually holds. An agent invoked by a tier-1 support rep must not be able to issue a refund that rep couldn't issue by hand, however well the request is phrased. If your architecture can't express that cap, the agent is effectively manufacturing authority.
What to do now
What to do now, by who you are
- Ask the team running each agent which account it signs in with. If the answer is a shared account or a person's login, put fixing it on the plan.
- Name an owner for every agent and a date when someone reviews or retires it. Without an owner, nobody ever takes its access away.
- Decide which actions an agent may never finish alone, such as moving money or changing bank details. Someone senior should sign that list off.
- Register each agent as its own identity in your identity provider, one per deployment and environment. That way test and production never share a login.
- Keep the agent's own credential locked down and short-lived, and have it exchange that for per-task tokens with a TTL in minutes. Then test that revoking access actually takes effect within a minute.
- Pass the delegating user through on every call. When someone reads the logs, each request should show the agent and the person it was working for.
- Give each agent a tool allow-list that denies by default. Enforce it in the authorization layer, outside the model.
- Send anything irreversible to an out-of-band approval. The approver should see the exact action and its parameters before saying yes.
- Add rate limits and blast-radius caps to actions that are cheap one at a time but costly in bulk.
- Check that every audit record shows the agent, the delegator, the tool with its arguments and the outcome. Many logs record only the account and the time.
- Compare what each agent was granted with what it actually used. Take back the rest, because nobody else will notice it's there.
- Treat prompt injection as a privilege escalation path in threat models. Ask what the agent's token allows at each step.
Harden so the next one hurts less
The second failure is durable authority. An agent registered once with the union of every scope it might ever need is the old standing-privilege problem in a new hat. Identity programs have spent a decade stripping standing privilegedefinitionAccess that stays on an account whether or not today's task needs it. Nobody notices it sitting there until someone misuses it. out of human accounts, and agents shouldn't bring it back.
So issue credentials per task. When a run starts, exchange the agent's identity plus the delegation for a token carrying only the scopes that run requires, with a TTLdefinitionTime to live. Set a token to expire after ten minutes, and a copy someone pulls out of a log only works for a few minutes. measured in minutes. A triage run that reads invoices gets read access to invoices for ten minutes. If it later needs to write, that's a fresh decision and a fresh token, and the run wasn't quietly holding that capability all along.
Pair scope with a tool and API allow-list that denies by default. The agent gets the four tools the job needs. Anything else, including the tools sitting one function call away in the same framework, gets refused by the authorization layer instead of by the model.
That's also where prompt injection stops being a content-filtering problem. A poisoned document can make an agent want something you never asked for, and so can a calendar invite or a ticket comment. You can't filter your way to safety when the filter is probabilistic and the attacker gets unlimited attempts. OWASP makes a similar point in its Top 10 for LLM applications: it's unclear whether fool-proof prevention exists.
What you can do is make the wanting irrelevant. Treat injection as a way to escalate privilege and the design follows. Whatever credential the agent holds at that moment sets what a successful injection costs you, and prompt hygiene doesn't change that much. Keep scopes narrow and short-lived, deny tools by default, and a compromised run stays a bounded incident.
You cannot prompt-engineer your way out of an authorization problem. The model decides what it wants; the credential decides what it can.
# agent:invoice-triage, run 4f21b8 # authorization trace principal: agent:invoice-triage@prod // own identity on_behalf_of: user:ap-clerk-2291 // scopes capped by their rights task_token: invoices:read, vendors:read · ttl 10m tools: 4 allowed · all others deny-by-default denied: payments.transfer · outside allow-list held: vendor.bank_details.update → human approval audit: 37 actions · agent + delegator + tool + outcome ✓ token expired at 10m ✓ revocation path tested < 1 min
That's what a good trace looks like. The agent tried a payment it wasn't allowed to make and got refused, and the bank details change sat waiting for a person. Anyone reviewing it later can tie all 37 actions to the agent and the clerk it worked for.
Some actions have no undo. Money moves, a mailbox gets emptied, a vendor's bank details change, someone is granted a production role. Write those down first and make every one of them stop at a person. The agent asking its own conversation to confirm doesn't count, because that user is inside the trust boundary the injection already crossed.
You need an out-of-band approvaldefinitionA point where a qualified person must sign off one specific action before it runs, and outside the agent's own conversation. that shows the concrete action and its parameters, and goes to someone with the standing to allow it. Record it with their identity and a timestamp. For actions that are cheap one at a time and catastrophic in bulk, rate limits and blast-radius caps do the same job.
Everything else needs an audit record, and every record needs four facts: which agent, which delegator, which tool with which arguments, and what came back. Many logs record only the account and the time. It bites in the incident where you have to say whether the agent acted on its own authority or someone else's, and whether the call actually worked.
Emit the trail from the authorization layer, since a compromised agent is an unreliable narrator of its own behavior. Then review it the way you review human access. Look at what was granted and what was genuinely used, and take back the rest. Agents pile up entitlements the way people do, only faster and more quietly, and an agent never complains about access it no longer needs.
Before: someone set the agent up on an old shared service account
Someone set the agent up on an old service account because it was already there. It can reach payments and vendor records directly. When you read the logs later, all you see is the service account.
After: own identity, task tokens and a human gate
The agent has its own identity and gets a ten-minute token for each run. A deny-by-default allow-list and a human approval sit between it and anything it can't undo.
The order we'd harden an agent in
- 01Give it an identity of its own
Register the agent like any other non-human identity, with a named owner and a retirement date. Retire the shared account or personal token it used before, so nobody quietly switches back.
- 02Cap it at the delegating user
Pass the person the agent acts for along with every call, and refuse anything they couldn't do by hand. If the tier-1 rep can't issue that refund, neither can the rep's agent.
- 03Issue tokens per task
Exchange identity plus delegation for a token holding only that run's scopes, with a TTL in minutes. Writing later means a new decision and a new token.
- 04Deny tools by default
List the few tools each job needs and refuse the rest in the authorization layer. The model never gets the final word on what it may call.
- 05Gate what you can't undo
Write down the irreversible actions and send each to an out-of-band approval with the exact parameters. Put rate limits and blast-radius caps on the bulk ones.
- 06Log four facts and review them
Emit agent, delegator, tool with arguments and outcome from the authorization layer. Review grants against real use every quarter and take back what sits idle.
If it goes wrong
If an agent's access is misused
Maybe an agent paid someone nobody approved, or an auditor found it running on an engineer's personal token. Either way, stop it before you investigate, and investigate before you rebuild. Skipping ahead can destroy the evidence you need.
- 01Containfirst hour
- Revoke the agent's tokens and disable its account, or the shared account it borrowed. If that account runs other jobs, expect them to stop too.
- Pause the agent's runs and its queue, so nothing new starts while you look.
- Hold any pending payments, bank detail changes or role grants it requested. Ask the finance team to check the last batch by hand.
- If money already went out, call your bank now and ask them to recall it.
- Save the agent's conversation history, inputs and queue before you clear or restart anything.
- 02Investigatefirst day
- Pull the authorization layer's logs for the agent: every tool call, its arguments and what came back.
- Work out whose behalf each action ran on. With a borrowed account that's guesswork, so cross-check timing against the people who invoked it.
- Find the document, invite or ticket comment that set it off. Then search your other systems for the same text, because whoever planted it may have tried more than once.
- List everything the account could reach. That's your worst case, even if the logs show less.
- 03Remove and recoverdays 1 to 3
- Rotate every secret and token the agent held. Do the same for anything the borrowed account shared with other systems, or the door stays open.
- Put back what the agent changed. Restore the supplier's bank details after confirming them on a number you already had, fix the records and take back any roles it granted, then check nothing else moved.
- Bring the agent back only on its own identity, with task tokens, a deny-by-default tool list and approval gates.
- 04Report and learnfirst week
- Tell the people the logs wrongly named. Their name may be on payments they never made, and they'll want that on record before anyone asks.
- Ask your lawyer whether customers, regulators or your insurer need telling. That depends on what data and money the agent touched.
- Add the missing control to every other agent, not just this one, and log the review date.
How this could play out
How this could play out
- the setup
- A mid-size distributor has an AI agent that reads supplier invoices and queues payments. Someone set it up on the old service account the finance system has used for years, because it was there.
- what happens
- Someone sends an invoice email with a hidden line asking for the supplier's bank details to be updated. The agent makes the change because the account lets it, and the log just shows the service account. Finance only finds out when the supplier chases a missing payment.
- what to do
- Reverse the change and call the supplier on a number you already had to confirm the details. Then move the agent onto its own identity, with read-only invoice tokens and a person approving bank detail changes. Ask your bank to try to recall the payments that went to the new account.
- the setup
- Tier-1 support reps at a subscription business pass refund requests to an AI agent. Someone gave the agent its own identity, and each request still names the rep who asked.
- what happens
- A customer keeps pushing in chat, and eventually the agent tries a large refund. The authorization layer looks up what that rep could approve by hand, sees it's less and blocks the call. The rep picks up the chat from there.
- what to do
- Keep the cap and review the attempt in the audit trail. If it repeats, add a rate limit on refunds per rep and tell the support lead.
- the setup
- A software company's internal assistant was built in a hurry and runs on the personal token of the engineer who wrote it. That engineer has production admin rights.
- what happens
- An audit finds the engineer's name on thousands of production changes made at night. Nobody can say which were the engineer's and which were the assistant's.
- what to do
- Give the assistant its own identity and a narrow tool list, and revoke the engineer's token from it. Tell the auditor what happened and when the fix lands.
- the setup
- A services firm uses an agent to draft sales follow-ups from CRM records. Each run gets a ten-minute token to read contacts, and sending email needs a new one.
- what happens
- Someone plants a note in a CRM record telling the agent to export every contact. The export tool isn't on its allow-list, so the call is refused and logged. Nothing leaves, and security still has a record to chase.
- what to do
- Clean the note and check who wrote it. Then look at the audit trail for other refused calls from the same source.
Most of our agent reviews start with a spreadsheet. We list every agent, the account it signs in with and what that account can actually reach. Then we look at where people approve things and whether the logs would hold up with an auditor. The AI agent identity page explains how we work, and non-human identity governance covers the service accounts and tokens around it. You can also start with an assessment.
What to take from this
- 01
Give every agent its own identity and record who it's working for. Then cap it at what that person could actually do by hand.
- 02
Issue per-task credentials with short TTLs, behind a tool allow-list that denies by default. If an injection lands, the credential decides how far it gets, and a prompt filter won't save you.
- 03
Gate anything you can't undo on an out-of-band human approval. Log every action too, with the agent, who delegated, the tool and the outcome.
01Our AI agent just uses the service account we already had. Is that really a problem?
Usually, yes. A shared account brings every permission it ever collected, and your logs can't tell the agent apart from the other jobs using it. Give the agent its own identity and move it over before you widen what it does.
02Can't we just filter out prompt injection?
Filters help, but they're probabilistic and an attacker can keep trying new wording. OWASP makes a similar point: it's unclear whether fool-proof prevention exists. Plan on some injections getting through, and limit what the agent's token can do when they do.
03Which agent jobs still need a person to say yes, even if the agent rarely gets them wrong?
Anything you can't undo: moving money, changing a vendor's bank details, emptying a mailbox, granting a production role. Write your own list, and send each one to someone with the authority to approve it, outside the agent's chat.
04We only have one small agent. Is this overkill?
Start small. Give it its own account, a short list of tools and a person who approves the risky actions. If something ever goes wrong, you'll know exactly what the agent did and who it did it for.
Three questions, about a minute
Pick an answer and we'll tell you if it's right, and why it is or isn't. The score stays in this browser.
-
Q1A tier-1 rep passes a customer chat to an agent, and the agent ends up trying a refund the rep couldn't approve by hand. What should the system do?
show the answer
A. Refuse it. The agent can't do more than the rep who called it An agent's ceiling is where what it's approved to do overlaps with what the delegating user holds. Past that line, the agent is manufacturing authority.
-
Q2Your team has put a prompt filter in front of its agent and calls injection solved. According to the post, what actually caps the damage?
show the answer
C. The credential the agent holds at that moment Filters are probabilistic and attackers get unlimited attempts. Treat injection as privilege escalation: narrow scopes, short lifetimes and a deny-by-default tool list bound what a successful injection can do.
-
Q3Your finance agent wants to update a supplier's bank details. Which control should stop it until a person has looked?
show the answer
B. Someone with authority approves it outside the chat, after seeing the exact change Irreversible actions have to stop at a person. Confirming in the agent's own conversation doesn't work. That user sits inside the trust boundary the injection already crossed.