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.
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.
How the attack unfolds
What it looks like in practice
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.
How Guard catches this
How to stop it
Scope agent file reads to the specific task. Use Guard to set file-read limits per session. Block reads of directories that typically contain secrets during exploration tasks.
Common questions
More threats to know about
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.
Read advisoryGitignore bypass via agent file reads
AI agents can read files that are gitignored — secrets, private keys, and internal configs — because gitignore only prevents git tracking, not file system access. These files often contain the most sensitive data in a repository.
Read advisoryStop this threat before it reaches your agent
Install HOL Guard to get real-time protection against this attack and others like it.