NewsCrawler.org

After isolating Claude Code in a container: connectors, tokens and permission rules

Claude Code をコンテナで隔離したあとに見直したもの:コネクター、トークン、許可の規則
Image: zenn.dev

The author isolated Claude Code in an Apple container, limiting its file access and network traffic, and all firewall checks passed. However, the claude.ai connectors (Box, Gmail, Google Calendar, Google Drive, Slack) worked inside the container, even though the firewall should have blocked Gmail and Slack. The author believes the connector traffic goes through the allowed Anthropic address, so the firewall cannot stop it, and calls this normal behavior of logging in with a claude.ai account rather than a bug.

To turn the connectors off, the author set ENABLE_CLAUDEAI_MCP_SERVERS=false in the image, added disableClaudeAiConnectors: true, and added a deny rule for mcp__claude_ai_*. After a rebuild, /mcp showed no configured MCP[1] servers. For GitHub, the container uses a fine-grained token[2] limited to one repository, with read and write access to contents, issues and pull requests, read-only access to Actions, no Workflows permission, and a 30-day expiry. This broke gh pr checks, because the token cannot be given the Checks permission, so the author now checks CI with gh run list and gh run view --log.

The last layer is permission rules. The deny list blocks force push[3], gh pr merge, repository deletion, gh auth and write calls to gh api, and the ask list covers git reset --hard and rm -rf. The full file has 116 deny rules and 28 ask rules. The rules match command text, so a different way of writing a command, such as a full path, may bypass them, and the author treats them as a final safeguard. The comparison with Claude Code's built-in sandbox begins by noting that the built-in sandbox covers only shell commands and their child processes.

Read the original zenn.dev

Sources

  • Zenn JA

    Claude Code をコンテナで隔離したあとに見直したもの:コネクター、トークン、許可の規則

    5 likes0 bookmarks0 comments

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

Open as a page