PioneerQ Start free

Assuren guide · Updated 2026-11-25

AI coding agent security: screening tool calls before they run

The most reliable way to secure an AI coding agent is to check each tool call (shell command, file write, network request or MCP tool) against a fixed policy before it executes. Approval prompts and vendor defaults help, but they vary by tool, depend on a person reading every prompt, and can be switched off.

Why coding agents need their own controls

A coding agent runs on a developer's machine with that developer's access. It reads the repository, runs shell commands, edits files, installs packages and calls Model Context Protocol (MCP) tools. Visual Studio Code's documentation puts it plainly: local MCP servers can run code on your machine, and tools can access services using your permissions.[5]

That makes the developer workstation an AI attack surface. Untrusted text arrives constantly: a README in a cloned dependency, an issue comment, a web page the agent fetched, a tool result. If any of it carries instructions the agent follows, the agent acts with real credentials. The MCP security guidance gives a blunt example of a malicious startup command that posts a user's SSH private key to a remote server.[6]

OWASP's Excessive Agency entry explains why this goes wrong: damaging actions happen when a model with too much functionality, too many permissions or too much autonomy responds to manipulated output.[7] A coding agent tends to have all three by default, because broad access is what makes it useful.

How the main tools handle tool calls today

Each coding tool ships its own safeguards, and they differ in ways that matter to a security team.

  • Claude Code. Its security documentation describes permission modes. In Manual mode it starts read-only and asks before editing files or running commands; network commands such as curl and wget prompt by default. Auto mode instead uses a separate classifier model to review actions and block ones it judges unsafe, while explicit allow and deny rules still apply.[1] The same page says the user is responsible for reviewing proposed code and commands before approval, and notes that reviewing a project's .mcp.json does not show every MCP server a session can load.[1]
  • Cursor. Cursor asks for approval before using MCP tools by default. Admins can set tool allowlists that restrict which tools from an approved server run automatically, and an empty allowlist allows every tool from that server.[3]
  • GitHub Copilot coding agent. GitHub's documentation warns that Copilot will not ask for approval before using the MCP tools you configure for it. GitHub strongly recommends allowlisting specific read-only tools, and notes that * enables every tool.[4]
  • VS Code. The MCP documentation advises reviewing the publisher, command or endpoint and requested access before installing or starting a server, and approving only actions you understand.[5]

The pattern is clear. Safety depends on per-tool settings, per-developer habits and a person reading each prompt. A team using three of these tools has three policies, three places to misconfigure, and no single record of what ran.

Pre-execution screening: the control that holds

The control that works across all of them is to inspect each tool call before it executes and decide allow, deny or ask by rule. The call is concrete at that moment: a tool name and its arguments. That is much easier to judge than the model's intent.

Claude Code exposes this point directly. Its PreToolUse hook fires before a tool call executes, receives the tool name and input, and can block the call, either with exit code 2 or by returning a permissionDecision of deny. MCP tools appear in these events under names like mcp__server__tool, so the same screening covers MCP calls.[2] The documentation also notes a subtlety: a hook that stays silent does not approve the call, and by default a timed-out hook does not block it either.[2]

What a good screening policy checks:

  • Shell commands that delete broadly, change permissions, pipe remote scripts into a shell, or touch credential files.
  • Network egress to destinations outside an allow-list, especially requests that carry file contents.
  • File access outside the project, and reads of secrets such as SSH keys, cloud credentials and .env files.
  • MCP tool calls to servers that are not approved, or to tools whose description has changed since review.
  • Combinations: a read of a secret followed by any outbound call in the same session.

The key property is that the decision is deterministic. A rule that says "deny outbound requests to unlisted domains" gives the same answer every time and can be audited. A judgment made by another model can be argued with by the same injected text that fooled the first one.

How to test your coding agent setup

  1. Inventory. For each developer tool in use, list its permission mode, its allow and deny rules, and every MCP server it can load, including servers added by plugins or user-level settings.
  2. Plant an injection. In a test repository, put an instruction in a README or code comment asking the agent to read a dummy secret file and send it to a test endpoint you control.
  3. Run the agent on an ordinary task in that repository, such as fixing a failing test, and watch what it attempts.
  4. Record the outcome at each step: did it read the file, did it attempt egress, was it stopped, and by what.
  5. Add or tighten the screening rule and repeat the same run. The fix counts only when the same planted instruction no longer gets data out.
  6. Repeat per tool. The result in one coding tool tells you nothing about another.

