News

The Trivy Compromise: The Fallacy of Secrets Management and the Case for Workload Identity

  • Apurva Dave--securityboulevard.com
  • published date: 2026-03-23 00:00:00 UTC

None

<div data-elementor-type="wp-post" data-elementor-id="56445" class="elementor elementor-56445" data-elementor-post-type="post"> <div class="elementor-element elementor-element-6f26a2cf e-flex e-con-boxed e-con e-parent" data-id="6f26a2cf" data-element_type="container" data-e-type="container"> <div class="e-con-inner"> <div class="elementor-element elementor-element-3637114d elementor-widget elementor-widget-text-editor" data-id="3637114d" data-element_type="widget" data-e-type="widget" data-widget_type="text-editor.default"> <div class="elementor-widget-container"> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">JWT and OAuth show up together in nearly every authentication system, which is why engineers often treat them as interchangeable. They are not. OAuth is an authorization framework that defines how to grant access. JWT is a token format that defines how to package and transmit claims. They solve different problems, and most production systems use both.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The confusion between them leads to real security gaps, especially in machine-to-machine communication, where workloads cannot use browser logins or MFA prompts. Understanding where JWT ends and OAuth begins is the first step toward implementing <a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/7-ways-to-authenticate-workloads-to-each-other/">workload authentication</a> correctly.</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">JWT vs. OAuth: What’s the Difference?</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">OAuth 2.0 governs how applications <a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/mcp-oauth-2-1-pkce-and-the-future-of-ai-authorization/">obtain limited access</a> to resources without exposing credentials. It specifies multiple authorization flows for different scenarios and manages the lifecycle of access tokens: issuance, scoping, refresh and revocation. OAuth determines what a requester can access, not who they are.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The authorization code flow is designed for web applications where server-side code can securely store secrets and handle user consent. The client credentials flow is built for machine-to-machine communication where no user interaction occurs: services authenticate directly to the authorization server using their client ID and secret to receive access tokens. Token exchange (RFC 8693) enables workloads to swap one token type for another across trust boundaries, such as exchanging an AWS IAM token for an Azure access token.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">JSON Web Token (JWT) is a compact, URL-safe token format for transmitting information between parties as a signed JSON object. Every JWT contains a header declaring the signing algorithm, a payload carrying claims (issuer, subject, audience, expiration, permissions) and a cryptographic signature that proves the token has not been tampered with. Because all necessary information is embedded in the token itself, receiving services can validate JWTs locally without calling back to a central server.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The core distinction is that OAuth is a protocol defining a process, while JWT is a format defining a data structure. In practice, OAuth often issues JWTs as its access tokens, which is why the two appear together so frequently.</p> <div class="overflow-x-auto w-full px-2 mb-6"> <table class="min-w-full border-collapse text-sm leading-[1.7] whitespace-normal"> <thead class="text-left"> <tr> <th class="text-text-100 border-b-0.5 border-border-300/60 py-2 pr-4 align-top font-bold" scope="col"> </th> <th class="text-text-100 border-b-0.5 border-border-300/60 py-2 pr-4 align-top font-bold" scope="col">JWT</th> <th class="text-text-100 border-b-0.5 border-border-300/60 py-2 pr-4 align-top font-bold" scope="col">OAuth</th> </tr> </thead> <tbody> <tr> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top"><strong>What it is</strong></td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">A token format (RFC 7519)</td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">An authorization framework (RFC 6749)</td> </tr> <tr> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top"><strong>Primary role</strong></td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Package and transmit signed claims between parties</td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Delegate and control access to protected resources</td> </tr> <tr> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top"><strong>Statefulness</strong></td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Stateless: validated locally using the signature and claims</td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Stateful: requires an authorization server to issue and manage tokens</td> </tr> <tr> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top"><strong>Revocation</strong></td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Cannot be revoked before expiration without additional infrastructure</td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Tokens can be revoked at the authorization server</td> </tr> <tr> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top"><strong>Scope</strong></td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Carries claims; does not define how tokens are issued or refreshed</td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Defines issuance, refresh, scoping and revocation workflows</td> </tr> <tr> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top"><strong>Use alone?</strong></td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Yes, for simple signed assertions between trusted parties</td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Yes, but needs a token format (often JWT) to carry access information</td> </tr> <tr> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top"><strong>Common pairing</strong></td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Used as the token format inside OAuth flows</td> <td class="border-b-0.5 border-border-300/30 py-2 pr-4 align-top">Issues JWTs as access tokens and uses OIDC for identity</td> </tr> </tbody> </table> </div> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">How JWT and OAuth Work Together</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">In most production systems, OAuth and JWT complement each other rather than competing. OAuth 2.0 defines the authorization flow and token lifecycle. <a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/oauth-vs-oidc-difference-when-to-use/">OpenID Connect</a> (OIDC), an identity layer built on top of OAuth 2.0, adds authentication by issuing ID tokens as JWTs that contain verified claims about the authenticated entity.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">A typical workload authentication flow using both protocols:</p> <ol class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">A service needs access to a protected resource and authenticates to the OAuth authorization server using the client credentials flow.</li> <li class="whitespace-normal break-words pl-2">The authorization server validates the credentials, evaluates access policies and issues a JWT access token containing the authorized scopes and claims.</li> <li class="whitespace-normal break-words pl-2">The service presents this JWT to the resource server, which validates the signature and claims before granting access.</li> </ol> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">This pairing works because OAuth handles the complexity of token issuance and lifecycle management while JWT enables the resource server to validate tokens locally without calling back to the authorization server on every request. In distributed systems with hundreds of microservices, that local validation eliminates a network round trip on every API call.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The confusion between JWT and OAuth often stems from their overlapping presence in this flow. When engineers refer to “OAuth authentication,” they are usually describing OAuth authorization combined with token-based identity verification using JWTs issued through OIDC. Recognizing that distinction prevents architectural mistakes like using raw JWTs for authorization decisions without an OAuth framework to manage their lifecycle.</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">OAuth 2.1 and Workload Authentication</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">OAuth 2.1 consolidates years of security lessons into a single specification (currently in late-stage IETF draft, not yet published as a final RFC, but widely adopted by major authorization servers). It deprecates the implicit flow and resource owner password credentials flow, requires PKCE for all authorization code flows, requires refresh tokens for public clients to be either sender-constrained or one-time use (making rotation the standard implementation in practice) and recommends sender-constrained tokens through mutual TLS. For workload and machine-to-machine use cases, OAuth 2.1 standardizes how client credentials are exchanged, how access tokens are scoped and how token exchange (RFC 8693) works across environments. Emerging frameworks for AI agent interoperability, including the Model Context Protocol (MCP), depend on these principles. OAuth 2.1 enables standardized authorization between agents, services and APIs using short-lived, verifiable JWTs without persistent secrets.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Applying OAuth and JWT to workloads introduces challenges that do not exist in human authentication. Humans can use MFA, push notifications and browser logins. Workloads cannot. They rely on certificates, attestation or tokens, which means the traditional OAuth client credentials approach of storing a client secret in a container image or environment variable creates a persistent attack vector.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Attestation-based authentication addresses this by eliminating long-lived secrets entirely. Instead of managing stored credentials, workloads authenticate using cryptographically verifiable identity claims about their runtime environment: the cloud instance they run on, the Kubernetes namespace they belong to, the security posture of their host. The authorization server validates these claims and issues short-lived JWTs scoped to the specific resources the workload needs. The workload never handles a persistent secret, and the JWT expires after a brief window, limiting exposure if intercepted. For multicloud and hybrid environments, <a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/what-identity-federation-means-for-workloads-in-cloud-native-environments/">workload identity federation</a> extends this model across cloud boundaries. A workload in one cloud presents its cryptographically signed identity token, which the target authorization server validates and exchanges for a new JWT scoped to local resources. This eliminates the need to provision duplicate service accounts across clouds while maintaining the same <a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/secrets-management-vs-access-management-what-you-need-to-know/">secretless security model</a>.</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Choosing the Right Approach for Your Architecture</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The right implementation depends on how many clouds you operate in, whether you can modify application code and how much credential management overhead you can absorb. Each pattern below applies OAuth and JWT differently based on those constraints.</p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Single Cloud, Single Identity Provider</h3> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Use cloud-native managed identities. AWS IAM roles, Azure Managed Identities and GCP Service Accounts implement OAuth and JWT internally while eliminating credential storage. Your application authenticates through the cloud’s metadata service and receives JWT access tokens without managing secrets. Kubernetes ServiceAccounts provide pod-level identity within a cluster and can be projected as OIDC tokens for federation with cloud IAM. This approach works well within a single cloud but requires federation for cross-cloud access.</p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Multicloud or Hybrid Environments</h3> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Implement workload identity federation with centralized policy. Use OAuth 2.0 token exchange (RFC 8693) to enable workloads in one cloud to access resources in another. A workload presents its home-cloud JWT, which the target authorization server validates and exchanges for a new JWT scoped to local resources. This requires a federation platform that can validate tokens from multiple issuers and enforce consistent policy across clouds. The benefit is that you avoid provisioning duplicate service accounts and managing separate credential stores in each cloud. A single identity assertion, verified cryptographically, grants access across trust boundaries.</p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Legacy Applications Without Code Changes</h3> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Use a broker or proxy pattern. A proxy intercepts outgoing requests from a microservice, handles OAuth flows, JWT validation, token refresh and credential injection transparently. The application makes standard HTTP requests without any awareness that the proxy is managing authentication. This pattern is particularly useful for AI agent and <a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/mcp-authentication-and-authorization-patterns/">MCP integrations</a> where modifying the application code is not practical.</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Where to Start</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">If you are evaluating JWT vs. OAuth for a new project, start by clarifying what problem you are solving. If you need to package signed claims for stateless validation, JWT is the format. If you need to delegate and control access across services, OAuth is the framework. Most production systems need both: OAuth to manage the authorization lifecycle and JWT to carry the resulting access information.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">For workload authentication, the priority is eliminating static credentials. Every client secret stored in an environment variable or config file is a credential that can be leaked, stolen or reused. Moving to attestation-based authentication with short-lived JWTs issued through OAuth flows removes that attack vector entirely. Start by auditing which workloads still rely on long-lived client secrets and identify which can be migrated to identity federation or managed identities.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/product-overview/">Aembit</a> implements this model at scale. The platform uses environment attestation to prove workload identity through the OAuth 2.0 client credentials flow with cryptographic verification rather than traditional client secrets, then issues short-lived JWT access tokens with automatic refresh. The platform handles cross-cloud federation, conditional access policies and transparent credential injection so that developers never write authentication code.</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Related Reading</h2> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/dynamic-authorization-vs-static-secrets-rethinking-cloud-access-controls/">Dynamic Authorization vs. Static Secrets</a></li> <li class="whitespace-normal break-words pl-2"><a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/frictionless-devops-identity-management/">Frictionless Security: What DevOps Teams Really Need</a></li> <li class="whitespace-normal break-words pl-2"><a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/the-what-where-and-why-of-workload-identity-and-access-management/">The What, Where, and Why of Workload IAM</a></li> <li class="whitespace-normal break-words pl-2"><a class="underline underline underline-offset-2 decoration-1 decoration-current/40 hover:decoration-current focus:decoration-current" href="https://aembit.io/blog/aembit-adds-aws-workload-identity-federation-wif-support/">Aembit Adds AWS Workload Identity Federation Support</a></li> </ul></div> </div> </div> </div> </div><p>The post <a href="https://aembit.io/blog/the-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity/">The Trivy Compromise: The Fallacy of Secrets Management and the Case for Workload Identity</a> appeared first on <a href="https://aembit.io/">Aembit</a>.</p><div class="spu-placeholder" style="display:none"></div><div class="addtoany_share_save_container addtoany_content addtoany_content_bottom"><div class="a2a_kit a2a_kit_size_20 addtoany_list" data-a2a-url="https://securityboulevard.com/2026/03/the-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity/" data-a2a-title="The Trivy Compromise: The Fallacy of Secrets Management and the Case for Workload Identity"><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fsecurityboulevard.com%2F2026%2F03%2Fthe-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity%2F&amp;linkname=The%20Trivy%20Compromise%3A%20The%20Fallacy%20of%20Secrets%20Management%20and%20the%20Case%20for%20Workload%20Identity" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fsecurityboulevard.com%2F2026%2F03%2Fthe-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity%2F&amp;linkname=The%20Trivy%20Compromise%3A%20The%20Fallacy%20of%20Secrets%20Management%20and%20the%20Case%20for%20Workload%20Identity" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fsecurityboulevard.com%2F2026%2F03%2Fthe-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity%2F&amp;linkname=The%20Trivy%20Compromise%3A%20The%20Fallacy%20of%20Secrets%20Management%20and%20the%20Case%20for%20Workload%20Identity" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fsecurityboulevard.com%2F2026%2F03%2Fthe-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity%2F&amp;linkname=The%20Trivy%20Compromise%3A%20The%20Fallacy%20of%20Secrets%20Management%20and%20the%20Case%20for%20Workload%20Identity" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fsecurityboulevard.com%2F2026%2F03%2Fthe-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity%2F&amp;linkname=The%20Trivy%20Compromise%3A%20The%20Fallacy%20of%20Secrets%20Management%20and%20the%20Case%20for%20Workload%20Identity" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share"></a></div></div><p class="syndicated-attribution">*** This is a Security Bloggers Network syndicated blog from <a href="https://aembit.io/">Aembit</a> authored by <a href="https://securityboulevard.com/author/0/" title="Read other posts by Apurva Dave">Apurva Dave</a>. Read the original post at: <a href="https://aembit.io/blog/the-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity/">https://aembit.io/blog/the-trivy-compromise-the-fallacy-of-secrets-management-and-the-case-for-workload-identity/</a> </p>