medium severityCurated advisory

Excessive file reading during project exploration

When AI agents explore a project to understand its structure, they often read dozens or hundreds of files — far more than needed for the task. This excessive reading can expose secrets, proprietary code, and customer data that enter the context window and model API.

Key facts

Excessive file reading during project exploration is a medium-severity AI agent security threat targeting file system access, context window, model API egress. Scope file access to the task. Guard can warn, block, or require approval for supported risky file reads according to local policy, but do not rely on Guard for a per-session file-read cap or total context-size meter.

3 affected surfacesLast updated Jun 26, 2026
Affected surfacesfile system accesscontext windowmodel API egress
The attack

What happens

When asked to "understand the project" or "explore the codebase," agents read far more files than necessary — including configuration files, test fixtures, and credentials that have nothing to do with the task. All of this data enters the context window and is sent to the model API.

Step by step

How the attack unfolds

1Developer asks agent to "explore the project structure".
2Agent reads the directory tree, then starts reading files to understand the code.
3Agent reads config files, test fixtures, .env files, and credential files "for context".
4All file contents enter the context window and are sent to the model API.
5Proprietary code, customer data, and secrets are exposed to the model provider.
Example

What it looks like in practice

Scenario

A developer asks Claude Code to "understand how the API works." Claude reads the directory tree, then reads 47 files — including src/config/production.env, tests/fixtures/user-data.json, and src/auth/service-account.json. All of this enters the context window and is sent to Anthropic's 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 a per-session file-count threshold, exploration-specific secret-directory detector, or total context-window size meter as shipped controls.
Use model-provider or harness telemetry for file-count and context-volume evidence where available.
Mitigation

How to stop it

Recommended action

Scope file access to the task. Guard can warn, block, or require approval for supported risky file reads according to local policy, but do not rely on Guard for a per-session file-read cap or total context-size meter.

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.