On this page
AI Agent Security Checklist: 10 Controls Before Write Access
tl;dr
Grant AI agents only scoped, short-lived write access after enforcing ten controls. In a review of 760 repositories, 116 had gaps where outsider text reached agents holding write tokens or shell access.
In a review of 760 public repositories running AI agents in CI, 116 had a serious gap where an outsider’s text could reach an agent holding a secret, a write token, or a shell — and across all repositories, three of every ten had some level of access gap. That finding comes from a manual review by Node9, and it should reframe how you think about agent permissions. The problem isn’t just what agents write — it’s what they can be tricked into executing before any human sees a prompt.
Why Is Write Access the Critical Boundary for AI Agents?
Write access transforms an AI agent from a reader into an actor with the same credentials as the developer or CI runner invoking it. When an agent can push commits, merge pull requests, or run shell commands, any input that reaches it — issue comments, PR descriptions, repository files, even git metadata — becomes a potential control vector. The Node9 study found that in 116 of 760 repositories, an outsider’s text could reach an agent with write privileges. In 280 repositories the agent held a token that could write to the repo. In 136 it had a shell. And in 52 the danger wasn’t even in CI — a committed settings file pre-approved commands for every contributor who opened the project in their editor.
The attack surface expands because agents gather context before you type anything. Manifold Security documented that AI coding agents run git context-gathering commands in the background before the user types a prompt, before workspace-trust prompts, and sometimes before authentication. Four of eight findings across seven agents remained unpatched as of September 1, 2026. This means a cloned repository can execute code on the developer’s machine before any sandbox or approval boundary applies.
JFrog Security Research reported that attackers compromised 42 third-party GitHub repositories using oversized payload blobs to evade GitHub search and API paths, with the compromised repositories containing execution hooks for AI coding assistants and IDEs. The campaign used polymorphic wrappers as large as 13.7 MB that all decoded to the same hidden CI-publisher payload. This isn’t theoretical — supply-chain attacks now target the agent harness directly.
What Permissions Should You Actually Grant an Agent?
Start with the principle that an agent should have only the permissions its task requires, and those permissions should be scoped to the specific repository, branch, and operation. GitHub Copilot Business and Enterprise administrators can now centrally control which agent operations are blocked, require human approval, or proceed without a prompt. According to the GitHub changelog, managed permissions cover shell commands, file reads and edits, and network domains, and these restrictions cannot be weakened by user or workspace settings, auto-approval, or previously saved approvals.
Claude Code’s permission rules live in .claude/settings.json or organization-managed settings, where deny rules win over allow rules. However, Gitfence notes that these rules do not apply to file reads that don’t name files explicitly — such as grep -r pattern . — or to arbitrary subprocesses that open files indirectly. Bash deny rules match command text and are not a security boundary; Anthropic points to the sandbox for enforcement that doesn’t depend on command text.
OpenAI Codex uses an OS-level sandbox with three modes: read-only, workspace-write (the default), and danger-full-access, plus an approval policy. But researchers escaped Codex’s strictest read-only sandbox using the Heapjack technique to run commands on the developer’s host with no approval prompt and nothing shown on screen. The flaws were reported to OpenAI on August 12, 2026 and fixed within eight days, but the escape demonstrates that sandbox modes alone are insufficient without additional controls.
| Tool | Pricing (per user/month) | Key Security Controls | Target Audience |
|---|---|---|---|
| GitHub Copilot Business/Enterprise | Custom enterprise pricing; Business tier includes managed permissions | Enterprise managed permissions for shell, file, network; cannot be weakened by user settings; audit logs | Organizations needing GitHub-native governance |
| OpenAI Codex Business | ~$20 annual / $25 monthly | OS sandbox (read-only, workspace-write, danger-full-access); admin controls; GitHub/Slack/Linear integrations | Teams wanting multi-surface agent (CLI, IDE, cloud) |
| Claude Code Team | $100/seat/month (min 5 seats) | Centralized governance (SCIM, audit trails, RBAC, IP allowlisting) in Enterprise only; no-training-on-code policy all paid tiers | Regulated industries prioritizing data privacy |
How Do You Secure the Agent’s Configuration Files?
AI coding assistant configuration files — settings.json hooks, .cursorrules, CLAUDE.md, AGENTS.md — are explicit supply-chain attack targets. The Mini Shai-Hulud worm scans developer home directories for these files and rewrites them to achieve silent persistence across AI coding sessions. Tenable’s analysis shows these files sit at the intersection of three trust relationships: the developer trusts them as config, the IDE executes them automatically, and the LLM treats them as authoritative instructions.
A malicious AGENTS.md placed in a Downloads folder prompted Codex to add an MCP server and install a malicious npm package in more than 90% of test runs, and a CLAUDE.md variant redirected Claude Code’s API traffic. Quellix Labs documented that the operational lesson isn’t to ban instruction files — it’s to stop treating every instruction file the agent can read as trusted policy. Trust should come from the workspace, the user, and the controls around the agent, not from a file’s confident wording.
Mitiga Labs studied more than 50,000 AI instruction files across 7,000-plus public repositories from April to June 2026 and found attacker-controlled ANTHROPIC_BASE_URL overrides rerouting Claude traffic through third-party proxies, plus more than 1,230 hardcoded API keys and tokens across agent and MCP server configurations. Their free Skillgate scanner detects, flags, and scores these files for prompt injection, hook remote code execution, credential exfiltration, and other attack techniques before an agent loads them.
Control 1: Treat all agent configuration files as code requiring mandatory pull-request review and hash pinning in CI/CD.
Control 2: Enforce --ignore-scripts on package installs to prevent post-install hooks from rewriting agent configs.
Control 3: Flag AI scanner refusals as a suspicious signal rather than a clean result — the Mini Shai-Hulud worm evades AI-based scanners by design.
Which Sandbox and Isolation Controls Actually Work?
Sandboxes are presented as the security boundary for local agent actions, but the evidence shows they’re porous. Gitfence notes that Anthropic points to the sandbox for enforcement that doesn’t depend on command text, and Codex offers read-only, workspace-write, and danger-full-access sandbox modes. Yet BleepingComputer documented researchers escaping Codex’s strictest read-only sandbox using Heapjack to run commands on the host with no approval prompt. Manifold Security showed that git context-gathering runs before workspace-trust prompts and authentication, so the repository executes before the sandbox applies.
Forever Security’s EMBRACE research found embedded-browser flaws in Cursor, GitHub Copilot, OpenAI Codex, Microsoft VS Code, and Claude Desktop. As of October 29, 2026, the flaws in Codex and VS Code remained unpatched and could allow local-file access beyond the project folder. The vendor responses reveal a deeper problem: Anthropic declined Forever Security’s report on the grounds of Workspace Trust, treating the prompt as a valid protection mechanism. But researcher Gal Weizman states that not trusting a project makes an AI harness unusable, so everyone just hits “Trust,” and the prompt provides zero protection to the user.
Control 4: Use OS-level sandboxing (seccomp, SELinux, AppArmor) rather than relying solely on the agent’s built-in sandbox modes. Control 5: Run agents in ephemeral containers or VMs with no persistent home directory, no SSH keys, and no cloud credentials in the environment. Control 6: Implement a runtime security layer like Prempti (Falco-based) that intercepts agent tool calls before execution and evaluates them against policy rules for sensitive paths, network calls, and credential access.
How Do You Handle Credentials and Identity for Agents?
Microsoft Security guidance recommends treating every AI agent as a first-class principal with a lifecycle-managed identity, explicit roles, tightly scoped permissions, and tool usage bound to a preconfigured tools manifest or configuration. When an agent operates without a managed identity and least-privilege RBAC, it can access or modify sensitive data beyond intended permissions. The scope creep is quiet and incremental — a team provisions an agent with a broad “Reader” role, then the workflow expands to include fixing issues, and suddenly the agent needs write access too. Rather than rethinking the role design, teams grant something broader and move on.
Token Security maps every agent to its owner, identities, and permissions so controls block actions outside the agent’s authorized scope. The core problem: AWS checks the signature, not who holds the key. When an agent grabs an admin profile from a developer’s ~/.aws/config, the request appears to come from the developer. The violation is that an agent used a role agents aren’t allowed to use — and unlike intent, you can check that on every request.
Control 7: Issue short-lived, scoped credentials per agent per task — never share the developer’s long-lived credentials. Control 8: Bind each agent to a preconfigured tools manifest that declares exactly which tools it may invoke, with which parameters, against which targets. Control 9: Implement approval gates for any action that writes to protected branches, modifies infrastructure, or accesses secrets — and ensure those gates cannot be bypassed by auto-approval or previously saved approvals.
What Monitoring and Scanning Catches Agent Risk at PR Time?
GitHub code scanning for AI applications entered public preview on October 28, 2026, automatically scanning pull requests in repositories with GitHub Advanced Security for indirect prompt injection (XPIA), sensitive information disclosure, and excessive agency. The detector requires an Advanced Security license and does not run on GitHub Enterprise Server. It flags agent code paths where untrusted content can reach a model that holds tool, data, or business-system access, and puts remediation guidance directly in the pull request before merge.
This convergence matters. Anthropic’s Frontier Red Team, disclosing five working exploit chains built by an unreleased model, concluded that fixing the backlog only solves half the problem and recommended scanning at PR time. GitHub’s detector now says the same thing from the platform side: risky agent architectures are difficult to spot through manual review alone, so the forge should spot them automatically. Two independent actors, one prescription, one week apart.
Control 10: Enable AI-specific code scanning at pull-request time for any repository where agents have write access. Treat flagged findings as merge-blocking until remediated or explicitly waived with documented justification.
How Do Enterprise Controls Differ Across Copilot, Codex, and Claude Code?
The enterprise tier is where security controls become enforceable rather than advisory. GitHub Copilot’s managed permissions are generally available in the Copilot app, CLI, and VS Code sessions using Agent Host — and critically, they cannot be weakened by user or workspace settings. OpenAI Codex Business adds admin controls with GitHub, Slack, and Linear integrations for about $20 per user per month on an annual plan or $25 monthly, while Enterprise offers a shared credit pool with custom pricing. OpenAI does not train on ChatGPT Business, Enterprise, or API workspace data by default.
Claude Code Enterprise includes centralized governance controls — SCIM, audit trails, RBAC, and IP allowlisting — not available in the Team plan, per Anthropic’s enterprise guide. The Team plan costs $100 per seat per month with a minimum of five seats, while Enterprise carries custom pricing. The no-training-on-code policy applies to all paid tiers including Pro, which is Claude Code’s clearest security differentiator against GitHub Copilot, which restricts training only at the Business and Enterprise tier.
For teams rolling out agents across cloned repositories, shared developer machines, or business-critical code, the same questions apply regardless of vendor: which folders are trusted, which actions require approval, what the agent can reach, and how an incident is contained. If you cannot answer those questions for the agent’s actual workflow, expanding write access is premature.
The checklist above isn’t exhaustive — it’s the minimum viable set of controls before an agent gets write access to your repository. The 2026 AI Coding Agent Security Audit Checklist goes deeper on configuration and execution permissions. For the config-file attack surface specifically, Hardening AGENTS.md and Agent Config Files Against Poisoning covers the supply-chain vector that the Mini Shai-Hulud worm exploits. And if you’re worried about agents already running on developer endpoints without oversight, Shadow AI Agents Already in Your Codebase: Detect and Block explains why network firewalls and CASB tools miss the local write path.
What’s your team’s current gap between the controls you have and the controls on this list?
Recommended Reading
-
10 AI Agent Orchestration Tools: Isolation, Review, Security
Fix review and merge governance before adding parallel agents, since generation capacity already exceeds absorption capacity. Open-source desktop orchestrators avoid vendor lock-in after cloud shutdowns like Conductor Cloud.
-
AI Software Factory Stack: Build, Buy, or Agent-Agnostic
Buy the managed coding agent and build only your private context, permissions, and verification layer. Most teams should not build a full internal harness because seat savings rarely justify the platform maintenance burden.
-
Verify-First vs Build-First: Safe AI Coding Agent Rollout
Verify-first is the safer rollout pattern; build-first shifts review bottlenecks without removing them. Faros AI telemetry shows median PR review time rose 441.5% under high AI adoption, and 31.3% more PRs merged with no review at all.