← Back to blog
AI Security

Who is your AI agent acting as and how fast can you stop it?

Allen Clark

Allen Clark

A dark, featureless figure with black gloved hands typing on a logged-in laptop at dusk, while a staff badge for Sarah Mitchell, Finance, with her smiling photo lies on the desk in the foreground.

The question behind the agent

When an AI agent moves money, reads a claims file or opens a ticket, something downstream has to decide whether to let it. That decision usually rests on a token, which is a small piece of signed data the agent sends with each request saying who it is acting for and what it is allowed to do. The system receiving the request checks the signature and the expiry time and, if both look right, lets the request through without generally asking anyone else.

Anyone connecting an agent to other systems should be able to answer three questions about that token:

  • Whose authority is the agent using?
  • How much of that authority does it carry?
  • How quickly can it be taken away?

The questions sound basic, but I suspect plenty of agent pilots were wired in with whatever credential the integration already had. If that credential is a long-lived API key or a shared service account secret, the honest answers are "anyone's", "all of it" and "not quickly".

What NIST is asking for

On 27 October 2026 NIST published Design Tenets for Agent Identity Management Systems, the second post in a series from the NCCoE project on agent identity and authorisation. Harold Booth, Bill Fisher, Ryan Galluzzo and Tom Clancy propose ten tenets drawn from public comments and stakeholder engagement.

Tenet 04, which NIST titles "Short-Lived, Dynamic & Revocable Authorization", says access should be granted just in time, limited in time and tied to a specific audience. Each tool call or API call is checked at runtime so authority can be contained or revoked if behaviour drifts. It tells designers to

"avoid long-lived bearer tokens or static, reusable secrets"

and the reason they give this advice is for containment, a stolen credential then does less damage and an operator can interrupt a hijacked agent mid-task.

We've already seen this happen, as in April 2026 Vercel, the company behind the Next.js web framework and a widely used hosting platform, disclosed that an attacker had got into its internal systems and read environment variables belonging to some of its customers. This is where applications often keep API keys, tokens and database passwords, so Vercel told customers to treat any that hadn't been marked as sensitive as exposed and to rotate them. According to Vercel's security bulletin it started with the compromise of Context.ai, a third-party AI tool used by one of its employees, which the attacker used to take over that employee's Google Workspace account and then their Vercel account. Vercel says the weakness lay in the AI tool's Google Workspace OAuth app and may have affected hundreds of its users across many organisations. Vercel advised Google Workspace administrators to check straight away for use of that app. An AI tool holding standing access to someone's account is a perfect example of long-lived authority that tenet 04 warns against.

The neighbouring tenets carry the same logic, starting with tenet 01, which asks for agent identities that are distinct from human users and service accounts. Tenet 02 says authority should narrow as it passes to sub-agents and downstream services, never widen. Tenet 07 keeps the system that decides what an agent attempts apart from the system that decides what it may do, because a language model takes data and instructions in one stream. Tenet 08 makes deterministic mechanisms the main basis for access decisions. Tenets 09 and 10 ask for agent-specific monitoring and a tamper-evident, append-only record that the agent itself cannot alter.

Tenet 05 matters for anyone whose answer is "a human approves it". NIST warns of consent fatigue, where escalations come so often that people approve them by habit. A human in the loop helps only if the loop is rare enough to be read.

NIST is pragmatic enough to admit that current standards and technology cannot yet meet all ten tenets in every deployment. It offers them as a baseline for assessing capability and planning a roadmap.

Delegation or impersonation

RFC 8693, the OAuth 2.0 Token Exchange standard, sets out the terms most people now use. The standard describes two ways for one party to act for another. In impersonation, the agent takes on the user's identity, so anyone downstream sees the user doing it. In delegation, the agent keeps its own identity and acts on the user's behalf, which the RFC sums up as "A is an agent for B". The token carries an act (actor) claim naming who is acting while nested act claims can record a chain of earlier actors.

This matters for a regulated firm. If an agent acts for a customer but the log shows the customer doing it, the firm's own records are making a false claim about who acted. That undermines any audit of those records and could put the firm in breach of the record-keeping rules and controls its regulators expect it to meet.

