Join our Newsletter — 33% off our NHI Course
Home Glossary AI Security Model-context Secret Leakage
AI Security

Model-context Secret Leakage

← Back to Glossary
By NHI Mgmt Group Updated September 2, 2026 Domain: AI Security

The exposure of credentials or other sensitive values inside the text sent to an AI model. It happens when logs, traces, tool outputs, or transcripts are forwarded without sufficient filtering, turning diagnostic data into a new disclosure channel.

Expanded Definition

Model-context Secret Leakage is the disclosure of credentials, tokens, API keys, certificates, or other sensitive values when text is sent into an AI model’s prompt, context window, or supporting workflow. In NHI security, the issue is not the model itself but the surrounding data path: logs, traces, ticket excerpts, tool outputs, and chat transcripts can all become unintended disclosure channels if filtering is weak or absent. The term sits adjacent to secret sprawl and prompt injection, but it is narrower than both because the primary failure is context assembly, not model behavior. The OWASP Non-Human Identity Top 10 is a useful external reference because it frames secret handling as a core identity risk rather than a mere logging problem. Definitions vary across vendors, and some tools label this as data leakage, context poisoning, or sensitive prompt exposure, so practitioners should read claims carefully. The most common misapplication is treating redaction as complete protection when downstream tool calls, debugging exports, or conversation archives still carry the original secret-bearing text.

Examples and Use Cases

Implementing controls for Model-context Secret Leakage rigorously often introduces extra filtering, tracing, and review overhead, requiring organisations to weigh observability against the risk of exposing live secrets.

  • Support teams paste a production error trace into an AI assistant, and the trace includes an API key embedded in a serialized request.
  • Engineering pipelines forward tool output into a model for incident summarisation, but the output contains bearer tokens from a failed authentication step.
  • Analysts ask an agent to review a deployment transcript, and the transcript includes secrets from environment-variable dumps or debug logs.
  • Security teams use a triage workflow that combines ticket text with chat history, but pasting raw context reintroduces credentials that had already been discovered elsewhere.

These patterns are closely related to the secret-sprawl conditions described in Guide to the Secret Sprawl Challenge and to real-world compromise paths seen in Shai Hulud npm malware campaign. The same lesson appears in the OWASP guidance on non-human identities: anything that makes secrets easier to move also makes them easier to leak.

Why It Matters in NHI Security

Model-context Secret Leakage matters because AI-assisted operations often aggregate the very material attackers want most: long-lived tokens, service account credentials, and operational metadata that reveals where those credentials work. NHI security is especially exposed because non-human identities are numerous, heavily integrated, and frequently overprivileged. NHIMG research shows that 79% of organisations have experienced secrets leaks, and 77% of those incidents caused tangible damage, which makes the disclosure pathway materially consequential rather than theoretical. This risk is amplified when organisations use AI to summarise incidents, inspect CI/CD output, or accelerate support triage, because each added integration increases the chance that a sensitive value enters model context. The Ultimate Guide to NHIs — Why NHI Security Matters Now notes that 80% of identity breaches involved compromised non-human identities such as service accounts and API keys, underscoring how often the real blast radius begins with machine credentials. Organisations typically encounter the severity of model-context secret leakage only after an incident review finds that a leaked token first appeared in an AI transcript, at which point containment becomes operationally unavoidable to address.

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 CSF 2.0, NIST Zero Trust (SP 800-207) and NIST AI RMF set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02Directly addresses improper secret handling and exposure paths for non-human identities.
OWASP Agentic AI Top 10A2Covers sensitive data exposure in agentic workflows that pass tool output into models.
NIST CSF 2.0PR.DS-1Protects data at rest and in transit, including sensitive text forwarded into AI systems.
NIST Zero Trust (SP 800-207)SP 4Zero trust requires explicit verification before any contextual data reaches a service.
NIST AI RMFAddresses privacy, security, and misuse risks created when AI systems receive sensitive context.

Limit agent context to non-sensitive data and redact tool outputs before model submission.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 2, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org