Coding agent security checklist

  • Pick one policy for all coding agents rather than per-tool settings.
  • Screen every tool call before it runs, including MCP calls.
  • Deny outbound network calls by default; allow-list the registries and APIs developers need.
  • Deny reads of credential files and secret stores from agent tool calls.
  • Allow only reviewed MCP servers, and restrict each to the tools the work requires.
  • Prefer read-only tools for autonomous agents that run without prompts.
  • Log every decision (allowed, denied, asked) with the tool name and arguments.
  • Re-test with a planted injection after any change to tools, servers or rules.

How Assuren's Local Guard does it

Local Guard is Assuren's local-first firewall for coding agents. It screens every coding-agent tool call before it runs, and it works across VS Code, Cursor, Claude Code, Windsurf and Copilot through one MCP integration. It runs on the developer's own machine, not in a vendor cloud.

Local Guard enforces by deterministic rule, never by a model's opinion. Policy decisions go through Open Policy Agent, and a model never changes a policy rule or approves its own action. The same policy logic also drives Assuren's optional cloud AI gateway, so one rule set covers both the developer's machine and production agents.

Local Guard is also one of Assuren's runtime telemetry sources, alongside the gateway and LLM traces. That telemetry is an input to the trust graph, where Assuren computes paths from untrusted input to sensitive data to egress and proves closures by replay; see prompt injection to data exfiltration and MCP server security.

Enforcement is opt-in: Assuren is assessment-first, and the inline pieces (Local Guard and the gateway) run only where you turn them on. You can create a free workspace and run it on your own agent. on your own developer setup.

Run this check on your own agent

Create a free Assuren workspace, register an agent and Assuren maps its trust graph, traces injection-to-exfiltration paths and proves each fix by replay. It runs read-only inside your boundary.

Create your workspace How Assuren works

Questions

Are the built-in approval prompts in coding tools enough?

They help, but they depend on a person reading every prompt, and they differ by tool. GitHub's documentation says Copilot coding agent does not ask for approval before using configured MCP tools. A pre-execution policy gives the same decision across every tool and keeps a record of it.

What is a pre-execution tool call check?

It is a check that runs after the agent decides to call a tool but before the call executes. It sees the tool name and arguments and returns allow, deny or ask. Claude Code's PreToolUse hook is one documented example of this point in the agent loop.

Which coding agents does Assuren Local Guard support?

Local Guard screens tool calls for VS Code, Cursor, Claude Code, Windsurf and Copilot through one MCP integration. It runs on the developer's machine.

Does Local Guard use AI to decide what to block?

No. Local Guard enforces by deterministic rule through Open Policy Agent. A model never changes a policy rule or approves its own action, so the same call always gets the same decision.

Can a malicious MCP server attack a developer machine?

Yes. The MCP security guidance describes local servers that run with the client's privileges and gives an example startup command that sends a user's SSH key to a remote host. Allow only reviewed servers and screen their tool calls.

Sources

  1. Claude Code: Security. Anthropic. https://code.claude.com/docs/en/security
  2. Claude Code: Hooks reference. Anthropic. https://code.claude.com/docs/en/hooks
  3. Cursor: Model Context Protocol (MCP). Cursor. https://cursor.com/docs/context/mcp
  4. Extending GitHub Copilot coding agent with the Model Context Protocol (MCP). GitHub. https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp
  5. Use MCP servers in VS Code. Microsoft. https://code.visualstudio.com/docs/copilot/chat/mcp-servers
  6. MCP Security Best Practices: Local MCP Server Compromise. Model Context Protocol. https://modelcontextprotocol.io/specification/2026-07-28/basic/security_best_practices
  7. LLM06:2025 Excessive Agency. OWASP Gen AI Security Project. https://genai.owasp.org/llmrisk/llm062025-excessive-agency/

More Assuren guides