What changed in Cognito this week

On 12 November 2026 AWS announced that Amazon Cognito now supports OAuth 2.0 token exchange. A service or AI agent acting for a user can swap the user's token for a new one with narrower scope, a single audience and no refresh token. It is available on the Essentials and Plus feature plans.

The developer guide sets out the security model. A permission only makes it into the new token if the agent asked for it, the user's original token already allowed it and the app is set up to hand it out. That means an exchange can narrow what the agent is allowed to do but can never add to it. Before issuing anything Cognito checks the subject token's signature and expiry and also whether it has been revoked, for example by a global sign-out.

The guide also makes the choice between the two clear. If you leave out the actor token you get impersonation, with no act claim, so a downstream service cannot tell the request apart from one the user made directly. If you include it you get delegation. The act claim then tells downstream services an agent is involved, so they can apply policy to it and record it in their audit logs.

Cognito does have one gap here, in that it does not currently issue or evaluate the RFC's may_act claim, which would let the original issuer declare in advance which actors may act for a subject. The question of which agents may act for whom has to be answered somewhere else in your design, so you need to know where that is.

Signed out is not locked out

If you are reviewing an agent design, token revocation is the area I think you should spend most time on.

AWS's page on ending user sessions with token revocation sets out what each method does. GlobalSignOut and AdminUserGlobalSignOut revoke all of the user's refresh, ID and access tokens. Revoking a single refresh token invalidates the access tokens issued from it and leaves the user's other refresh tokens alone. Revoked tokens cannot be used with Cognito API calls that require a token. The same page then warns that a JWT library which checks only the signature and expiry will still treat revoked tokens as valid. The GlobalSignOut API reference is just as direct about it when it says

"Other requests might be valid until your user's token expires."

AWS's guide to verifying JSON web tokens explains why. A Cognito token carries everything needed to check it, so an application can confirm the signature and expiry without contacting Cognito at all. The catch is that nothing in the token changes when it is revoked, so a check that never contacts Cognito cannot know. AWS gives two options for an application that needs revocation to take effect straight away. One is to ask Cognito whether the token is still good, for example by making an API call with it. The other is to keep token lifetimes short.

This matters a lot for agents, because an API that validates a token locally will keep accepting a revoked agent's token until it expires. Unless you have built something better, your kill switch is the token lifetime. Token exchange helps because the issued tokens are short-lived and come with no refresh token, so they cannot be used to mint new tokens once the original credential is gone. The exchanged token is still a standard Cognito token, validated the same way, so the expiry rule above still applies to it.

AI agents reach your systems through the same identity plumbing as everything else, but they use it faster and without any hesitation.

What I'd recommend

AI agent identity board checklist: six questions for the board in three groups (know your agents, see and stop them, keep people in control), each with what good looks like, the evidence to ask for, red, amber and green status boxes and an owner line.
A one-page checklist to take to the board.
  1. List every agent and the credential it holds. Any long-lived API key, shared static secret or refresh token in an agent's hands is a gap against NIST tenet 04.
  2. Prefer delegation over impersonation wherever you can. Where your identity provider supports token exchange, include the actor so downstream services and logs can see the agent. Then check that your logs actually record the actor claim.
  3. Measure how long your kill switch really takes. Revoke an agent's session in a test environment and time how long each downstream API keeps accepting its token. If the answer is "until expiry", decide whether that lifetime is acceptable for the risk of the transaction.
  4. Narrow scope and audience per task. Bind each token to one resource server and the minimum scope, so a leaked token works in one place for one job.
  5. Keep the access decision outside the model. Enforce policy in deterministic code that the agent cannot argue with and write the evidence somewhere the agent cannot edit.
  6. Set approval thresholds people can sustain. If approvals become routine, nobody is really reading them.

Whether an AI system can be pushed into doing more than it should is the kind of question we test for at Djinn Six.

If you revoked an agent's access at nine this morning, when would the last API stop accepting its token?

Sources

    Who is your AI agent acting as and how fast can you stop it? | djinn six