A question customers are right to ask

As we build an agentic penetration testing platform—one where autonomous agents decide how to look for the most exploitable risks—we inevitably interact with LLMs frequently. That leads to a question customers are right to ask:

Will the sensitive data the agent sees during a test be sent to the LLM?

A penetration test may begin with no credentials at all, or the customer may provide a test account. From there, the tester signs in, explores pages and APIs, follows promising findings, and gradually expands the test.

An agent follows much the same process. It may start with a test username and password. Once signed in, it can encounter session cookies, access tokens, personal records, passwords, database connection strings, and other sensitive information.

The problem is that many agent systems handle all tool results in the same simple way: a tool runs, its result is added to the conversation, and the conversation is sent back to the LLM. If a tool result contains a live token or a customer record, that data may leave the customer’s environment even when the model only needed to know that the data existed.

That is the boundary I want to explore in this article.

A simple example

Imagine an authorized API test:

  1. The customer provides a test username and password.
  2. The agent signs in and receives a session cookie.
  3. The agent opens an account API.
  4. The response unexpectedly contains another user’s email address and an access token.
  5. The agent wants to determine whether that token can access an administrative API.

In a typical agent loop, the raw API response may be sent to the LLM with a question such as, “What should I do next?” The model may then copy the token into its next tool call.

But the model does not necessarily need the real token. It could receive something like this:

Authentication succeeded with <CREDENTIAL_01>.

The response contained:
- an email address: <EMAIL_02>
- an access token: <ACCESS_TOKEN_03>

<ACCESS_TOKEN_03> may be relevant to the administrative profile API.

The model still understands what happened. It knows that a token was discovered, where it came from, and which test may use it. If the next step is authorized, it can make a tool call using the reference:

{
  "name": "send_http_request",
  "arguments": {
    "method": "GET",
    "url": "https://target.example/api/admin/profile",
    "credential": "<ACCESS_TOKEN_03>"
  }
}

Immediately before the request is sent, software inside the trusted environment can replace <ACCESS_TOKEN_03> with the real value. The pentest can continue, but the remote model never needs to receive the secret itself.

The concept is straightforward. Making it work reliably across an entire agent system is much harder.

Why not ask the LLM to find the sensitive data?

An LLM can recognize many passwords, tokens, email addresses, and personal records. But asking a remote model to identify sensitive data creates a chicken-and-egg problem.

If the rule is “do not send this information to the remote model,” then sending the information there for classification has already broken the rule.

The filtering therefore has to happen somewhere trusted. That might be ordinary rules, a local privacy tool, or a model running inside the customer’s environment. The important distinction is not whether the filter uses AI. It is whether the raw data stays inside the approved environment.

The goal is also not to remove sensitive data from the pentest system completely. The testing tools may genuinely need it. The narrower goal is to avoid showing the literal value to components that do not need it.

Why a simple filter is not enough

Pentesting tools produce messy results. Sensitive information can appear in web responses, cookies, authentication headers, JSON, XML, terminal output, error messages, scanner reports, database rows, screenshots, or structured tool responses.

At the same time, security evidence often looks sensitive even when it is not. A pentest result may contain CVE numbers, hashes, UUIDs, IP addresses, file paths, commands, and other unusual strings. Some of them are exactly what the model needs to understand a finding or choose the next step.

If a filter removes everything that looks suspicious, the agent may protect privacy but stop being useful. If the filter is too relaxed, it may miss the very secrets it was supposed to protect.

There is another complication: the main LLM request is not the only place data can leak. A token removed from the visible conversation might still appear in a debug log, trace, retry, cache, saved artifact, error report, or a later reporting request.

This makes the problem bigger than finding a few sensitive words. We have to consider the full path the data takes through the system.

What can we use today?

There are already useful open-source and commercial tools. Each handles part of the problem, but none automatically creates the complete privacy boundary for an agent.

SolutionWhat it can help withWhat it does not solve by itself
PresidioFinds and hides many kinds of personal information using local models and configurable rulesIt does not decide which agent or tool is allowed to recover and use a value later
OpenAI Privacy FilterRuns locally and uses context to identify personal information and secrets before text leaves the environmentIt identifies and removes data, but does not store references or manage later authorized use
LangChain PIIMiddlewareAdds blocking, redaction, masking, or hashing to LangChain agentsProtection of tool results must be turned on, and the built-in list of data types is limited
Private AIProvides hosted and self-managed tools for finding, hiding, replacing, and later recovering sensitive dataIt is a privacy-processing component, not a complete set of agent permissions and controls
SkyflowStores sensitive values in a vault and replaces them with tokens that can be revealed under policyThe application still has to decide exactly which agents and tools may reveal each value
Gitleaks and TruffleHogLook for passwords, tokens, API keys, and similar secrets in code, files, logs, and other textThey focus on credentials rather than all personal data, and they do not manage safe references across an agent run

