Subscribe to the Non-Human & AI Identity Journal

What do organisations get wrong about exposed API keys and tokens?

They often assume the main issue is where the secret was found, when the deeper issue is who still trusts it. A leaked credential can remain dangerous long after discovery if it is embedded in workflows, third-party integrations, or unattended automation. Context determines containment.

Why Security Teams Misread Exposed API Keys and Tokens

Teams often focus on the leak event itself and miss the larger question of active trust. An exposed api key or token is not just a disclosure problem, it is an authorization problem, because the secret may still unlock automation, integrations, and downstream systems long after it is found. That is why NHIMG’s Guide to the Secret Sprawl Challenge frames secret exposure as a lifecycle failure, not a single incident.

Current guidance suggests treating every exposed credential as potentially persistent until proven otherwise. A leaked secret can be embedded in CI/CD, chatops, scheduled jobs, or third-party apps that security teams do not inventory well. The operational mistake is assuming discovery equals containment. In practice, many security teams encounter the true blast radius only after a token has already been reused across systems and escalation paths.

The scale of the problem is visible in real incidents. NHIMG’s 52 NHI Breaches Analysis shows that exposed non-human credentials repeatedly become entry points when organisations fail to map where trust still exists.

How Containment Actually Works in Practice

Effective response starts with identifying every system that trusts the exposed secret, then revoking that trust in the right order. Security teams should assume the token may be active in code, secret stores, endpoint caches, build runners, ticketing systems, and partner integrations. Detection tools matter, but revocation, rotation, and dependency review are what stop reuse.

In practice, containment usually follows five steps:

  • Classify the secret by scope, privilege, and expiry.
  • Check whether it is duplicated in multiple repositories or tools.
  • Revoke or rotate the credential before chasing the source of the leak.
  • Validate that connected workloads and automation no longer depend on it.
  • Replace long-lived secrets with shorter-lived tokens, workload identity, or JIT issuance where possible.

This is consistent with the broader direction in the Anthropic report on AI-orchestrated cyber espionage, which shows how autonomous systems can rapidly chain credentials once they are available. For organisations running agentic workflows, the issue is even sharper because a token may not just authenticate an application, it may authorize a sequence of tool calls with no human in the loop.

NHIMG research also shows how widespread this exposure is across modern environments: the 2025 State of NHIs and Secrets in Cybersecurity reports that 44% of NHI tokens are exposed in the wild and 91% of former employee tokens remain active after offboarding. These numbers matter because a secret is only contained when every live trust path is closed, not when the alert is closed. These controls tend to break down when secrets are embedded in unmanaged third-party automations because ownership and revocation authority are split across teams.

Where the Standard Response Breaks Down

Tighter secret rotation often increases operational overhead, requiring organisations to balance fast containment against application stability. That tradeoff becomes visible when legacy systems, vendor integrations, or brittle pipelines cannot tolerate frequent token changes.

There is no universal standard for this yet, but best practice is evolving toward minimizing standing secrets and shrinking trust windows. Internal repositories are often treated as safe, yet NHIMG research shows they can be more secret-dense than public ones, so the usual “just scan public code” response misses the real exposure surface. Teams also underestimate how often secrets live outside repositories in Slack, Jira, and Confluence, where they are harder to inventory and harder to revoke cleanly.

Edge cases matter. Some tokens are deliberately long-lived because the platform offers no short-lived alternative, but that should be treated as an exception with compensating controls, not the default. If a secret is used by an agent, bot, or scheduled workflow, the question is not only whether it leaked, but whether it can still perform useful work right now. That is why NHIMG continues to emphasize the practical risk of leaked credentials in the Dropbox Sign breach and the Salesloft OAuth token breach.

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 address the attack and risk surface, while NIST CSF 2.0 and 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 Covers secret exposure and rotation failures for non-human identities.
NIST CSF 2.0 PR.AC-1 Access control must reflect who still trusts a leaked secret.
NIST AI RMF AI RMF is relevant when leaked tokens affect autonomous or AI-driven workflows.

Rotate exposed secrets fast, remove duplicates, and eliminate standing credentials where possible.