Claude Code Security: What You Need to Know Beyond Anthropic Built-In Protections

Anthropic is honest about what their safeguards cover. Here is what you still need.

What Anthropic Says

Prompt injection is a technique where an attacker attempts to override or manipulate an AI assistant instructions by inserting malicious text.
No browser agent is immune to prompt injection.

That is Anthropic, being accurate. Claude Code is powerful -- it can read your codebase, edit files, run commands, and with Dispatch or Cowork do all of that on a schedule from anywhere. That capability is what makes security matter.

The Problem with Just Review Before Approving

Claude Code default model is permission-based. For interactive sessions that works. But two scenarios break it.

Running Dispatch or scheduled tasks unattended

Claude Code Dispatch runs tasks on a schedule on Anthropic infrastructure. You are not there when it runs. No approval prompt. If the task gets hijacked mid-execution, you find out later.

The injection happens before the approval

Indirect prompt injection hides instructions in places Claude reads: a README, a code comment, a webpage, a document. By the time you see the approval request, the framing has already been shaped by injected content.

Lasso Security documented exactly this: The attacker never interacts with the AI directly. Instead they hide malicious instructions in places the AI will read.

What About Sandboxing and Hooks

Sandboxing

Enabled with /sandbox, it isolates bash commands. If an injection succeeds, it limits blast radius. But it is not on by default and does not stop the injection from happening.

Hooks

Hooks let you intercept tool calls with custom scripts. They catch what they are configured to catch. A sophisticated injection finds the gap.

Anthropic Cowork docs: Only connect these agents if you are comfortable with what they could do, not just what you intend them to do. That is good advice. Shoofly is how you act on it.

What Shoofly Adds

Shoofly is a pre-execution security layer for Claude Code. It works alongside Anthropic built-in protections and does behavioral analysis in real time.

Every tool call goes through Shoofly before it executes. Not logged after. Checked before.

For Dispatch and scheduled tasks specifically

Shoofly gives you a running audit trail of everything your unattended agent did, flagged by severity.

One important note

Dispatch tasks running on Anthropic cloud infrastructure do not execute local hooks. Shoofly covers local Claude Code CLI sessions fully.

Frequently Asked Questions

Is Claude Code safe for automated tasks?

Anthropic takes security seriously but safe depends on your threat model. Shoofly adds behavioral monitoring and pre-execution blocking that Anthropic tools are not designed to provide.

What is prompt injection in the context of Claude Code?

Malicious instructions hidden in content Claude reads -- a file, a webpage, an API response -- that override its intended behavior. Anthropic documents this as the primary risk.

Does Dispatch run securely on Anthropic infrastructure?

Infrastructure security is solid. The risk is Claude behavior being redirected by injected content in the tasks it processes. That is a model behavior issue, not an infrastructure issue.

What is the risk with Claude Code Cowork?

PromptArmor documented that Claude Cowork is vulnerable to file exfiltration via indirect prompt injection. An attacker embeds a malicious prompt in a file, Cowork reads it, then uploads your files to the attacker server. Confirmed against Claude Haiku and Opus 4.5.

How does Shoofly work with Claude Code?

Installs a local daemon and registers a hook in ~/.claude/settings.json. Before any tool call executes, the hook checks it against Shoofly threat policy. Pass means run. Fail means block and alert.

Does Shoofly replace Anthropic safeguards?

No. Works alongside them. Shoofly adds behavioral analysis at the tool-call level.

What is the difference between Basic and Advanced for Claude Code?

Basic watches and alerts. Advanced blocks before execution. Basic detects. Advanced stops. Advanced is 5 dollars per month.

Will Shoofly break my Claude Code workflows?

It should not. Legitimate calls pass through. False positives can be allowlisted.

Does Shoofly work with Claude Code Dispatch?

Local Claude Code CLI sessions are fully covered. Tasks dispatched from Anthropic's cloud infrastructure don't execute local hooks — that's a known limitation we're transparent about.

What does pre-execution blocking mean?

Shoofly intercepts the tool call before Claude executes it. Before the file is written, before the command runs, before the network request fires. Stopped before, not detected after.