medium severityCurated advisory

Context window scraping via long file reads

AI agents that read large files can leak proprietary code, internal documentation, and customer data into their context window — which may then be sent to external LLM APIs or logged in cloud telemetry.

Key facts

Context window scraping via long file reads is a medium-severity AI agent security threat targeting LLM context window, model API egress, cloud telemetry, proprietary code files. Limit the files and directories an agent can read. Guard can warn, block, or require approval for supported risky file reads according to local policy, but do not rely on Guard for per-session file-count thresholds or total context-size metering.

4 affected surfacesLast updated Jun 26, 2026
Affected surfacesLLM context windowmodel API egresscloud telemetryproprietary code files
The attack

What happens

An agent reads files beyond its task scope — proprietary code, internal docs, customer data, or credentials — and that data enters the LLM context window. If the model API logs prompts or the agent sends data to external tools, the data may be exfiltrated.

Step by step

How the attack unfolds

1Agent is asked to review or fix a file in a specific directory.
2Agent reads the target file, but also reads adjacent files in the same directory.
3Large files with proprietary code or customer data enter the context window.
4The context window is sent to the model API for processing.
5If the model provider logs prompts or the agent uses external tools, the data may be exfiltrated.
Example

What it looks like in practice

Scenario

A developer asks Claude Code to fix a bug in src/api/handlers.ts. Claude reads the file, but also reads src/api/handlers.test.ts, src/api/middleware.ts, and src/config/database.ts — which contains the production database connection string. All of this enters the context window and is sent to the model API.

Detection

Detection and Guard coverage

Guard evaluates supported risky file-read actions before side effects and can apply the active local policy.
Current Guard product evidence does not establish per-session file-count alert thresholds or total context-window size metering as shipped controls.
Use model-provider or harness telemetry for context-volume evidence where available.
Mitigation

How to stop it

Recommended action

Limit the files and directories an agent can read. Guard can warn, block, or require approval for supported risky file reads according to local policy, but do not rely on Guard for per-session file-count thresholds or total context-size metering.

Guard configuration
Use Protection Center to review which Guard controls are active on this device.
Use `hol-guard command controls status` and `hol-guard command controls list` to inspect the active local control catalog.
Guard coverage is action- and harness-specific. Do not treat an advisory label as a configurable Guard setting unless it appears in the current control catalog.

Use the protections Guard supports here

Guard can review or block supported actions for this threat. The advisory above calls out what Guard covers and where other controls are still needed.