--- title: "Secure an AI Agent Harness: 12 Controls and a Checklist" url: https://playciso.com/blog/secure-ai-agent-harness-controls updated: 2026-11-30 section: Blog publisher: PlayCISO --- # Secure an AI Agent Harness: 12 Controls and a Checklist > Twelve controls to secure an AI agent harness: permissions, sandboxing, instruction files, credentials, approvals, logging and change control, in order. Source: https://playciso.com/blog/secure-ai-agent-harness-controls · Published: 2026-11-30 · Publisher: PlayCISO (https://playciso.com) --- An **AI agent harness** is everything around the model: the instructions it reads, the tools and permissions it has, its memory, its sandbox and the code that runs the loop. It is where permissions and credentials live, so it is where to put your controls. This checklist gives **12 controls in the order we would apply them**, with the source behind each where there is one. The order and detail are our recommendation. For the definition and parts of a harness, start with [harness engineering explained](/blog/harness-engineering-ai-agents-explained). **Who this is for:** security and platform teams that run coding agents or build in-house agents. ## The 12 controls - Inventory every harness and agent. Who runs it, which model, which tools, which credentials, which instruction files. You cannot secure what you have not listed. (Our recommendation.) - Least-privilege tools. Give each agent only the tools its task needs, and scope each tool's permissions. OWASP's [agentic top 10](https://genai.owasp.org/2025/12/09/owasp-top-10-for-agentic-applications-the-benchmark-for-agentic-security-in-the-age-of-autonomous-ai/) lists tool misuse and identity and privilege abuse as separate risks. - Isolate the filesystem and the network. Anthropic says Claude Code [sandboxing needs both](https://www.anthropic.com/engineering/claude-code-sandboxing): filesystem isolation limits where the agent can read and write; network isolation routes traffic through a proxy that limits domains. Together they stop a prompt-injected agent changing system files or sending out data such as SSH keys. - Layer the isolation. Red Hat's [argument](https://developers.redhat.com/articles/2026/11/12/agent-harness-engineering-separating-model-capabilities-enforcement) is for layered isolation (application policy plus VM isolation) so no single layer carries the whole risk. In July 2026 OpenAI [reported](https://openai.com/index/hugging-face-model-evaluation-security-incident) that its models left a sandbox in an internal benchmark by exploiting a package-proxy flaw, with safeguards off on purpose. - Short-lived, scoped credentials. Issue tokens per task with the minimum scope and a short life; never put long-lived secrets in the agent's environment or instruction files. (Our recommendation, following the privilege-abuse risk.) - Protect instruction files. Files like AGENTS.md are obeyed. Require review for changes, pin them in version control, and treat one that arrives with a repository as untrusted input. See the [agent config malware](/blog/ai-coding-agent-config-malware-bitdefender) case. - Approval for consequential actions. Deleting, deploying, spending, sending and changing permissions need a human or a policy check. Make sure approvals cannot be bypassed by command parsing tricks: GitHub's advisory for Copilot CLI [CVE-2026-29783](https://osv.dev/vulnerability/GHSA-g8r9-g2v8-jv6f) describes commands classified as read-only that ran arbitrary code. - Treat all tool and web output as untrusted input. Content the agent reads can carry instructions. Keep model output from running directly in a shell or an interpreter without checks. - Control memory and context. OWASP names memory and context poisoning as a risk. Limit what is written to long-term memory, expire it, and log changes. (Our recommendation.) - Log every tool call. Record the tool, arguments, result and which instruction led to it, in a place the agent cannot edit. Without it you cannot answer "how far did it get". Practise reading such a trace in the [ARTEX Request Trace Lab](/tools/artex-request-trace-lab). - Change control on the harness. Prompts, hooks, tool definitions and permissions are code: review, version and test them. This matters most for harnesses that rewrite themselves, as in the [Harness² paper](/blog/harness2-self-improving-agents-security-governance); practise in the [change control lab](/tools/recursive-harness-change-control-lab). - Patch and test. Track advisories for the agents you run: GitHub's other Copilot CLI advisory, [CVE-2026-45033](https://osv.dev/vulnerability/GHSA-9ccr-r5hg-74gf), covered a nested malicious git repository running commands through a git setting without approval. Then red-team your own harness on a schedule. The sources above support the controls; the research on how much each helps is thin. The ["Harness Matters" preprint](https://arxiv.org/abs/2611.11971) says the harness should be treated as a security boundary, and a [Manifold Security vendor study](https://www.manifold.security/reportsandwhitepapers/the-agent-behavior-index) says harness choice changed outcomes. Neither is an independent benchmark, so measure your own harness. ## A quick scorecard | Question | If the answer is no | | --- | --- | | Can you list every agent and what it can reach? | Start with control 1. | | Is anything enforced outside the model, in code or the platform? | Controls 2 to 4. | | Do agent credentials expire within hours? | Control 5. | | Does a human or policy approve consequential actions? | Control 7. | | Could you reconstruct an agent's actions from logs it cannot edit? | Control 10. | ## What to do this week - Run the inventory and pick the three agents with the widest access. - For those three, remove one tool or permission each and shorten their credentials. - Check that tool-call logs exist and are stored where the agent cannot write. - Audit a harness with the [agent harness audit lab](/tools/agent-harness-audit-lab) and the [attack surface lab](/tools/agent-harness-attack-surface-lab). ## Frequently asked questions ### How do I secure an AI agent harness? Treat the harness as a security boundary and enforce limits outside the model: least-privilege tool permissions, filesystem and network isolation, short-lived scoped credentials, human approval for consequential actions, signed and reviewed instruction files, logging of every tool call, and change control on the harness itself. The checklist in this article puts these in order. ### Why is an instructions file a security risk? Because an agent obeys it. A file such as AGENTS.md or a rules file is read into the model's context at the start of work, so an attacker who can change it, or plant one in a repository the agent opens, steers the agent. We covered a campaign that abused agent instruction files in public repositories. ### Does sandboxing stop a prompt-injected coding agent? It limits the damage. Anthropic says Claude Code sandboxing needs both filesystem and network isolation, so a prompt-injected agent cannot change system files or send out data such as SSH keys, and says sandboxing reduced permission prompts by 84% in its internal use. Anthropic does not claim sandboxing is sufficient alone, and OpenAI reported in July 2026 that its models left a sandbox during an internal cyber benchmark by exploiting a flaw in a package proxy, with production safeguards deliberately off. ### Have coding-agent harnesses had real vulnerabilities? Yes. GitHub published two Copilot CLI advisories: CVE-2026-29783 (crafted shell parameter expansion could run commands classified as read-only, bypassing approval prompts, fixed in 0.0.423) and CVE-2026-45033 (a nested malicious bare git repository could run commands through core.fsmonitor during routine git operations without approval, fixed in 1.0.43). Neither advisory states exploitation in the wild. ### What does OWASP say about agent risks? The OWASP Top 10 for Agentic Applications, published 9 December 2025, names ten risks: agent goal hijack, tool misuse, identity and privilege abuse, agentic supply chain vulnerabilities, unexpected code execution, memory and context poisoning, insecure inter-agent communication, cascading failures, human-agent trust exploitation and rogue agents. Most sit in the harness, not the model. ## Sources - [OWASP Top 10 for Agentic Applications](https://genai.owasp.org/2025/12/09/owasp-top-10-for-agentic-applications-the-benchmark-for-agentic-security-in-the-age-of-autonomous-ai/) (9 December 2025) - [Anthropic: Claude Code sandboxing](https://www.anthropic.com/engineering/claude-code-sandboxing) (20 October 2025) - [Red Hat Developer: agent harness engineering](https://developers.redhat.com/articles/2026/11/12/agent-harness-engineering-separating-model-capabilities-enforcement) (12 November 2026, vendor opinion) - [OpenAI: Hugging Face model evaluation security incident](https://openai.com/index/hugging-face-model-evaluation-security-incident) (21 July 2026) - [GHSA-g8r9-g2v8-jv6f (CVE-2026-29783)](https://osv.dev/vulnerability/GHSA-g8r9-g2v8-jv6f) and [GHSA-9ccr-r5hg-74gf (CVE-2026-45033)](https://osv.dev/vulnerability/GHSA-9ccr-r5hg-74gf) - [Harness Matters, arXiv 2611.11971](https://arxiv.org/abs/2611.11971) (preprint) and [Manifold Security: The Agent Behavior Index](https://www.manifold.security/reportsandwhitepapers/the-agent-behavior-index) (vendor study) *This article is educational guidance for security leaders. Controls 1, 5, 9 and the ordering are our recommendation; the rest are tied to the sources named.*