Cloud platforms offer related services as well. Examples include Amazon Bedrock Guardrails, Google Sensitive Data Protection, Cloudflare AI Gateway DLP, and LangSmith Gateway data protection. These may be convenient when an application already depends on the corresponding platform.

The practical lesson is that an agent may need several layers: one to find sensitive data, one to replace or store it safely, one to control who can use it, and one to check that it did not leak through another path.

What do existing benchmarks cover?

Researchers have already created useful datasets and tests for redaction, secret detection, privacy, and agent security. They do not all test the same thing, so their published results should not be compared as though they came from one competition.

Benchmark or datasetWhat it testsWhat it leaves open for this problem
RedactionBenchWhether sensitive text is removed from documents such as logs, code, email, medical text, and terminal outputIt does not follow a multi-step agent or test later use of a protected value
SecretBenchHow well scanners find real secrets in software repositoriesIt focuses on source code, requires controlled access, and does not test an agent workflow
CredDataHow open-source scanners behave on manually reviewed credential findingsIt focuses on credentials in source code rather than tool results produced during a pentest
Text Anonymization BenchmarkWhether anonymization protects people while preserving useful meaningIt is based on English legal documents rather than agent tool results
AgentDAMWhether a web agent uses private information only when a task requires itIt studies unnecessary use, not how necessary tool results can be safely represented and reused
CI-WorkWhether an enterprise agent shares the right information in the right situationIt does not directly test replacement, stable references, or recovery inside a trusted environment
AgentDojoWhether malicious content can trick an agent into leaking data or taking unsafe actionsIt focuses on attacks rather than the normal handling of authorized sensitive results
InjecAgentPrompt-injection attacks involving agents and tools, including attempts to steal private dataIt measures unauthorized actions rather than ordinary redaction and later authorized reuse
ToolPrivacyBenchWhether information shared across several tools follows the purpose of the taskIt is recent work and does not directly test the full result-to-model path described here
PrivacyPeekWhether agents collect private information they did not needIt focuses on unnecessary collection rather than protecting data that a tool legitimately returned
AgentLeakWhether private information leaks through prompts, tools, memory, or saved artifacts during an agent runIt measures several leak paths, but not the complete placeholder-and-authorized-use workflow
PIIBenchHow different systems identify personal information across several datasetsIt tests detection rather than a complete multi-step agent run

Together, this work gives us useful pieces: finding sensitive text, finding credentials, deciding whether private data was needed, and testing whether agents can be tricked into leaking it.

What remains difficult is testing the complete workflow in one place: a tool returns sensitive data, the raw value is kept away from the remote model, the model receives enough information to reason correctly, and an approved tool can still use the original value when necessary.

Final thought

Permission to use a secret is not permission to show that secret to every component in the system.

A pentest agent may be authorized to receive a credential, discover a token, preserve evidence, and use that token during a later approved test. The LLM may need to understand those events without receiving the literal value.

Existing tools and benchmarks give us many of the building blocks. The remaining work is to connect them into a reliable boundary and measure whether that boundary protects data without making the agent ineffective.

References

  1. Data Privacy Stack, Presidio
  2. OpenAI, Privacy Filter
  3. LangChain, Guardrails and PIIMiddleware
  4. Private AI, Process text
  5. Skyflow, De-identification overview
  6. Gitleaks
  7. Truffle Security, TruffleHog
  8. Amazon Web Services, Sensitive information filters in Amazon Bedrock Guardrails
  9. Google Cloud, Inspecting and de-identifying sensitive text
  10. Cloudflare, AI Gateway Data Loss Prevention
  11. LangChain, LangSmith Gateway data protection
  12. A10 Networks, RedactionBench
  13. Basak et al., SecretBench
  14. Samsung Research, CredData
  15. Pilán et al., The Text Anonymization Benchmark
  16. Meta AI, AgentDAM
  17. Microsoft Research, CI-Work
  18. Debenedetti et al., AgentDojo
  19. Zhan et al., InjecAgent
  20. ToolPrivacyBench
  21. PrivacyPeek
  22. AgentLeak
  23. PIIBench