excludedCommands does not bypass network sandbox for SSH/git operations
Resolved 💬 4 comments Opened Feb 27, 2026 by zeitlinger Closed Feb 27, 2026
Description
excludedCommands in sandbox settings does not fully bypass the network sandbox. Commands listed in excludedCommands are expected to run completely outside the sandbox, but they still have network restrictions applied — specifically, SSH connections fail even when the target host is in allowedNetworkHosts.
Steps to reproduce
- Configure sandbox settings in
~/.claude/settings.json:
{
"sandbox": {
"enabled": true,
"autoAllowBashIfSandboxed": true,
"excludedCommands": ["docker", "git"],
"allowedNetworkHosts": ["github.com", "api.github.com"]
}
}
- Start a new Claude Code session
- Run any git command that uses SSH:
git push origin my-branch -u
git ls-remote --heads git@github.com:owner/repo.git
- Observe DNS resolution failure:
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
fatal: Could not read from remote repository.
- Same command with
dangerouslyDisableSandbox: trueworks fine.
Expected behavior
Commands listed in excludedCommands should bypass all sandbox restrictions, including network/DNS filtering. This is consistent with how docker exclusion is documented to work.
Actual behavior
excludedCommandsappears to bypass filesystem restrictions (e.g.,chezmoican write to its state DB when excluded)excludedCommandsdoes not bypass network restrictions — SSH connections still fail because DNS resolution to127.0.0.53(systemd-resolved) is blockedallowedNetworkHostsonly covers HTTP/HTTPS connections, not SSH (port 22)- The only workaround is
dangerouslyDisableSandbox: true
Additional context
- The runtime sandbox
Network: {"allowedHosts": [...]}does includegithub.com gitis confirmed inexcludedCommandsvia settings.json- The session was freshly started (not resumed) after settings were deployed
- Platform: Linux (systemd-resolved for DNS on 127.0.0.53)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