Subscribe to the Non-Human & AI Identity Journal

What do organisations get wrong about securing AI agents with secrets?

They often treat shared secrets and fixed tokens as acceptable trust mechanisms for agents that behave dynamically. That approach creates durable credentials for a system that may need short-lived, tightly scoped, and revocable trust. The better model is cryptographic identity with connection-level verification and fast revocation.

Why This Matters for Security Teams

The mistake is not just using secrets for AI agents, but using the wrong trust model for a workload that can change intent, chain tools, and act faster than manual review can contain. Static tokens and shared API keys create durable access for a system whose effective privileges should be narrow, task-bound, and revocable. That gap shows up in agentic ai risk guidance from OWASP Agentic AI Top 10 and in NHI research on how secrets sprawl persists across modern environments.

NHIMG’s Guide to the Secret Sprawl Challenge shows why this becomes operationally dangerous: secrets do not stay confined to a single runtime, and once exposed they are often still valid long after detection. That is especially problematic for agents because their access patterns are not stable enough for human-style entitlement models. Security teams often assume a secret is acceptable if it is vaulted, but vaulting alone does not solve over-privilege, poor scoping, or delayed revocation. The better question is whether the agent can prove what it is doing at the moment of access, not whether it once received a token. In practice, many security teams encounter agent secret abuse only after a prompt chain, connector, or CI/CD path has already expanded the blast radius.

How It Works in Practice

securing ai agents starts with replacing “one secret per service” thinking with workload identity and runtime authorisation. A secret should not be the identity of the agent; it should be a short-lived mechanism that supports a verified workload identity such as SPIFFE or an OIDC-based workload token. The core principle is that the agent proves what it is first, then receives only the minimum access needed for the current task. That aligns with NIST AI Risk Management Framework and CSA MAESTRO agentic AI threat modeling framework, both of which push organisations toward context-aware governance rather than fixed trust.

In practice, strong patterns include:

  • Issuing JIT credentials per task, not long-lived tokens that survive across agent runs.
  • Binding secrets to workload identity, device attestation, or service mesh identity where possible.
  • Using policy-as-code for real-time decisions, so access can reflect prompt, tool, destination, and risk context.
  • Revoking credentials automatically when the task completes, the session changes, or the agent behaves outside policy.
  • Segmenting tool access so one compromised connector cannot become a universal credential bridge.

NHIMG’s State of Secrets Sprawl 2026 underscores why this matters: leaked secrets often remain valid, which means detection without automated revocation is only partial defence. The operational goal is to make every access decision ephemeral, contextual, and inspectable. These controls tend to break down when agents are embedded in legacy service accounts or batch pipelines because those environments assume stable, long-lived credentials and offer little runtime context for policy evaluation.

Common Variations and Edge Cases

Tighter secret controls often increase orchestration overhead, so organisations have to balance operational speed against revocation certainty. That tradeoff is real, especially when agents span SaaS APIs, internal tools, and ephemeral compute. There is no universal standard for how to express agent intent at runtime yet, but current guidance suggests that context-aware policy is safer than static role mapping for autonomous workloads.

Common edge cases include multi-agent systems, where one agent delegates to another and inherits access in ways that are difficult to model with traditional RBAC, and human-in-the-loop workflows, where temporary access still needs strict expiry and auditability. Another frequent failure mode is secret reuse across environments, such as using the same token in development, test, and production, which defeats compartmentalisation. NHIMG’s OWASP NHI Top 10 is useful here because it frames non-human access as a governance problem, not merely a vaulting problem. For implementation detail, the OWASP Non-Human Identity Top 10 remains a strong reference point for credential lifecycle risks. Best practice is evolving, but the direction is clear: static secrets should be the exception, not the default, for agents.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 and CSA MAESTRO address the attack and risk surface, while NIST AI RMF set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Agentic AI Top 10 A2 Agentic systems need runtime controls for dynamic tool use and shifting intent.
CSA MAESTRO T1 MAESTRO addresses threat modeling for autonomous agent workflows and credentials.
NIST AI RMF GOVERN AI RMF governs accountable, risk-based management of autonomous AI behavior.

Replace static access grants with task-scoped, context-aware policy checks at each tool invocation.