DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Building an AI-Powered Incident Triage Agent with .NET Aspire
  • AI Agents vs LLMs: Choosing the Right Tool for AI Tasks
  • Zero Trust, Build High Scale TLS Termination Layer
  • Anthropic’s Model Context Protocol (MCP): A Developer’s Guide to Long-Context LLM Integration

Trending

  • The Fallback Trap
  • Voice AI Is Running on Untuned WebRTC: 20 Services To Show You Where
  • The Self-Hosting Math Changed While We Were Still Arguing About Sovereignty
  • PWA on iOS, Part 5: Service Worker Updates, Cache, and Push

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Data Engineering
  3. AI/ML
  4. Zero Trust for Agents: A New Lens to Secure Agents

Zero Trust for Agents: A New Lens to Secure Agents

The session was the right unit of risk when the subject was a person. For agents it is the wrong one, and two existing standards already point to the fix.

By 
Krishna Sunkavalli
·
Nov. 25, 26 · Analysis
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
0 Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

I spend a lot of my time reviewing other people's architectures. Increasingly, those architectures have agents in them, and the ones that worry me are almost never the ones with an obvious flaw.

Here is a shape I keep running into. A support agent reads incoming tickets, looks up order history, and drafts a reply. The team has done the work: read-only database credential, ticketing API key scoped to one project, egress restricted to a couple of hostnames, secrets pulled from a vault instead of environment variables. Every question on the review checklist has a good answer.

The question that does not get asked is how far that read-only credential actually reaches. Usually the whole schema. And the agent picks what to read from it based on text that arrived from the internet, written by whoever opened the ticket. Nothing in the design is broken. The agent simply holds authority it does not need, and an untrusted party has a channel into its decision loop.

This is not an exotic failure. It is OWASP LLM06:2025, Excessive Agency, almost verbatim. OWASP traces it to excessive functionality, excessive permissions, and excessive autonomy. In what I see, it is nearly always the middle one. The entry even names the exact anti-pattern: an extension meant only to read data connecting with an identity that also carries write privileges, and the related one where a per-user operation runs under a generic high-privileged account.

Underneath it sits the confused deputy problem, roughly forty years old, wearing new clothes. What is new is that the deputy reasons in natural language, runs thousands of times an hour, and picks its own path through your systems.

Instructions are Not Enforcement

The usual first fix is to write the rule into the system prompt. "Only return records belonging to the customer who opened this ticket." "Never issue a refund above the order total."

I have watched teams treat that as a control. It is not one. The instruction lands in the same token stream as the attacker's text, and the model weighs both. OWASP is blunt about the limits here, noting that given the stochastic nature of these models, "it is unclear if there are foolproof methods of prevention for prompt injection" (LLM01:2025). Retrieval grounding and fine-tuning reduce the problem. Neither closes it.

Indirect injection is the part that catches teams out. The attacker does not need to talk to your agent. They only need to write something your agent will later read: a ticket body, a web page, a PDF, a code comment, a calendar invite.

There is a second problem that gets less attention. Even if the instruction holds perfectly, you have no audit trail. When the prompt is the control, "why did the agent do that" has no answer beyond an inference trace nobody can replay deterministically. Try explaining that to an auditor.

Treat the system prompt as product behavior. Worth investing in, and not a place you put anything you would be unwilling to see bypassed. OWASP's own mitigation list says as much, recommending you give the application its own API tokens and handle privileged functions in code rather than exposing them to the model.

The same test disqualifies the other popular non-control. Do not put a classifier in front of everything and call it a guardrail. Input and output filtering is worth having as depth, and it catches the loud attacks, but it is probabilistic, which means it belongs behind your deterministic checks rather than instead of them. If a control can be talked out of its job, it is not the control. It is a filter.

The Tenet Everybody Built, and the One They Skipped

It is tempting to say Zero Trust does not fit agents. Having gone back to the source, I think that is wrong, and the real story is more useful.

NIST SP 800-207 lists seven tenets. Tenet 3 is the one everybody built: "Access to individual enterprise resources is granted on a per-session basis." Authenticate the subject, evaluate context, grant the session, and note that access to one resource does not imply access to another.

