Est.

JWE vs JWT for Sensitive Payloads in Agent Requests

Signed tokens prove origin but expose claims to every system.

· 8 min read
Cover illustration for “JWE vs JWT for Sensitive Payloads in Agent Requests”
OAuth in AI Systems · November 15, 2026 · 8 min read · 1,879 words

Signed JWTs protect against tampering while leaving their contents readable. For agent requests, the choice between JWS and JWE depends on what the claims reveal and which systems can see them. Sensitive claims need to stay out of the token or travel encrypted when the pipeline cannot protect them. That choice belongs in an enforceable access policy governing each developer’s configuration.

Why a signed JWT is not a confidential one

RFC 7519 defines JSON Web Token, while RFC 7515 defines JSON Web Signature, the signing mechanism used by signed JWTs. In a typical signed token, the header and payload are encoded using a text encoding scheme. The encoding can be reversed without a secret key. Anyone who sees the token can decode its payload, whether they encounter it in a proxy, a log pipeline, or a browser dev-tools panel. The jumbled string is not a confidentiality control.

The signature answers a different question entirely. When properly validated, it establishes that the token came from the expected issuer and has not been altered. It does not limit who can read the claims. A token can therefore pass every signature check while exposing its contents to systems that should never see them. Confusing those protections is the root mistake.

RFC 7516 defines JSON Web Encryption, which encrypts content for its intended recipient. A compact JWE has five parts, namely the Protected Header, Encrypted Key, Initialization Vector, Ciphertext, and Authentication Tag. That differs from the three-part signed token. The tag protects against tampering with the ciphertext, while encryption prevents an intermediary without the required key from reading the payload. JWT is the broader format.

JWS and JWE thus solve different problems. One provides integrity and authenticity, while the other provides confidentiality for the encrypted content. They can also be combined when a request needs both protections. Choosing between them starts with the protection the claims need.

Where the readable payload actually travels in an agent pipeline

Tokens can pass through proxies, API gateways, log collectors, vector databases, temporary caches, and calls to sub-agents. Each component that gets a signed token can decode its claims, even if its job never called for reading them. A workflow therefore exposes more than the final API endpoint. It exposes every place where the token becomes available.

Observability can make that exposure persist beyond the request. Structured logs and distributed traces often store request headers and bodies, so an Authorization header that contains a JWT can end up in logs at several points. HTTPS protects the channel, while the token is available before transport encryption and after TLS termination. A readable payload remains readable wherever the encrypted connection ends.

Agents widen the route further by spawning sub-agents, caching credentials, and passing tokens as parameters to downstream tools. Unlike a fixed service graph, an agent can generate a workflow that crosses boundaries its developers did not anticipate. Those handoffs complicate both confidentiality and authorization. A sub-agent that combines payment, loyalty, identity, and merchant data may assemble information for purposes the user never authorized, without producing an obvious breach signal. Encryption alone cannot decide how that data may be used.

The IETF Agentic JWT draft, draft-goswami-agentic-jwt-01, from June 2026 addresses the separation between user intent and agent execution. The draft does not make every agent token confidential. Instead, it adds identity and workflow concepts that help explain who should receive a token and under what binding, which becomes important when choosing its protection.

The payload types that turn log exposure into a compliance event

An email address, an internal user ID, and a government identifier need assessment based on what they reveal and where they appear. OWASP ASVS 5.0 asks that sensitive data be identified and classified into protection levels, including data that is merely encoded. A Base64 string still needs to be classified. So does personal data inside a signed JWT.

The legal consequences depend on more than log presence. Under GDPR, personal identifiers exposed in backend logs may be a personal data breach, and whether it must be reported depends on the likely risk to individuals’ rights and freedoms. Under CCPA/CPRA, liability depends on unauthorized access and exfiltration involving the specific statutory data categories. California residents’ identifiers can be covered data, but a readable identifier in a log does not automatically trigger either notification obligation.

Retention can extend the exposure for years. NYDFS guidance says that existing Part 500 cybersecurity program requirements apply to the AI systems that covered financial services firms use. Financial compliance rules also require firms to keep logs for a long time. A short-lived token does not make its logged contents short-lived.

Telling an agent not to access certain PHI categories does not count as a technical access control under HIPAA’s Security Rule. Prompts can be bypassed through injection, changed by model updates, or circumvented through multi-step workflows. JWE is a data-layer confidentiality control, whereas a prompt is not. Access policy still needs to govern encryption, because hiding claims from intermediaries does not decide whether the intended recipient should get them.

How to map claim sensitivity to the right token format before writing any code

The planning method starts with a claim inventory. A team should identify every field and assess whether its appearance in a log, proxy, or downstream service would be harmful or potentially reportable. That establishes the first axis, which is sensitivity. The second is pipeline trust, meaning whether every component that can see the token is authorized to read its contents. The format follows those two answers.

