Subscribe to the Non-Human & AI Identity Journal

What breaks when service accounts and API keys are left unrotated in AI systems?

Unrotated secrets extend the attack window long after the original deployment decision is forgotten. In AI systems, that can mean continued access to sensitive data, stale authorisation after ownership changes, and hidden paths for content poisoning. The control failure is not only theft. It is persistence of trust after the business need has changed.

Why This Matters for Security Teams

Left unrotated, service account and api key stop being deployment artefacts and become durable security liabilities. In AI systems, that matters because the same secret may unlock vector stores, model APIs, tool execution, and downstream data systems long after the original task has changed. The result is not just credential theft, but stale trust, hidden persistence, and unauthorised access that survives org changes and vendor churn. Guidance from the OWASP Non-Human Identity Top 10 is clear: non-human identities need the same lifecycle discipline as human identities, but with tighter automation because they operate faster and fail more quietly.

NHIMG research shows why this is not theoretical. In GitGuardian’s State of Secrets Sprawl 2026, 64% of valid secrets leaked in 2022 were still valid and exploitable today, which is exactly what turns an old API key into a standing backdoor. In practice, many security teams encounter this only after a pipeline, agent, or forgotten integration has already been used as the easiest path back in, rather than through intentional review.

How It Works in Practice

Rotation fails for AI systems when secrets are treated as static configuration instead of per-task authority. A service account with broad RBAC can keep functioning after ownership changes, but an autonomous agent can also chain tools, re-use cached tokens, and call APIs in ways the original deployment never anticipated. That is why current guidance increasingly favours intent-based authorisation and just-in-time credentials over long-lived access. With OWASP Non-Human Identity Top 10 as a baseline, the operational question becomes: what is this workload allowed to do right now, and for how long?

A practical control pattern looks like this:

  • Issue short-lived credentials per task, not a reusable static token stored in a config file.
  • Bind the identity to the workload, ideally with workload identity primitives such as OIDC-backed tokens or SPIFFE/SPIRE-style proof of who the agent is.
  • Evaluate policy at request time so access can change when the model, prompt, tool, or data context changes.
  • Revoke automatically when the job completes, the owner changes, or the agent behaves outside its declared intent.

This matters because AI-facing secrets are already a high-risk exposure class. Guide to the Secret Sprawl Challenge documents the scale of sprawl, while the DeepSeek breach shows how exposed credentials and adjacent data can become a broad compromise surface. These controls tend to break down in legacy batch jobs and shared CI/CD runners because the environment assumes one long-lived actor instead of many short-lived, autonomous actions.

Common Variations and Edge Cases

Tighter rotation often increases operational overhead, requiring organisations to balance faster revocation against debugging friction and integration fragility. That tradeoff is real, especially where external partners, embedded agents, or multi-tenant platforms still depend on long-lived service credentials. Best practice is evolving, and there is no universal standard for this yet, but the direction is consistent: reduce standing privilege, shorten token lifetime, and make access revocable without waiting for a manual change window.

Two edge cases deserve attention. First, some teams rotate the secret but leave the entitlement untouched. That only changes the password, not the blast radius. Second, some AI systems use retrieval, tool calling, and background automation so continuously that a “normal” service account never truly goes idle; in those environments, static secrets are especially dangerous because they are valid exactly when defenders assume the system is sleeping. The 52 NHI Breaches Analysis shows that persistence and over-permissioning recur across incident patterns, while the BeyondTrust API key breach reinforces how quickly a single exposed key can become systemic access.

For governance, current guidance suggests aligning this work with OWASP Non-Human Identity Top 10, OWASP Non-Human Identity Top 10, CSA-MAESTRO, and NIST-AIRMF. The practical goal is simple: no AI workload should keep authority longer than the business need that justified it.

Standards & Framework Alignment

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

OWASP Non-Human Identity Top 10 and OWASP Agentic AI Top 10 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 Non-Human Identity Top 10 NHI-03 Directly addresses secret rotation and lifecycle control for non-human identities.
OWASP Agentic AI Top 10 Agentic systems need runtime authorization, not fixed secrets and roles.
NIST AI RMF AI risk governance covers accountability for stale access and unsafe persistence.

Replace static AI secrets with short-lived credentials and automate revocation on owner or task change.