If you want to give an AI agent like Claude Code access to your terminal, local files, API keys and third party connectors, these are the risks I'd plan for and the controls that deal with them.
When AI lived in a browser tab, security mostly meant keeping company secrets out of the chat window. An agent with terminal access is different. You're trusting the model, and you're also trusting every file, webpage and tool it reads along the way.
Indirect Prompt Injection
I trust Anthropic, and I don't expect Claude to go rogue on my machine. Models are gullible though. An LLM reads everything as one stream of text, with no hard boundary between my instructions and the content it pulls in from outside.
If I ask an agent to review a GitHub repo, a webpage or an email, an attacker can hide instructions in that text. A line in a code comment or an email footer can tell the agent to read my API keys or run a command, and it will often do it.
It doesn't take an attacker either. An agent trying hard to fix an error can leak a secret into a public log or run a destructive command by itself.
MCP Connector Risks
Connectors like MCP servers add their own problems, even when you're careful about what you point the agent at.
- Tool poisoning: an MCP server sends the model a text description of each tool. You see a clean tool name in the UI, while the description can carry hidden instructions to read your SSH keys or environment variables first.
- Rug pulls: a connector can be safe on the day you install it, then push an update that swaps in malicious instructions with no new approval prompt.
- Tool shadowing: a compromised connector doesn't need permissions of its own. Its instructions can change how the agent uses a connector you do trust, like GitHub, email or the file system.
Every connector you add means trusting its developer, plus anyone who manages to compromise their repo.
Local Runtime Proxy Setup
Traditional security handles this with a policy enforcement point, a fail-closed checkpoint that sits between a subject and a resource so nothing gets around inspection. Tools like Crawdad bring that pattern to a laptop. There's no plugin to install inside Claude and no code to change.
- Run the proxy locally. It opens a listening port on your machine.
- Point the agent at it with
ANTHROPIC_BASE_URL, in your shell or in~/.claude/settings.json. - Store your real API key in the proxy and give Claude a placeholder. If an injection gets Claude to dump its environment variables, the attacker gets nothing usable.
export ANTHROPIC_BASE_URL="http://127.0.0.1:{port}"
Every prompt, tool call and response passes through the proxy before it leaves your machine. If it sees a prompt injection, a leaked credential or an out of bounds tool call, it drops the request and logs it.
On macOS you can run the agent under a dedicated user account and add a pf firewall rule, so the agent can't skip the proxy and reach the internet directly.
macOS Security Tool Layers
If you already run endpoint tools on your Mac, which cyber insurance policies like Chubb often require, the proxy covers a layer they don't.
| Tool | Layer | What It Watches |
|---|---|---|
| BlockBlock | Persistence | Apps or scripts installing themselves as Login Items or LaunchAgents |
| LuLu / Little Snitch | Network egress | Whether an app is allowed to connect to a remote server at all |
| Crawdad | AI traffic | What's inside an allowed AI connection: leaked secrets, injections, bad tool calls |
An outbound firewall tells you where an app is connecting. The proxy reads what gets sent once that connection is allowed.
Other Prompt Defenses
- Agent gateways: Crawdad and the Linux Foundation's agentgateway sit in the path of local coding agents and MCP servers.
- Cloud AI firewalls: Lakera Guard, Prompt Security, Azure AI Prompt Shields and NVIDIA NeMo Guardrails screen prompts and responses for enterprise apps.
- Input sanitization: strip invisible Unicode characters and wrap external data in explicit tags, so the model has a better chance of telling instructions from data.
- Dual LLM isolation: one quarantined model with no tools reads the untrusted data, and a second model with tool access never sees the raw text.
Enterprise AI Agent Controls
A proxy catches bad traffic on the wire. IT teams rolling out coding agents, support bots and internal automation are adding these on top of it.
| Control | What It Does |
|---|---|
| Sandboxing | Runs agents in disposable containers, microVMs like Firecracker or cloud dev environments, away from SSH keys, browser cookies and the VPN |
| Non-human identity | Gives each agent its own short-lived, narrowly scoped credentials. It no longer inherits the employee's full permissions |
| MCP registries | An approved list of vetted connectors with pinned tool descriptions, which stops rug pulls and unapproved servers |
| Approval gates | Read-only lookups run automatically. Deleting files, merging to production, refunds and client emails wait for a person |
| AI-aware DLP | Watches for source code, customer lists and credentials leaving through prompts, tool arguments, URL query strings or Markdown image tags |
| Audit logs | Tamper-evident records of every prompt, tool call and file change, so an incident can be reconstructed |
| AI-SPM | Scans endpoints, cloud accounts and browser extensions to find the agents, API keys and connectors employees already set up |
Adoption Criteria
If you only use an AI assistant in a browser tab, or paste in code snippets that you review yourself, you don't need most of this.
It's worth setting up once an agent has terminal access, file permissions, API keys and MCP connectors all at the same time. That applies to my own MacBook the same way it applies to a company with hundreds of developers. I treat the agent like any other untrusted process, limit what it can touch, and put a checkpoint in front of everything it sends.
Top comments (0)