That tenet carried assumptions that agents break. It assumed the subject was slow and countable, where a person makes a few dozen meaningful access decisions a day and an agent makes hundreds a minute. It assumed the subject had judgment, because access control has always been a coarse filter that humans refine at runtime. An engineer with production database access does not run DELETE without a WHERE clause. Not because policy stops them, but because they know better. An agent does not know better. It knows what completes the task.

Most of all, it assumed the session was the unit of risk. For agents, that is exactly wrong. The connection is the boring part. A coding agent is supposed to reach your repository host. What matters is which operation it is about to perform once it gets there. Reading a file is fine. Opening a pull request is probably fine. Force-pushing to a protected branch is not. All three ride the same authorized connection with the same token.

Here is the part I did not expect. Tenet 4 already says that "resource access and action permission policies can vary based on the sensitivity of the resource/data." NIST wrote action-level control into the spec in 2020. Tenet 3 got built out properly, because for human users the session was a good enough proxy and the tooling grew up around that choice. Tenet 4 mostly did not.

Agents remove the proxy. Once a subject can fire off hundreds of requests a minute with no judgment sitting behind any of them, Tenet 4 stops being an optional refinement and becomes the part that does the actual work. Everything practical in this article follows from taking it seriously.

Five Things That Actually Change

Give the agent its own identity, and make it a delegate rather than an impersonator. Most deployments I see run the whole fleet under one service account, or hand the agent the end user's token. Both destroy attribution.

RFC 8693 named this distinction six years ago. Impersonation means the agent is the user, indistinguishable downstream. Delegation is different. The agent stays itself, and the act (actor) claim records who it is working for. Handing an agent a user token is impersonation, and it is why your logs cannot tell you who did what. Use delegation. The spec even defines may_act so you can declare in advance which agents are permitted to act for a given subject.

Scope to the task, not the role. Role-based access assumes durability, that a subject and a resource have an ongoing relationship worth naming. Agent work is not durable. It is a task, which means it ends, and while it runs there are only a few things it legitimately needs to touch. Issue a capability at the start and let it die with the task.

Python
 
import time, uuid, jwt

def issue_capability(user_sub, agent_id, task_id, actions, audience, ttl=120):
    now = int(time.time())
    claims = {
        "iss": "https://broker.internal",
        "aud": audience,
        "sub": user_sub,                   # who this is on behalf of
        "act": {"sub": agent_id},          # RFC 8693: the acting party
        "jti": str(uuid.uuid4()),
        "iat": now,
        "exp": now + ttl,
        "task_id": task_id,
        "actions": actions,                # ["orders:read"]
        "constraints": {"customer_id": "C-8841", "max_rows": 50},
        "constraint_source": "ticket:48812",
    }
    return jwt.encode(claims, PRIVATE_KEY, algorithm="RS256")


Enforcement is deterministic code, outside the model, that does not care how persuasive the ticket body was:

Python
 
def authorize(token, action, params):
    c = jwt.decode(token, PUBLIC_KEY, algorithms=["RS256"], audience="orders-api")
    if action not in c["actions"]:
        raise Denied(f"{action} not granted for task {c['task_id']}")
    k = c["constraints"]
    if params.get("customer_id") != k["customer_id"]:
        raise Denied("query scope exceeds task constraint")
    if params.get("limit", 0) > k["max_rows"]:
        raise Denied("row limit exceeds task constraint")


Note constraint_source. It records where the constraint came from. When you investigate later, that field is how you trace a bad action back to the input that shaped it.

Stop letting the agent hold credentials. If the agent process holds the API key, every bug becomes a credential bug. A verbose stack trace will do it. So will any code the agent can be talked into running. Put a broker in front of the tools. The agent submits an action and receives a result. The key stays on the broker and is attached to the outbound call there, in a process the agent cannot read.

Python
 
# No key exists in this process.
result = broker.invoke(
    capability=cap_token,
    tool="orders.read",
    params={"customer_id": "C-8841", "limit": 25},
)


Architecture diagram: an agent inside an untrusted execution zone holds no credentials and sends a task-scoped capability token to a broker. The broker verifies the signature, checks the action is granted, enforces constraints, and holds the credential. It makes the authenticated call to the tool or API and returns only the result, with no secret crossing back to the agent. A separate branch shows one audit event emitted per action.

