Log date · Fri
Can workspace layout expose coding agents to prompt injection?
Yes. Recursive reads can expose agents to third-party instructions; we compare two scan scopes and explain practical boundaries.
Can workspace layout affect coding-agent injection?
Yes: layout can change what an agent encounters, but directory depth is not a security boundary. In our Python scan of a workspace we created, a recursive search from the root found 3 README files, including 2 third-party files containing an unrelated request. Scanning only the app directory found 1 file and neither request.
At 20:30 UTC on 14 August 2026, arXiv received v1 of “Workspace Topology as an Attack Vector in Agentic Coding Assistants”, classified primarily as cs.CR; the paper notes its acceptance at CAMLIS 2026. [1] Across repositories spanning 10 languages and 6 engineering domains, the authors studied three injection entry points. They found significantly lower attack success in highly modular environments, with framing and security cues also affecting results.
| Question or case | Finding or recommendation |
|---|---|
| Scan workspace root | 3 README files, 2 containing an unrelated request. |
| Scan app only | 1 README, neither of those requests. |
| Does greater depth hide content? | No; recursive scanning still found the deep file. |
What the sample does and what it shows
We created one app README and two fictional third-party SDK READMEs at different depths. The latter merely describe a request for an unrelated configuration change. With Python 3.9.1, we used pathlib.Path.rglob to find README.md files and marked whether the request appeared in each one. The pathlib documentation describes recursive path matching. [2]
This file-enumeration illustration is not a replication of the paper: we ran no model or coding agent and did not test whether an injection succeeds. A real agent may select context through its task, search results, automatic loading rules or tool output; a scan root is also not an operating-system permission boundary.
workspace: 3 files
app/README.md | task notes
vendor/sdk/README.md | unrelated request
vendor/sdk/deep/module/README.md | unrelated request
app-only: 1 files
app/README.md | task notesThe comparison changes the search root while leaving file contents unchanged. The root-level recursive search still finds the deeply nested file; adding directories does not stop that search. Conversely, looking only in app can omit SDK documentation needed for the task, so choose the scope for the work and inspect what actually entered the context.
What the paper calls the attack surface
The paper identifies workspace configuration, documentation and source files as three entry points, and studies modularity, directory depth, position within a file and context framing. [1] A file can contain useful data alongside text that poses as an instruction. The risk arises when an agent promotes lower-trust content into authority to act, for example when a third-party note directs changes to protection settings the user did not request.
The paper uses open-weight models and an open-source agent harness. Its observed association does not guarantee the same outcome for another model, repository or task, or establish modularity as a preventive control. [1] When testing your own workflow, distinguish whether content was read, whether the agent followed it, whether a tool ran, and whether the target file actually changed.
| Question or case | Finding or recommendation |
|---|---|
| File entered context | Record its path, origin and how it was read. |
| Agent proposed a change | Compare the request with the user’s task. |
| Tool ran or file changed | Inspect actual tool records and diffs, not just the agent’s description. |
Recommendations by situation
These are engineering recommendations, not protection effects measured above. OWASP’s prompt-injection guidance recommends layers including least privilege, separation of content, monitoring and human review. [3] Restrict accessible resources first and treat external content as data to be examined; do not make a single instruction or directory layout carry the entire defense.
| Question or case | Finding or recommendation |
|---|---|
| Reading a third-party SDK | Use an isolated copy, restrict available credentials and network access, and record sources read. |
| Changing keep rules or signing | Require independent human review of the diff and run release checks. |
| Handling signing keys | Keep them in a release environment or key service inaccessible to the agent. |
| An unrelated action is requested | Pause the action, trace its origin and inspect actual changes. |
A separate directory is not an isolation container. If the process can still access its parent, credentials or network, changing the working directory does not revoke those permissions. When protecting release configuration, also check automation identities and whether changes can bypass the same review path.
Check your own workspace
List instruction-bearing documentation that could enter a task in a workspace you are authorized to inspect. The find command below lists paths without executing files. Replace the directory with the intended review scope and decide what to read after examining the list. Your agent’s automatic loading rules and search tools may differ.
# Substitute an authorized workspace path.
find path/to/workspace -type f \( -name README.md -o -name AGENTS.md \) -printReview file provenance and recent changes, especially text requesting unrelated configuration edits, tool calls or access to sensitive locations. Do not follow third-party operational requests automatically; have an authorized person approve necessary changes. Record the agent version, allowed tools, file access scope and execution results so the check can be repeated under comparable conditions.
For a controlled exercise, use fictional files and harmless markers, and compare broad access with the narrow access needed for the task. Retain inputs, tool records and final diffs; verify files and logs even when the agent claims to have acted. Keep real keys out of the exercise environment.
Your checklist
- Limit the agent’s file and network access to the task.
- Keep signing keys and release credentials beyond agent access.
- Review unrelated operational requests in third-party documents.
- Independently review changes to protection rules and release scripts.
- Keep tool records and verify the final file diff.
Primary sources
- arXiv: Workspace Topology as an Attack Vector in Agentic Coding Assistants (2608.14876) · Source date 2026-08-14 · Checked 2026-10-12
- Python pathlib documentation · Checked 2026-11-11
- OWASP: LLM Prompt Injection Prevention · Checked 2026-11-11