An opaque user ID that requires a server-side lookup can keep resolved personal information out of the token. For non-sensitive references within a trusted pipeline, JWS may be enough. Sensitive resolved values change the decision, including email, detailed role entitlements, session context containing PHI, and financial account references. Those values need removal from the token or encryption when disclosure would be harmful. A lookup-based design is often cleaner because it avoids placing the sensitive data in the token at all.

JWS may be enough for Non-PII claims that stay inside a single internal service and are never logged in full. Tokens need encryption when they cross domain boundaries, pass through third-party infrastructure, or end up in browser storage or mobile caches. When proof of origin must also survive that crossing, sign-then-encrypt wraps a JWS inside a JWE. The recipient can then validate the signed content while intermediaries cannot read it.

The agentic draft adds another planning consideration. Its Intent Token is compatible with JWS and JWE, and its agent checksum draws on system prompts, tools, and model parameters. Workflow-aware binding links user intent as well as user identity to agent execution. If the intended recipient is a specific agent instance, that identity can support per-recipient key management. It does not remove the need to decide which claims that agent may receive.

The resulting choice is not simply JWT or JWE. A team may use JWS for non-sensitive references, JWE for claims that must remain confidential in transit through intermediaries, or neither format as a container for resolved sensitive values. Where a server-side lookup is available, the sensitive payload can remain outside the token. Where context must travel with the request, encryption becomes a required control.

Algorithm choices and operational costs that engineering teams need to price in

JWE adds work at defined points in the pipeline. Encryption consumes CPU at the authorization server, and decryption adds work at the API gateway or target service. Those operations affect latency and throughput planning. They do not have to occur at every intermediate hop, because an intermediary without decryption access simply handles ciphertext.

Key management is the larger operational change. In a common asymmetric arrangement, a symmetric Content Encryption Key encrypts the payload with AES, while recipient key management protects that key using RSA or ECDH-based mechanisms. Accepting a token now involves managing decryption keys, when to rotate them, and how to handle recipients. Signing and encryption keys should be treated as distinct assets. Rotating only one side or applying inconsistent validation across services can leave tokens unreadable or easier to abuse.

Algorithm selection needs an explicit decision too. A256GCM, which uses AES-256 in Galois/Counter Mode, provides authenticated encryption and is preferable for new systems. A128CBC-HS256 combines CBC encryption with HMAC and is correct when implemented properly, but it is more fragile and should be avoided in new designs where possible. ECDH-ES+A256KW is a sound modern choice for elliptic-curve key agreement. These choices do different jobs, so after choosing content encryption, teams still need to decide how to handle recipient keys.

For JWS, an explicit algorithm allowlist must exclude “none,” and the same discipline of accepting only intended algorithms applies to JWE recipient handling. Compliance claims need similar precision. As of late 2026, the proposed 2025 HIPAA amendments have not been enacted, and the proposed text calls for encryption meeting prevailing NIST cryptographic standards. It does not explicitly mandate FIPS 140-3 validated module certification specifically for AI data paths, so neither a broad AES-256 claim nor an invented certification requirement is a sound basis for the decision.

The strongest alternative to JWE is often architectural. A server-side lookup can produce smaller tokens, keep PII out of them, and avoid encryption-key distribution complexity. That option is not always available. Offline processing, edge functions, and multi-hop sub-agent calls may need context in the token because they cannot do the lookup. Where sensitive claims must travel and the pipeline cannot otherwise keep them confidential, JWE’s operational cost buys a protection that signing cannot provide.

What governed MCP infrastructure changes about this decision for enterprise AI teams

For enterprise AI, these decisions need a common enforcement point. A governed gateway can make pipeline trust boundaries visible and turn confidentiality requirements into policy shared across teams. An ungoverned MCP server passing readable tokens to log collectors and downstream tools is already a disclosure surface. The weakness starts when no one reviews how tokens are handled. Discovery of a breach is not what creates it.

That review requires knowing which connections are there. Every MCP server added without a registry entry introduces an identity whose token handling cannot be accounted for. Visibility also needs to exist before an incident, so access records can support operational control as well as a postmortem. MCP Manager, an MCP gateway, is one option for giving enterprises visibility into the AI tool and data connections their agents use. That inventory can help show where a move from JWS to JWE is needed.

Visibility alone does not authorize a workflow. Attribute-based access control gives policy a way to address the conditions of access, while role-based or perimeter-based controls alone are insufficient when agents cross system boundaries. Guardrails and roles still have a place. Their purpose is to put an agent’s permitted actions, including those set by token defaults, under deliberate organizational control. Confidentiality policy belongs in that same governance layer.

A team that inventories claims, maps their route, and enforces the resulting token requirements can make the decision auditable and repeatable. Teams can still choose how to implement the requirements, but their choices must stay within an agreed boundary. Without that boundary and centralized visibility, the organization has no reliable record of which pipelines expose sensitive claims in readable form, a governance failure already in progress.

Sources

  1. JSON Web Encryption (JWE) - Broadcom TechDocs

More in OAuth in AI Systems