Agent Authentication Sequence


That gap is the point. An agent permitted to call the orders API but unable to construct the call unaided has a far smaller failure mode than one carrying a key. Compromise it, and you inherit its permissions for as long as the capability lives, which is two minutes, rather than a secret you can copy out and reuse next month.

Run generated code as hostile. Code your agent writes is untrusted by construction, produced by a probabilistic process partly steered by input you do not control. Isolated runtime, no network egress, no ambient credentials, read-only filesystem outside a scratch directory, wall-clock limit, memory cap. Container isolation alone is thin. For anything customer-facing, kernel-level isolation through a microVM or a user-space kernel is the right default.

Log the action, not the request. Most agent logging captures the prompt and the completion. That tells you what was said, not what was done. Emit a structured event per tool call.

Python
 
{
  "ts": "2026-09-11T14:22:07Z",
  "task_id": "t-91ac",
  "sub": "user:8f21c",
  "actor": "spiffe://corp/ns/support/sa/ticket-agent",
  "tool": "orders.read",
  "params_hash": "sha256:9f2c4e...",
  "decision": "allow",
  "policy": "cap-scope-v3",
  "constraint_source": "ticket:48812"
}


At two in the morning, nobody wants to know what the model said. They want to know what it touched and who let it. That schema tells them.

What a Task Boundary Does Not Fix

The scoping advice above has a hole in it, and it is better to name it than to hope nobody notices. Two, in fact, and both sit in territory the LLM Top 10 only partly reaches. OWASP now runs a separate Agentic Security Initiative for roughly this reason.

A capability that expires with the task is only a boundary if nothing crosses between tasks. Agents with persistent memory carry plenty. An attacker who gets one sentence into that memory does not need a live capability afterwards. Your broker will issue them a fresh one later, on request, correctly scoped and entirely legitimate, and every deterministic check will pass, because nothing about the request is malformed. The constraint was never wrong. The context it was reasoning over was. Short-lived credentials do nothing about long-lived beliefs.

So treat durable memory as an input channel with the same standing as a ticket body. Record what produced every write. Memory you cannot attribute is memory you cannot roll back, and eventually you will want to. Do not load the agent's whole history into context by default either; scope reads to the task. Expire entries. Version it, so that when something does get in, you can see the diff.

The second hole is in the broker itself. A tool description is text the model reads and acts on, so a tampered one is prompt injection arriving with your own infrastructure's authority behind it and none of the suspicion you would apply to user input. That is a large enough problem to deserve its own treatment, and it has had some good ones. The short version: pin your tool definitions and review changes to them the way you review a dependency bump.

When Agents Call Agents

Everything above assumes one agent. Add a second and enforcement has to survive the hop between them, which is exactly where most designs quietly stop checking and fall back to trusting the session.

Multi-agent systems break one assumption people carry in without noticing: that the output of your own code is trustworthy input.

It is not. OWASP files this under Improper Output Handling (LLM05:2025), and the point is that model output needs validating before anything downstream acts on it. And the Excessive Agency entry explicitly lists a "malicious/compromised peer agent" as an injection source in collaborative systems. An injected planner does not announce itself. It just emits a task that looks fine, and the next agent runs it on its own permissions.

So validate at every hop, not just at the system edge. If a planner hands a retrieval agent a query, that query gets schema-checked and constraint-checked the same way a user request would. Two agents in the same process boundary are still two trust domains.

RFC 8693 already solved the identity half of this, and I would take its rule as written. A delegation chain nests act claims, outermost being the current actor and deeper ones being prior actors:

Python
 
"sub": "user:8f21c",
"act": {
  "sub": "spiffe://corp/ns/support/sa/ticket-agent",
  "act": { "sub": "spiffe://corp/ns/support/sa/orchestrator" }
}


The spec is precise about what to do with that chain. For the purpose of applying access control policy, it says, "the consumer of a token MUST only consider the token's top-level claims and the party identified as the current actor by the act claim," while prior actors are "informational only and are not to be considered in access control decisions." That is the right default for agent chains. A sub-agent never inherits its parent's permissions, and the parentage exists for forensics rather than for privilege.

What This Costs

I would rather be honest about the bill than pretend this is free.

