Articles

Secrets and data exposure in agent systems

Secrets and data leak through an agent context — the controls that keep them out.

Reading: 5 minAutomation & AI

Article cover: Secrets and data exposure in agent systems

An agent is a chat model that has been given credentials and reach. It calls tools, so it holds keys; it reads documents, so it touches records; and both pass through the same channel — the model’s context. In a chat window a leaked sentence is embarrassing. In an agent a leaked credential is a working key, and a leaked record is a copy in a second place. This sheet separates the two classes of exposure and names the controls that keep each out of the model’s reach.

The controlling idea: the context window is not a private channel. A secret does not fail when it is printed to a user; it fails the moment it enters the model’s input, and everything placed there can be echoed in the next output or written to a durable store.

Two classes of exposure

OWASP’s sensitive-information-disclosure entry names the whole family: “Sensitive information can affect both the LLM and its application context. This includes personal identifiable information (PII), financial details, health records, confidential business data, security credentials, and legal documents.” The list mixes two things this sheet keeps apart. Secrets are credentials — a key you use to authenticate. Data is records — information you hold about people or the business. Their remedies differ: a leaked secret is repaired by rotation and revocation and stops working; a leaked record cannot be un-disclosed, only contained.

Why the context is the leak

Anything in context can come out: “LLMs, especially when embedded in applications, risk exposing sensitive data, proprietary algorithms, or confidential details through their output.” An agent widens the surface beyond the reply, because the same text lands in transcripts, tool-call logs, traces, caches and evaluation sets. The secrets cheat sheet is blunt about one of those stores — environment variables “are generally accessible to all processes and may be included in logs or system dumps.” A prompt is a write to several durable places, not a private whisper.

Where secret material lives

Secrets accumulate in the places an agent reaches. The cheat sheet observes that organizations “have them hardcoded within the source code in plaintext, littered throughout configuration files and configuration management tools.” The remedy is not a better prompt but different plumbing: fetch the secret at the executor, in memory, at call time — “Fetch from the secret store (in-memory): A sidecar app/container fetches the secrets it needs directly from a secret manager service without dealing with docker config.” CISA asks for the same discipline for credentials in general: “use a credential management system to limit, manage, and monitor credential use”.

Keeping secrets out of the model’s reach

The model never needs to see a secret in order to cause the call. The executor holds the credential and injects it into the request after the model has produced the tool’s arguments, so the key never enters the context. Where credentials are issued per session, prefer short-lived ones: “Dynamic secrets should be used where possible to reduce the surface area of credential reuse.” This makes exposure survivable. NIST defines compromise as “The unauthorized disclosure, modification, substitution or use of sensitive key information,” and a cryptoperiod as “the time span during which a specific key is authorized for use.” Rotation — “regularly rotate secrets so that any stolen credentials will only work for a short time” — and revocation are the recovery path once disclosure is assumed.

Data the agent can read

Exposure is not only the credentials the agent holds but the records it can retrieve. OWASP asks applications to “Limit access to sensitive data based on the principle of least privilege” and to “Limit model access to external data sources, and ensure runtime data orchestration is securely managed to avoid unintended data leakage.” Two controls follow: scope the tools so an agent reads only the records its task needs, and redact at the boundary — “pattern matching can detect and redact confidential content before processing.” Model weights are a third asset: CISA asks to “Harden interfaces for accessing model weights” and to keep them in a “protected storage vault.”

What prompt-level defence cannot do

A system prompt that forbids revealing secrets is a mitigation, not a control. OWASP warns that “restrictions within the system prompt about data types that the LLM should return can provide mitigation against sensitive information disclosure. However, such restrictions may not always be honored and could be bypassed via prompt injection or other methods.” Its example scenario is blunt: “A user receives a response containing another user’s personal data due to inadequate data sanitization.” Instructions sit in the same untrusted channel they try to govern; the durable move is to keep secrets and records out of it.

Level and prerequisites. L4 — the security layer’s data-handling sheet: it demands that the reader already knows how an agent loop calls tools and what the context window is, and can place a control at the right boundary (executor, tool or store) instead of inside the prompt. Prerequisites: the L1 sheets on how a model generates text and what it can be given, the L2 sheets on serving and structured output, and the L3 sheets on tools and tool schemas.

Where to go next

References

  • OWASP — Top 10 for LLM Applications 2025 (LLM02 Sensitive Information Disclosure) — the classes of sensitive information, exposure through output, least-privilege access, redaction and the limits of system-prompt restrictions.
  • OWASP — Secrets Management Cheat Sheet — hardcoded secrets, in-memory secret delivery, leakage of environment variables into logs, rotation and dynamic secrets.
  • CISA/NSA — Deploying AI Systems Securely — credential management, protecting model weights and restricting APIs to the minimal data required.
  • NIST — SP 800-57 Part 1 Rev. 5 — the definitions of key compromise and cryptoperiod that fix the lifetime of a leaked secret.
Nodrius Field Kit — cover

Get the Nodrius Field Kit

Enter your email and we'll send you the complete Field Kit: eight technical resources in one download.

Your email address is sent to Nodrius and used to deliver the Field Kit to you by email. Marketing messages are separate and optional: the checkbox does not affect your download, and you are only added to our updates list if you tick it. Privacy Policy.

Privacy & cookies

This site does not use cookies, analytics or tracking, and it does not profile you. There is nothing technical to switch off, so Accept and Reject change nothing about how the site works: either choice lets you browse everything normally.

The only difference is what your browser remembers: two entries in local storage — your choice here, so this notice is not shown again, and a marker that the Field Kit offer has already been made — so the offer is presented once and not on every page. They contain no identifier, they are not shared with anyone, and the site sets no cookie for either.

What we do with your data
How your email address is used when you ask for a Resource, how long it is kept and which rights you have — in the Privacy Policy.
What the site stores in your browser
Two entries in local storage — your choice on this notice and whether the Field Kit offer has been shown — and no cookies, no session storage, no third-party content: in the Cookie Policy.