NewsCrawler.org

Claude Code on a Mac: why and how to isolate the agent in a container or VM

Claude Code、コンテナで隔離してないのは出遅れ?今さらでも安全に隔離するために
Image: zenn.dev

The article is about harness engineering[1], which the author describes as designing everything outside the model, such as the environment and guardrails, so that mistakes are controlled. Tsuritani of Gixo Inc. writes on Zenn that he ran Claude Code directly on his Mac with the same permissions as his own account. This meant the agent could read cloud credentials in ~/.aws, use his GitHub token to push to repositories other than the one he was working on, and use services connected through claude.ai, such as Gmail and Slack. He says he has not had an actual incident because he does not use auto-approval, but he worries about mistakes and prompt injection[2], where instructions hidden in web pages or issues can make the agent act.

He describes three levels of protection: permission rules in settings.json, the built-in sandbox[3] that covers only shell commands, and a container or virtual machine around the whole Claude Code process. He chose the third level and runs Claude Code in Apple container, a lightweight VM on Mac. He adds layers: only the repository and the login folder are mounted, outgoing traffic is limited by a firewall, the GitHub fine-grained token covers only one repository, claude.ai connectors are not loaded, and the version is pinned.

Everyday work still works, including reading and writing repository files, commits, push, pull requests, and access to the Anthropic API and GitHub. Cloud access and some gh commands, such as gh pr checks after switching to a fine-grained token, no longer work, and he checks CI results with gh run list. According to the author, the fixed permissions let him use Claude Code's auto mode with less worry.

Read the original zenn.dev

Sources

  • Zenn JA

    Claude Code、コンテナで隔離してないのは出遅れ?今さらでも安全に隔離するために

    5 likes3 bookmarks0 comments

Published: First seen: Читать по-русски

Open as a page