How do you limit the risk when an agent has a terminal and files?
Answer out loud or in your head first, then compare.
Answer
I give access only to the environment needed, without production secrets or unnecessary rights. If the agent reads an untrusted repo, even a README, a dependency or a test result can try to steer it. I don't assume everything in the project directory is safe.
I separate the ability to prepare a change from the right to deploy and access company accounts. The environment should restrict files, network and commands to what the task needs. A container can help, but it isn't automatically perfect protection against every form of dangerous code. Install scripts and tests do work too, so they can also read or send data.
Why it matters: A harness gives the model real capabilities, not just a place to write text.
Possible follow-ups: Does the agent need the internet and all the files to fix one function?
How did it go? Be honest — “Not yet” puts the question on your review list.
Start with
- I-P01 · What is an agent harness? — Harness, MCP and coding agents
- I-P02 · What is MCP? — Harness, MCP and coding agents
- I-P04 · How does a coding agent differ from a chat that suggests code? — Harness, MCP and coding agents
Further reading
- OWASP: LLM Prompt Injection Prevention Cheat Sheet(opens in a new tab)Docs; accessed 22.10.2026. Threat model, untrusted content, tool control and defence in depth.