You are adding a hop. Token issuance plus a broker round trip is real latency on every tool call, and agents make many. Budget for it and keep the broker close to the tools.

You are creating a dependency. The broker sits on the critical path for every agent action in your estate. It needs the availability engineering you would give an identity provider, because that is effectively what it now is.

You are taking on a catalog. Somebody has to define what actions exist, what constraints each accepts, and who may grant them. Teams underestimate this. None of it is difficult. It just never finishes.

And you will annoy your developers, at least at first. The honest counterargument is that this is the same trade the industry already made with secret management and with infrastructure as code. It felt like friction for about a year, and then it was just how things were done.

Where to Start Next

You do not need a program. You need a week.

Inventory what is actually running. Every organization has more agents in production than the security team knows about, usually a scheduled job or a chat integration somebody wired up in an afternoon.

Find the shared credentials. Grep your agent code for long-lived keys and for any place a fleet shares a service account or borrows a user token. That list is your blast radius, and I have never once seen it come back shorter than the team guessed.

Then pick exactly one tool with a write path, because write paths are where the damage lives, and put it behind a broker with a task-scoped capability. One tool. Measure the latency, learn what breaks, use the result to argue for the rest.

If you have to justify the work upward, MITRE ATLAS documents real attacks on AI systems and makes the case better than hypotheticals do, while the NIST AI Risk Management Framework and its Generative AI Profile supply the governance vocabulary to wrap around it.

If you take one thing from this, make it the delegation point. An agent carrying a user's token is claiming to be that user, and everything downstream will believe it, including your own audit log six months from now when somebody asks you to reconstruct what happened. RFC 8693 drew that line in 2020 and handed you the claim to express it with. Almost nobody deploying agents has read it.

The rest follows from there. Once the agent has a name of its own, you can scope what it does to the job in front of it, keep the credential somewhere it cannot reach, and write down what it actually touched. None of that is novel security thinking. It is the ordinary kind, applied to a new sort of principle that happens to work faster than anyone reviewing it.

References

  1. Rose, S., Borchert, O., Mitchell, S., and Connelly, S. Zero Trust Architecture. NIST Special Publication 800-207, National Institute of Standards and Technology, August 2020. https://doi.org/10.6028/NIST.SP.800-207
  2. OWASP Top 10 for LLM Applications, LLM01:2025 Prompt Injection. OWASP GenAI Security Project. https://genai.owasp.org/llmrisk/llm01-prompt-injection/
  3. OWASP Top 10 for LLM Applications, LLM05:2025 Improper Output Handling. OWASP GenAI Security Project. https://genai.owasp.org/llmrisk/llm052025-improper-output-handling/
  4. OWASP Top 10 for LLM Applications, LLM06:2025 Excessive Agency. OWASP GenAI Security Project. https://genai.owasp.org/llmrisk/llm062025-excessive-agency/
  5. OWASP Agentic Security Initiative, Agentic AI: Threats and Mitigations. OWASP GenAI Security Project. https://genai.owasp.org/resource/agentic-ai-threats-and-mitigations/
  6. Jones, M., Nadalin, A., Campbell, B. (Ed.), Bradley, J., and Mortimore, C. OAuth 2.0 Token Exchange. RFC 8693, IETF, January 2020. https://www.rfc-editor.org/rfc/rfc8693.html
  7. Artificial Intelligence Risk Management Framework (AI RMF 1.0). NIST AI 100-1, January 2023. https://doi.org/10.6028/NIST.AI.100-1
  8. Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile. NIST AI 600-1, July 2024. https://doi.org/10.6028/NIST.AI.600-1
  9. MITRE ATLAS (Adversarial Threat Landscape for Artificial-Intelligence Systems). https://atlas.mitre.org
AI API HTTPS security Task (computing) Trust (business) Data Types artificial intelligence large language model zero trust

Opinions expressed by DZone contributors are their own.

Related

  • Building an AI-Powered Incident Triage Agent with .NET Aspire
  • AI Agents vs LLMs: Choosing the Right Tool for AI Tasks
  • Zero Trust, Build High Scale TLS Termination Layer
  • Anthropic’s Model Context Protocol (MCP): A Developer’s Guide to Long-Context LLM Integration

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook