Tracing and stopping an agent
A week after the photo book arrives, your Lisbon album has a public sharing link you do not remember making. This lesson reads the record that tells you who made it, lists what a useful audit trail for agents keeps and leaves out, follows what stops when you revokeCancelling a credential, token, certificate, or authenticator before it would expire, so that it is no longer accepted. Whether every copy stops working at once depends on how services check it. an agent and what does not, and ends with the agent's lifecycle.
What happened to my album?
The photo book arrives, and it is lovely. A week later, though, you notice that your Lisbon trip album has a public sharing link. You do not remember creating one. You do remember the strange caption your friend's photos carried. Did the assistant share your album after all?
You need answers to the questions from What makes an agent different, this time looking back. Who created the link? When? Acting for whom, and with what authority? If the photo service only recorded "user-2048 created a sharing link", you could not tell whether that was you or something acting for you.
The photo service shows you the album's activity. Because the assistant reached your album as your delegate, every entry records both whose authority was used and who used it:
| Time (UTC) | Action | For | Acting | Outcome |
|---|---|---|---|---|
| Sep 24, 18:31 | Create public sharing link | You | You, in the photo web app | Allowed |
| Oct 1, 14:02 | Read album | You | assistant.example | Allowed |
| Oct 1, 14:06 | Create public sharing link | You | assistant.example | Refused: the token does not allow sharing |
| Oct 1, 14:20 | Read album | You | Printer's selection agent, for assistant.example | Allowed |
All domains, credentials, and tokens in these examples are fictional. The link was yours. You created it on the last day of the trip, from the photo web app, so your family could see the photos, and then forgot about it. The assistant did try to share the album on October 1, steered by the caption, and the photo service refused. In a record that showed only whose authority was used, both share rows would read "you created a sharing link." A record that also says who acted tells them apart.
An audit trail that answers the questions
Each entry in a useful trail for agent actions records:
- When, from the server's clock.
- What: the action and the resource it touched.
- For whom: the subject whose authority was used.
- Who acted: the client and the full chain of actors, current and earlier.
- With what authority: which grant was used, what it allowed, and a reference to any approval, such as your approval of the book order.
- The outcome, including refusals and failures. The refused share is one of the most informative entries in the table.
- A request identifier, and a reference to the request that caused this one, recorded at each service, so related operations can be joined up later. Each request keeps its own entry, and the reference is an identifier, never a credential.
The trail should never contain tokens, codes or other credentials. It should also leave out the contents of the agent's conversation and of your photos. A record of what happened does not need a copy of everything that was said or seen, and keeping one creates a new store of private data to protect.
The printer keeps a matching record of its side. Its entry for the order says that assistant.example placed order ord-5531 for draft book-7730 for you at $58.00, under the recorded decision approval-7730, linked to that order. What it leaves out matters as much: the binding message shown on your phone, the CIBAClient-Initiated Backchannel Authentication: an OpenID Connect flow in which a client asks the provider to authenticate a person on a separate device, such as their phone, with no browser redirect. The client then collects the result by polling, a ping or a push. request identifier, the credential used to notify your phone and every token stay out of the record.
Revoking an agent
Even though the link was yours, the episode makes you check what can still reach your photos. You open the photo service's list of connected apps, and the assistant is not on it. Its grant ended after the 24 hours you approved, and when the book was finished, the assistant had already revoked its own refresh tokenA longer-lived credential that a client sends to the authorization server, never to an API, to get new access tokens without asking the person again.:
POST /revoke HTTP/1.1
Host: auth.photos.example
Content-Type: application/x-www-form-urlencoded
client_id=assistant
&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer
&client_assertion=demo-signed-client-assertion
&token=demo-assistant-refresh-token
&token_type_hint=refresh_tokenThis is the same request any client sends in Token revocation. A well-behaved agent does not wait to be revoked. But suppose the assistant had kept a standing grant, and you removed it from the list. Here is what would stop, and when.
The grant would end at once. The photo service would delete your grant to the assistant, and its refresh token would stop working. The assistant's next attempt to refresh would fail with invalid_grant, as in The refresh token grant.
Access tokens already issued might last a little longer. If the photo APIAn application programming interface: a defined way for software to interact with a service. A web API offers endpoints where other programs send HTTP requests. checks each token with the authorization serverIn OAuth, the service that handles a person's sign-in and approval and decides which tokens to issue to a client. It may belong to the same company as the API, but its job is separate., as in Token introspection, a revoked grant takes effect on the next request. If it validates signed tokens locally, it still checks the signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message., issuer, audience, times and its own rules, but it has no way to learn that the grant was revoked, so a token issued before you revoked keeps working until it expires, up to fifteen minutes here. Short lifetimes, or checking tokens with the authorizationDeciding whether a requested action is permitted, such as whether a signed-in account may delete a particular photo. Authentication says which account is asking; authorization decides what it can do. server before sensitive actions, keep that window small.
Tokens derived from the grant should end with it. The selection agent's token was exchanged from the assistant's. A careful authorization server revokes tokens derived from a grant when the grant is revoked. Otherwise they last until they expire, which is another reason derived tokens should be short-lived.
The operator has its own switch. assistant.example can stop the assistant's tasks for you directly. If the assistant's own software were compromised, the operator would treat it as a leaked workload credential, as in Owning and retiring workload identities: revoke its client credentials at every service, look for anything the attacker created, and replace them.
What revocation cannot undo
Revocation stops what an agent does next. It does not reverse what it has already done. Removing the assistant does not cancel the book order. That is a separate request to the printer, under the printer's cancellation policy. It does not delete copies of your photos the printer's selection agent made while choosing pages. Those are governed by the printer's own retention rules. And it cannot unsend a message or make a shared file private again in every place it has been copied to.
That is why the controls that matter most come before an agent acts: narrow grants that limit what it can do, and approvals for the actions that cannot be undone. Afterwards, the audit trail tells you what needs repairing.
Retiring an agent
Agents are identities with a lifecycle, like the workloads in Owning and retiring workload identities. Each one needs an owner: the operator for the agent itself, and you for the authority you delegated to it. Each needs an inventory. Your list of connected apps is your inventory of agents holding your authority, and an organization should keep one for every agent it runs or allows. Each needs review: grants that have not been used in months should be removed. And each needs retirement: when an agent is no longer used, its grants are revoked, its client registrations and credentials are deleted, and its history is kept.
An agent nobody owns, holding standing grants from many people, is the agent version of migrate-tmp. It keeps working quietly, and nobody is watching what it can do.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Trace an agent errand and stop its continuing authorityFollow one errand through receipts, Audit and Logs, then stop the run and the case's services and see what stays in the record.